# LaTex

Some notes and examples in LaTex

Font Type3 error in your PDF:
When you submit a PDF to a journal, it may happen that the submission system complains about the presence of font Type3. This occurs with, e.g., the QJRMS.
Here a step-by-step recipe on to fix this issue before submission:

1. >> cd $your_latex_article_source 2. >> rm *.pdf 3. >> pdflatex article.tex 4. Step 3 will generate a series of new *.pdf files. One is article.pdf and there will also be one *.pdf for every image that is included in the latex file. 5. >> grep 'Type3' ./* 6. Step 5 will output on screen a list of all the *pdf files that contain a Type3 font. If, for example, the file "figure1-eps-converted-to-pdf.pdf" appears in the list from step 5, it means that the file "figure1.eps' contains Type3 fonts. 7. >> mkdir tmp-eps 8. cp to tmp-eps figure1.eps and all the other *.eps files whose *.pdf conversion was listed with the "grep" command (point 5 above) 9. >> cd tmp-eps 10. Use the following command to convert each *eps with Type3 fonts to a new *eps that does NOT contain any Type3 font 11. >> gs -sDEVICE=epswrite -dNOCACHE -sOutputFile=NEW_EPS_FILENAME -q -dbatch -dNOPAUSE ORIGINAL_EPS_FILENAME -c quit Repeat step 11 for each one of the eps files in tmp-eps. 12. At the end of step 11, you will have the new eps files that do not contain a Type3 font. Ex. figure1.eps and new-figure1.eps 13. For each new-*.eps, cp it to the original file name *.eps: Ex. >> cp new-figure1.eps figure1.eps 14. Now, mv all these *eps files back to the origiunal directory (overwrite them if necessary). 15. >> cd$your_latex_article_source
17. Your new PDF file shoudl NO LONGER contain Type3 fonts.

Thanks to John Regan for pointing out this command in his blog http://www.helsinki.fi/~regan/blog.html

• Using regular fonts (not italic) within the equations: use the command \mathrm{} for the part of text of interest within the equation

• Bold symbols:

\usepackage{bm} %for bold greek letters in the math mode

...
Then, use \bm instead of \bf

${\bm \alpha}$

• ## Table-style without using tabular/tables (the result is a table without table numbering as in the picture

\begin{tabbing}
XXXXXXXXXXXXXXXXXXXXXXXX \= \kill% this line sets tab stop
${\bf U}({\bf x},t)$ \> Eulerian velocity\\
$U(x,t),V(y,t),W(z,t)$ \> $x,y,z$ components of velocity\\
$\overline{{\bf U}}({\bf x},t)$ \> filtered (resolved) velocity field\\
$\bar{U}$ \> bulk velocity in channel and pipe flow\\
$\langle \cdot \rangle$ \> mean of expectation of $\cdot$\\
$\nu$ \> kinematic viscosity \\
$s_{ij}$ \>  fluctuating rate-of-strain tensor ($\frac{1}{2}\left(\partial u_i/ \partial x_j + \partial u_j/ \partial x_i \right)$)\\
$k$ \> turbulent kinetic energy $(\frac{1}{2}\langle {\bf u}\cdot{\bf u}\rangle )$\\
$\varepsilon$ \> rate of dissipation of turbulent kinetic energy ($2\nu\langle s_{ij}s_{ij}\rangle$)\\
\end{tabbing}

• Add picture to the first page/cover of a latex document
• Download and install the style: titlepic.sty from CTAN here and install it in the usual way by adding the .sty into the proper directory of your latex search path.
• Once that is done and installed correctly, do the following (original blog Typethinker):

In LaTeX, there is by default no way to put a picture on the title page or cover page that is produced by \maketitle. Surprisingly, no package seemed to exist for this either. Until now, because I wrote it.
The package titlepic.sty, which can be downloaded from CTAN, is very simple and easy to use. Install it by putting it in your texmf tree and rehashing, or simply drop titlepic.sty in the same directory as your .tex source document. It works with the default document classes article, report and book.

Include it as normal, with \usepackage{titlepic}. Then, along with the usual \title, \author and \date, put a command like the following:
\titlepic{\includegraphics[width=\textwidth]{cover.jpg}}
The argument to \titlepic will usually be an \includegraphics command, but it can actually be pretty much anything. The output produced by this argument will be typeset centered on the title page when you invoke \maketitle. (When you use the article document class, be sure to pass it the titlepage option, because articles do not have a title page by default.)
There are three optional arguments that control the vertical layout of the title page:
ttPut both the title (and author, and date) and the picture at the top of the page, separated by a fixed amount of space.tcPut the title at the top of the page as with tt, but center the picture vertically on the page.ccSeparate the title and the picture by a fixed amount of space, and center both together vertically on the page.

• ERROR in LATEX COMPILATION FOR EXCEEDED STACK SIZE!!!
• "! TeX capacity exceeded, sorry [input stack size=5000]"
• One solution

• Diagrams environment in Latex:

• \usepackage{pb-diagram}
Manual here

• Inserting quatations in a latex document: see this page by Andy Roberts ! (his function is reported below):
% paras.tex - examples of paragraph formatting and special paragraph
%             environments

% Andrew Roberts - September 2003

\documentclass[english]{article}

\usepackage{babel}
\usepackage{times}
\usepackage{alltt}
\usepackage{moreverb}

\begin{document}

\title{Latex Tutorial 7 (Formatting) Examples}
\author{Andrew Roberts}
\maketitle

\section{Paragraph Formatting}

\begin{flushleft}
\texttt{Flushleft} is the default justification for a typical word
processor.  It looks considerably less tidy than Latex's default full
justified paragraphs
\end{flushleft}

\begin{flushright}
\texttt{Flushright} does not the most useful alignment for basic
paragraphs.  Has more use wi \end{flushright}

\begin{center}
The \texttt{center} has been seen many times in various examples from
previous examples, although usually to align tables and figures, rather
than text --- it works for all though!
\end{center}

\section{Special Paragraph Environments}
\subsection{Verbatim}

\begin{verbatim}
The verbatim environment
simply reproduces every
character you input,
including all  s p a c e s!
\end{verbatim}

\subsection{alltt}
\begin{alltt}
Verbatim extended with the ability
to use normal commands.  Therefore, it
is possible to \emph{emphasize} words in
this environment, for example.
\end{alltt}

\subsection{Listing}

\begin{listing}[2]{2}
The first line,
the second line,
the third line,
the forth line,
and so on...
\end{listing}

\subsection{Quote and Quotation}

Lots of text. Lots of text. Lots of text. Lots of text. Lots of text.
Lots of text. Lots of text. Lots of text. Lots of text. Lots of text.

\begin{quote}
I can resist everything except temptation. \emph{(Oscar Wilde)}
\end{quote}

Lots of text. Lots of text. Lots of text. Lots of text. Lots of text.
Lots of text. Lots of text. Lots of text. Lots of text. Lots of text.
\begin{quotation} Roast beef and Yorkshire,
or roast pork and apple sauce, followed up by suet pudding and driven
home, as it were, by a cup of mahogany-brown tea, have put you in just
the right mood\ldots In these blissful circumstances, what is it that

\end{quotation}

\subsection{Verse}

Lyrics of 'I Am The Walrus' by \emph{The Beatles}.

\begin{verse}
I am he as you are he as you are me and we are all together \\
See how they run like pigs from a gun see how they fly \\
I'm crying \\
Sitting on a cornflake \\
Waiting for the van to come \\
Corporation T-shirt, stupid bloody Tuesday \\
Man you've been a naughty boy you let your face grow long

I am the eggman \\
They are the eggmen \\
I am the walrus \\
Goo goo g' joob

\ldots
\end{verse}

\end{document}


• Use symbols for N, R, Z, Q number sets (for more on latex, see all the page of Anthony Liekens)
In the preamble use either one of the two AMS packages:
\usepackage{amsfonts}
\usepackage{amssymb}

and call the symbol as:
\mathbb{R}


• Install new packages in LaTex and have all the files put in the correct folders:
see this wikibook page where all the steps are explained.

• Fonts (see the **page** at Cornell for more):
\it - italics typeface
\sl - slanted typeface
\bf - boldface typeface
\sf - san serif typeface
\tt - typewriter typeface
\rm - normal (roman) typeface
\em - roman or italics typeface
\large - bigger type
\Large - even bigger type
\small - smaller type
\normalsize - normal size
Use them within brackets as follows:
I like {\it icecream}

• Colored text within a "verbatim-like" environment by using the package "alltt": (thanks to the Latex Forum )

Verbatim does not allow text coloring if the goal is to color only certain strings within a line; what can be done is coloring the entire line
at hand.
Here we show how to color only one specific word within a line in a verbatim like string by using "\usepackage{alltt}":
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{alltt}
\usepackage{xcolor}
\usepackage{lmodern}

\parindent0em

\begin{document}
\begin{alltt}
\textcolor{red}{string1} string2
\end{alltt}

\end{document}