How to underline words in LaTeX

The normal \underline{text} seems pretty bad. It does not break at new line. So I found that we can use a package called “ulem”. This is how to do it:

\usepackage[normalem]{ulem}

and inside the text:

\uline{my underline text}

 

Advertisements

Installing revtex style .sty in Linux Ubuntu

I followed the step in: http://blog.irrepupavel.com/2007/02/installing-latex-style-files-sty-on.html

  1. I unzip the package revtex4.1.zip
  2. And copy the directories one by one to /usr/share/texmf-texlive/, e.g. sudo cp -r source /usr/share/texmf-texlive/
  3. then type: sudo mktexlsr

How to embed fonts when using pdflatex and gnuplot

IEEE require that PDF documents are created with embedded fonts. To do this, run

$ updmap --setoption pdftexDownloadBase14 true

And then run pdflatex again. To check whether it is embedded, run pdffonts on to the newly created pdf. You will see something like this.

$ pdffonts draft_isic2009_1.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
OONIXM+NimbusRomNo9L-Regu            Type 1            yes yes no       6  0
LREKMX+NimbusRomNo9L-MediItal        Type 1            yes yes no       7  0
GPJANF+NimbusRomNo9L-Medi            Type 1            yes yes no       8  0
SOCFYY+CMMI10                        Type 1            yes yes no       9  0
XUABDJ+CMR10                         Type 1            yes yes no      18  0
[none]                               Type 3            yes no  no      19  0
[none]                               Type 3            yes no  no      20  0
NYFSWW+CMR7                          Type 1            yes yes no      21  0
[none]                               Type 3            yes no  no      22  0
Symbol                               Type 1            no  no  no      25  0
MJDZZV+Arial                         TrueType          yes yes no      26  0
NEOHJY+Arial                         TrueType          yes yes no      33  0
RGPVWY+CMMI7                         Type 1            yes yes no      42  0
QFGUOO+Arial                         TrueType          yes yes no      45  0
WHIAUZ+NimbusRomNo9L-ReguItal        Type 1            yes yes no      54  0
Symbol                               Type 1            no  no  no      57  0
KLCILH+Arial                         TrueType          yes yes no      58  0
SHWEVG+Arial                         TrueType          yes yes no      65  0
PWUUWC+Arial                         TrueType          yes yes no      71  0

Now you notice that Symbol font is not embedded. It turns out to be from the figures that I have. I created my figures using Gnuplot, and it gives the eps file. The eps file is then converted to pdf using epstopdf command. If you type pdffonts to this figures, you will notice that the symbol font is not embedded. To ensure that the symbol font is embedded, edit the following file:

/usr/share/ghostscript/8.61/lib/gs_pdfwr.ps

And comment the lines as shown below:

/.standardfonts [
% /Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
% /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
% /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
% /Symbol /ZapfDingbats
] readonly def

After this, run epstopdf again, and check using pdffonts. I ran my pdflatex to my tex file again, and check to find that all fonts have been embedded:

$ pdffonts draft_isic2009_1.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
OONIXM+NimbusRomNo9L-Regu            Type 1            yes yes no       6  0
LREKMX+NimbusRomNo9L-MediItal        Type 1            yes yes no       7  0
GPJANF+NimbusRomNo9L-Medi            Type 1            yes yes no       8  0
SOCFYY+CMMI10                        Type 1            yes yes no       9  0
XUABDJ+CMR10                         Type 1            yes yes no      18  0
[none]                               Type 3            yes no  no      19  0
[none]                               Type 3            yes no  no      20  0
NYFSWW+CMR7                          Type 1            yes yes no      21  0
[none]                               Type 3            yes no  no      22  0
CNBJKM+Symbol                        Type 1C           yes yes no      25  0
MJDZZV+Arial                         TrueType          yes yes no      26  0
NEOHJY+Arial                         TrueType          yes yes no      35  0
RGPVWY+CMMI7                         Type 1            yes yes no      44  0
QFGUOO+Arial                         TrueType          yes yes no      47  0
WHIAUZ+NimbusRomNo9L-ReguItal        Type 1            yes yes no      56  0
CNBJKM+Symbol                        Type 1C           yes yes no      59  0
KLCILH+Arial                         TrueType          yes yes no      60  0
SHWEVG+Arial                         TrueType          yes yes no      69  0
PWUUWC+Arial                         TrueType          yes yes no      75  0

Custom Header/footer in Latex

Use “fancyhdr” package in latex to flexibly design your header and footer. Read the manual at:

http://www.ctan.org/tex-archive/macros/latex/contrib/fancyhdr/fancyhdr.pdf

Multiple images in one figure by using subfig Latex

I found a package “subfig” which can be used to create “subfigures” within one floating figure in Latex. To do this simply type

\usepackage{subfig}
in the preamble, and then create a floating figure
\begin{figure}
\centering
\subfloat[]{\includegraphics[width=3.1in]{figures/gpEcUND.eps}}
\subfloat[]{\includegraphics[width=3.1in]{figures/gpgTND.eps}}
\caption{Potential for 0.5 V bias.}
\label{fig:EcUND}
\end{figure}

This will create figures (a) and (b) side by side. For more info, you can read the manual of subfig.

Writing computer or programming code in Latex

To write a code in latex, you can use \begin{verbatim} \end{verbatim} environtment. A similar approach is by doing this


\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small}

and then you can type your code in the body

\begin{code}
c+=1;
\end{code}

Installing mathabx package for Latex Tex-Live

I am using Kubuntu 8.04, and current need to install mathabx package. Download from here.

Copy the *.mf files to

$TEXMF/fonts/source/public/mathabx

for my case, TEXMF=/usr/share/texmf-texlive/
and copy the rest to
$TEXMF/tex/generic/misc/

make sure it is readable, by changing the priviliges, for example by typing chmod a+r mathabx, and so on.

Then update the database by typing: sudo texconfig rehash
and update the format file by typing: sudo fmtutil --refresh