Last modified: Feb, 2014
I use TeXLive for anything related to LaTeX in all my Linux machines. Installing from the source rather than distribution’s repositories is actually preferred.
Get TeXLive
I use rsync to grab the TeXLive source. The advantage is I can easily update the source to the latest version with rsync. Here is the rsync command:
rsync -a --delete --progress rsync://mirror.unl.edu/ctan/systems/texlive/tlnet/ $HOME/texlive_src
Refer to this link for further information and this link for more mirrors.
Install TeXLive
Easy:
cd $HOME/texlive_src
perl install-tl
Just follow the instructions after that.
Install and update packages
The program ‘tlmgr’ helps you with that:
tlmgr search [keyword]
tlmgr install [package_name]
To update TeXLive:
tlmgr update --self
tlmgr update --all
Sometimes when you compile a LaTeX source, there may be error messages like
! LaTeX Error: File `esint.sty' not found.
It means the style file “esint” is not found in the system. This can be resolved by installing package ‘esint’.
Method 1: use repository
In TeXLive, command tlmgr is used to manage TeX packages.
tlmgr install esint
A somewhat detailed usage of tlmgr can be found at tlmgr@TeXLive, or simply
man tlmgr
Method 2: install from source
Just download ‘esint’ from CTAN, unzip to a local directory like /home/user/tex/, and run command
texhash home/user/tex
Or copy the downloaded package to “texlive/201X/texmf-local/tex/latex/local”, and do
texhash
Beamer has “\logo” command, but I use package “‘textpos’”. Basically this package give users more control over the position of a “box” in LaTex text.
First enable this package:
Here “overlay” makes logos appear above Beamer’s text layer. Then define a macro that inserts logos
This draw a logo at the upper right corner. The code is self-explanatory.
TIPS: Do not use “_”, “-“, “.” and so on for macro names, or errors occur.
Insert command “\mylogo” in pages that need the logo.
Reference
BibTeX entry format
A BibTeX entry example is like this
@ARTICLE{sc_eff_tables_v37,
author = {Martin A. Green and Keith Emery and Yoshihiro Hishikawa and Wilhelm
Warta},
title = {Solar Cell Efficiency Tables (Version 37)},
journal = {Prog. Photovolt: Res. Appl.},
year = {2011},
volume = {19},
pages = {84}
}
Note that
In author field, one should specify names like “A and B and C and D” instead of “A, B, C and D”. The former will be automatically formatted to “A, B, C and D” in Tex compilation (and appear like that afterwards), while the later will give errors in compilation.
All characters except the first one in “title” field will be decapitalized after being processed by BibTeX. To keep the default style, one can encapsulate the part with {}. One can also use LaTeX macros within {} in these fields too. For example,
@MISC{example1, author = {A and B and C}, note = {{\LaTeX} in {X}}, year = {2012} }
To type math expressions in BibTeX, use “$…$” environment.
To insert URL in BibTeX entry, don’t forget including
in the LaTeX preamble. Otherwise there will be compiling error.
Reference
BibTeX citation order
Question: By default BibTeX orders citations alphabetically (by the last name of first author) in “plain” bibliography style. How to order citations by order of appearance?
Answer: Use ‘unsrt’ (unsorted?) bibliography style. For example,
Reference
in the preamble. Package website is http://www.ctan.org/pkg/hhline.
More information can be found at CTAN repo.
Fontsize
V \sim IR
\notag
For example,
http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Matrices.html
Common Confusion
TeXMaker is an excellent TeX IDE I used. However, in my 64-bit machine, I have to do a few hacks to make it work.
sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.4 /usr/lib/libtiff.so.3
sudo ln -sf /usr/lib/x86_64-linux-gnu/libjpeg.so.8 /usr/lib/libjpeg.so.62
Insert code blocks in LaTeX
The easiest way is to put them in ‘verbatim’ environment
For example:
draws a line with direction (1,0) and length of 200.
First define a “new command” like:
in preamble. To use it:
Refer to this post for details.