Attention: Dear Contributors! This page is going to be every long. I propose, we shall structure it into the following: 1.Title page, 2.Floats and tables, 3.Math, 4.Miscellaneous 5.Bibliography. This is a preliminary list. Please modify it as you will.--Sai
We can use LaTeX for word processing and for presentations (with \documentclass{beamer}). Wikibooks has an extensive guide available on web and as pdf. All the commands are between LaTeX and its beamer version. However, there are some things we may require for a presentation (e.g., including a movie), which are described here. This page shall contain almost everything you need for writing a report/manuscript. Here is an interesting comparison of MS word and LaTeX by Marko Pinteric:
1. Installing local packages
create a texmf/tex/latex/ folder in your home directory
download your favourite package (e.g. the package subfiles (which is awesome)) and put it in ~/texmf/tex/latex/
extract the package and cd into the folder (e.g. ~/texmf/tex/latex/subfiles/)
latex the .ins file: (latex subfiles.ins). This will create the .sty file
Most packages also have a .dtx file. LaTeXing this will create a user manual of the package
Now LaTeX has to know where to find the package. LaTeX always looks into the texmf folder in your home dir, but it needs an index. You can generate this automatically by doing texhash texmf (from your home directory of course)
TODO: installing fonts. This is more difficult...
2. Tex editors
Kile.
Gummi
LyX
TeXstudio
3. Title page
Multiple authors and affiliations
Include '\usepackage{authblk}' in the preamble. Needless to mention, package authblk should be on your system.
Example: \usepackage{authblk}
\title{More than one Author with different Affiliations} \author[1]{Author A\thanks{A.A@university.edu}} \author[1]{Author B\thanks{B.B@university.edu}} \author[1]{Author C\thanks{C.C@university.edu}} \author[2]{Author D\thanks{D.D@university.edu}} \author[2]{Author E\thanks{E.E@university.edu}} \affil[1]{Department of Computer Science, \LaTeX\ University} \affil[2]{Department of Mechanical Engineering, \LaTeX\ University}
The resulting title page may look like:
4. Figures and tables
Figure legends and tables
Often, Journals want LaTeX files that do not include figures, but that do include the figure legends and tables at the end of the document. This can cause all sorts of problems. A simple hack is given below.
%%%%%%%%%%%%%%%%%%%% copy this to your header: %%%%%%%%%%%%%%%%%%\newcounter{figurecounter} \setcounter{figurecounter}{0}\newcounter{tablecounter}\setcounter{tablecounter}{0}\newcommand{\nofloatfigure}[1]{%\refstepcounter{figurecounter}%% increases the counter and makes it possible to give it a label\noindent{\bf Figure~\thefigurecounter:~#1}}\newcommand{\nofloattable}[1]{%\refstepcounter{tablecounter}\noindent{\bf Table~\thetablecounter:~#1}
}%%%%%%%%%%%%%%%%%%%% example of references: %%%%%%%%%%%%%%%%%%%%%
As we can see in Figure~\ref{fig:myfigurelabel}, bla bla.
Furthermore, the results are listed in Table~\ref{tab:mytablelabel}.
%%%%%%%%%%%%%%%%%%%%%% a figure legend: %%%%%%%%%%%%%%%%%%%%%%%%%\nofloatfigure{A nice figure title.}\label{fig:myfigurelabel}
Bla bla, this figure is amazing! The heavy graphs
represent the average of the thin lines. The colors
are meaningless.
%%%%%%%%%%%%%%%%%%%%%%%%%% a table: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%\nofloattable{A nice table title.}\label{tab:mytablelabel}\\\begin{tabular}{llc}%% some table...\end{tabular}\noindent bla bla, this table should be pretty clear.
Supplementary figure numbering
The numbering of supplementary figures can be formatted as "Figure S1", "Figure S2", etc. as follows (source):
%% add the following definition to the preamble\newcommand{\beginsupplement}{%\setcounter{table}{0}\renewcommand{\thetable}{S\arabic{table}}%\setcounter{figure}{0}\renewcommand{\thefigure}{S\arabic{figure}}%}%% then, when your supplement begins, write:\beginsupplement%% any following figure and table numbers will be formatted with a leading "S", and counting starts at "S1"
5. Everything about Math
Get nice fractions
Often displayed fractions can look bad, because subscripts or superscripts touch the line. This can be fixed by using \dfrac{}{} instead of \frac{}{}.
In order to use this, you must include the package amsmath
When you don't want a gigantic fraction in your displayed formula, then use \tfrac{}{}. For instance, \[ \int x\, dx = \tfrac{1}{2} x^2 + c \] looks better than writing the same thing with \frac{}{}
latexdiff does not work so well with pdflatex: The colours misbehave. Also, it might be necessary to adjust the file difference.tex a bit, because changes in tables sometimes causes latexdiff to produce illegal latex code. Finally, the version of latexdiff on our system appears to be old, so download the newest version!
7. Useful LaTeX Snippets
Here you can find a bunch of short pieces of LaTeX
%% \usepackage{a4wide} % is said to be out-dated. To get the same result, use\usepackage{geometry}\geometry{includeheadfoot, margin=2.54cm}%% the geometry package is very useful for thesis layout too
All you need to know about \LaTeX :-)
Attention: Dear Contributors! This page is going to be every long. I propose, we shall structure it into the following: 1.Title page, 2.Floats and tables, 3.Math, 4.Miscellaneous 5.Bibliography. This is a preliminary list. Please modify it as you will.--Sai
We can use LaTeX for word processing and for presentations (with \documentclass{beamer}). Wikibooks has an extensive guide available on web and as pdf. All the commands are between LaTeX and its beamer version. However, there are some things we may require for a presentation (e.g., including a movie), which are described here. This page shall contain almost everything you need for writing a report/manuscript. Here is an interesting comparison of MS word and LaTeX by Marko Pinteric:
1. Installing local packages
TODO: installing fonts. This is more difficult...
2. Tex editors
3. Title page
Multiple authors and affiliations
Include '\usepackage{authblk}' in the preamble. Needless to mention, package authblk should be on your system.Example:
\usepackage{authblk}
\title{More than one Author with different Affiliations}
\author[1]{Author A\thanks{A.A@university.edu}}
\author[1]{Author B\thanks{B.B@university.edu}}
\author[1]{Author C\thanks{C.C@university.edu}}
\author[2]{Author D\thanks{D.D@university.edu}}
\author[2]{Author E\thanks{E.E@university.edu}}
\affil[1]{Department of Computer Science, \LaTeX\ University}
\affil[2]{Department of Mechanical Engineering, \LaTeX\ University}
The resulting title page may look like:
4. Figures and tables
Figure legends and tables
Often, Journals want LaTeX files that do not include figures, but that do include the figure legends and tables at the end of the document. This can cause all sorts of problems. A simple hack is given below.Supplementary figure numbering
The numbering of supplementary figures can be formatted as "Figure S1", "Figure S2", etc. as follows (source):
5. Everything about Math
Get nice fractions
Often displayed fractions can look bad, because subscripts or superscripts touch the line. This can be fixed by using \dfrac{}{} instead of \frac{}{}.In order to use this, you must include the package amsmath
When you don't want a gigantic fraction in your displayed formula, then use \tfrac{}{}. For instance, \[ \int x\, dx = \tfrac{1}{2} x^2 + c \] looks better than writing the same thing with \frac{}{}
Draw your symbols!
Problems finding the correct symbols? Check: http://detexify.kirelabs.org/classify.html6. Auxiliary software
LaTeXdiff
With latexdiff, one can see changes between two versions of a latex file. Usage:$ latexdiff oldversion.tex newversion.tex > difference.tex $ latex difference.tex $ dvipdf difference.dvilatexdiff does not work so well with pdflatex: The colours misbehave. Also, it might be necessary to adjust the file difference.tex a bit, because changes in tables sometimes causes latexdiff to produce illegal latex code. Finally, the version of latexdiff on our system appears to be old, so download the newest version!7. Useful LaTeX Snippets
Here you can find a bunch of short pieces of LaTeX