how to write the header (all in one)
1 |
|
references
1 |
|
1 |
|
e.g. i.e., etc.
1 |
|
Appendix
1 |
|
1 |
|
Line spacing and margins
Change line spacing for the whole document:
1 |
|
Change margins:
1 |
|
Microsoft engineers set the defaults for an A4 page (210 mm x 297 mm) at 1 inch (25.4 mm) top and bottom, with 1 and a 1/4 inch (31.7 mm) on each side.
Citations
Easily switch between (number) and (number+author) in the same document. Year is not shown. With plainnat
, the number is different from unsrt
, the ordering of citation numbers are not determined by the order of appearance.
1 |
|
1-column abstract in 2-column document
https://www.texfaq.org/FAQ-onecolabs
1 |
|
Be careful when using long equations that would span across two columns.
Figures
1 |
|
Positioning of floating elements
In order to be able to use the option [H]
, do the following:
1 |
|
In order to placing a figure spanning the two columns of a twocolumn
document, we need to use the starred version of the {figure*}
environment to enable the figure occupy the two columns. Example:
1 |
|
{figure*}
should not be used together with [H]
.
Table
In order to make a table with 3 rows and 4 columns:
1 |
|
If the above table has too many columns that do not correctly fit the page width, one can use \begin{adjustbox}{width=\linewidth}
The signification of the parameters of \begin{tabular}
:
l
left-justified columnc
centered columnr
right-justified column|
vertical line||
double vertical line|||
triple vertical line
Once in the tabular
environment, &
is column separator, \\
is start new row, \hline
is horizontal line.
\checkmark
and $\times$
can be used for binary information.
1 |
|
\makecell{A \\B \\C}
can be used to break lines in table cells. \thead{A \\B \\C}
additionally makes the text bold.
If one only needs the header to be bold, one can just put \bf
before the name (no need to put any {
or }
around).
Import a csv file as table
The solution I found is to use a tool to transform a .csv
file to a .tex
file and then copy the text content onto our document. A tool that works well is CSV2LaTeX (http://brouits.free.fr/csv2latex/).
The stable version can be downloaded here: http://brouits.free.fr/csv2latex/csv2latex-0.22.tar.gz Unzip the downloaded file, then run make
within the unzipped directory. This make
command will not install the software in the system (at least not on my MacOS), it only generates an executable file called csv2latex
. Put the executable file called csv2latex
and the target .csv
file under the same directory, do:
1 |
|
We can also specify the format of the csv file, and some output disposition.
- The separator is a comma, block delimiter is a double-quote, and produces a LaTeX document with 40 lines per table and where the text is flushed left in each cell. 40 lines is a good average for A4 paper:
1 |
|
- The separator is a semi-colon, block delimiter is a simple quote and produces a LaTeX document with 20 lines per table and where the text is centered in each cell.
1 |
|
- If you have tricky block delimiter such as $ and separators like tabs, let the program guess
1 |
|
The generated document.tex
contains tabular
code. We can copy-paste it into something like this:
1 |
|
Below are some other solutions. These solutions do not work well.
This solution will ignore rows whose row index contains special symbols such as %
1 |
|
This solution does not ignore rows whose row index contains special symbols such as %
. It also automatically set up column names and columns. However, it is not clear how to specify table format. Another problem is that if the special symbol _
appears in a column name, it will become another symbol in the compiled pdf.
1 |
|
This solution automatically generate column names as Column1
, Column2
, etc. The generated table does not have lines inside the table.
1 |
|
Hyperlinks
1 |
|
If the Text
part also contains an URL, you may want to use \url{}
for that part. Otherwise you may get the error Missing $ inserted
if your URL contains symbols like _
. However, don’t use \url{}
for the URL part (the first part) of \href{}{}
, otherwise you will get fatal compilation error.
Multi-line (block) comments
1 |
|
Mathematics
1 |
|
Glossary
1 |
|