Posts about latex (old posts, page 1)

2009-08-23 List Of Symbols

symbols

% Math-mode symbol & verbatim
\def\W#1#2{$#1{#2}$ &\tt\string#1\string{#2\string}}
\def\X#1{$#1$ &\tt\string#1}
\def\Y#1{$\big#1$ &\tt\string#1}
\def\Z#1{\tt\string#1}

% A non-floating table environment.
\makeatletter
\renewenvironment{table}%
   {\vskip\intextsep\parskip\z@
    \vbox\bgroup\centering\def\@captype{table}}%
   {\egroup\vskip\intextsep}
\makeatother

% All the tables are \label'ed in case this document ever gets some
% explanatory text written, however there are no \refs as yet. To save
% LaTeX-ing the file twice we go:
\renewcommand{\label}[1]{}

%%end-prologue%%
\begin{table}
\begin{tabular}{*8l}
\X\alpha        &\X\theta       &\X o           &\X\tau         \\
\X\beta         &\X\vartheta    &\X\pi          &\X\upsilon     \\
\X\gamma        &\X\gamma       &\X\varpi       &\X\phi         \\
\X\delta        &\X\kappa       &\X\rho         &\X\varphi      \\
\X\epsilon      &\X\lambda      &\X\varrho      &\X\chi         \\
\X\varepsilon   &\X\mu          &\X\sigma       &\X\psi         \\
\X\zeta         &\X\nu          &\X\varsigma    &\X\omega       \\
\X\eta          &\X\xi                                          \\
                                                                \\
\X\Gamma        &\X\Lambda      &\X\Sigma       &\X\Psi         \\
\X\Delta        &\X\Xi          &\X\Upsilon     &\X\Omega       \\
\X\Theta        &\X\Pi          &\X\Phi

\end{tabular}
\caption{Greek Letters}\label{greek}
\end{table}



\begin{table}
\begin{tabular}{*8l}
\X\pm           &\X\cap         &\X\diamond             &\X\oplus     \\
\X\mp           &\X\cup         &\X\bigtriangleup       &\X\ominus    \\
\X\times        &\X\uplus       &\X\bigtriangledown     &\X\otimes    \\
\X\div          &\X\sqcap       &\X\triangleleft        &\X\oslash    \\
\X\ast          &\X\sqcup       &\X\triangleright       &\X\odot      \\
\X\star         &\X\vee         &             &\X\bigcirc   \\
\X\circ         &\X\wedge       &              &\X\dagger    \\
\X\bullet       &\X\setminus    &            &\X\ddagger   \\
\X\cdot         &\X\wr          &          &\X\amalg     \\
\X+             &\X-
\end{tabular}

\caption{Binary Operation Symbols}\label{bin}
\end{table}



\begin{table}
\begin{tabular}{*8l}
\X\leq          &\X\geq         &\X\equiv       &\X\models      \\
\X\prec         &\X\succ        &\X\sim         &\X\perp        \\
\X\preceq       &\X\succeq      &\X\simeq       &\X\mid         \\
\X\ll           &\X\gg          &\X\asymp       &\X\parallel    \\
\X\subset       &\X\supset      &\X\approx      &\X\bowtie      \\
\X\subseteq     &\X\supseteq    &\X\cong        &    \\
  & &\X\neq         &\X\smile       \\
\X\sqsubseteq   &\X\sqsupseteq  &\X\doteq       &\X\frown       \\
\X\in           &\X\ni          &\X\propto      &\X=            \\
\X\vdash        &\X\dashv       &\X<            &\X>            \\
\X:
\end{tabular}

\caption{Relation Symbols}\label{rel}
\end{table}

2009-08-21 setting graphics' path

  • instead of using
    \includegraphics[width=\textwidth]{folder2_relative/picture.png}%
  • by including in the front matter (i.e. before \begin{document}):
    \DeclareGraphicsExtensions{.png,.pdf}%
    \graphicspath{{../folder1_relative/},{folder2_relative/},{/home/myname/folder_absolute/figures/}}%
  • you may simply use
    \includegraphics[width=.49\textwidth]{picture}%
  • one advantage is that you could use context dependent rules, for instance:
    \newif\ifpdf
       \ifx\pdfoutput\undefined \pdffalse
    \else \pdfoutput=1 \pdftrue \fi
    % portability between LaTeX and pdfLaTeX
    \ifpdf
    \usepackage[pdftex]{graphicx}
    \usepackage[pdftex, pdfusetitle ,colorlinks=false, pdfborder={0 0 0}]{hyperref}%
    \DeclareGraphicsExtensions{.png,.pdf}%
    \graphicspath{{figures_pdf/}}%
    \pdfoutput=1 % we are running pdflatex
    \pdfcompresslevel=9     % compression level for text and image;
    \pdftrue
    % we are using the traditional latex
    \else
    \usepackage{graphicx}%
    \usepackage[colorlinks=false]{hyperref}%
    \DeclareGraphicsExtensions{.eps}%
    \graphicspath{{figures_eps/}}%
    \fi

2009-08-20 some LaTeX tips: drafts, links, margins, pdflatex

checking typographic style

managing margins

  • to adjust margins, use
    \usepackage[margin=2.5cm]{geometry}

    then play around with the 2.5cm value until it fits.

  • tips for fitting your text in the required size : LaTeX Tips n Tricks for Conference Paper

citations

  • If you give LaTeX \cite{fred,joe,harry,min}, its default commands could give something like "[2,6,4,3]"; this looks awful. One can of course get the things in order by rearranging the keys in the \cite command, but who wants to do that sort of thing for no more improvement than "[2,3,4,6]"
    • The cite package sorts the numbers and detects consecutive sequences, so creating "[2-4,6]". The natbib package, with the numbers and sort&compress options, will do the same when working with its own numeric bibliography styles (plainnat.bst and unsrtnat.bst).
    • If you might need to make hyperreferences to your citations, cite isn't adequate. If you add the hypernat package:
      \usepackage[...]{hyperref}
      \usepackage[numbers,sort&compress]{natbib}
      \usepackage{hypernat}
      ...
      \bibliographystyle{plainnat}

      See for example http://www.tex.ac.uk/cgi-bin/texfaq2html?label=citesort

Useful draft tips

using pdfLaTeX

  • X-( sites like arXiV use only plain LaTeX so that you should keep the 2 versions of your directives for better portability (see \ifpdf ...)
    • in particular arXiV rejects the microtype package
  • le package hyperref permet même de faire des références vers les différents chapitres.
  • PDfLaTeX ne permet pas d'inclure des eps pour cela il faut les convertir en pdf avec epstopdf ou le script suivant qui permet de convertir tous les .eps d'un dossier (à sauver et rendre executable):
    for f in $* ;do
        if echo "$f" | grep -i eps*   ; then
             epstopdf --nocompress $f
             echo "converting  $f to pdf ..."
        else
        echo "$f is not a eps file, ignored"
        fi
    done

    il suffit alors d'executer en console  ./mon_script la-ou-ya-tout-mes-eps/*.eps 

2009-08-19 Installation TeX

count number of words / compter le nombre de mots

  • Pour compter le nombre de mots et de caractères d'un document latex, il suffit d'installer deTeX et de lancer la simple ligne de commande
    detex MonFichier.tex | wc -w
  • alternatively, you may use
    pdftotext MonFichier.pdf - | wc -w
  • in TexShop there's a "Statistics..." interface to the same technique.
  • on MacOsX, to install appropriate tools, use MacPorts and
    sudo port install detex
    sudo port install xpdf +a4 +with_poppler

including source code in a document with pretty printing

  • use
    \usepackage{attachfile}

    or

    \usepackage{filecontents}
  • see documentation:
    texdoc attachfile

referring to table or image

  • referring to table or image (and not to the bottom of it)
    \usepackage{hypcap}

framed box

  • make a framed box around text (and configure space) :
    \setlength\fboxsep{1pt}
    \setlength\fboxrule{0.5pt}
    \fbox{text}

convert a collection of JPGs to a pdf

\listfiles
\documentclass{minimal}
\usepackage{graphicx}
\usepackage[active,graphics,tightpage]{preview}
\begin{document}
\includegraphics{pic1}
\includegraphics{pic2}
\includegraphics{pic3}
\end{document}
  • or
for f in *.jpg ; do convert $f `basename $f .jpg`.pdf ; done
  • or  slideshow.tex TeX file
___________________________________________________________
\pdfcatalog{/PageMode/FullScreen}\pdfcompresslevel=0
\pdfhorigin0pt\pdfvorigin0pt
\def\process#1 {\setbox0\hbox{\pdfximage width 20cm {#1}%
  \pdfrefximage\pdflastximage}%
  \pdfpagewidth=\wd0 \pdfpageheight=\ht0 \shipout\box0\par}
\everypar{\setbox0\lastbox\process} \input dir \end
___________________________________________________________
Usage:
ls *.jpg > dir
pdftex slideshow

more fonts

  • on the mac, out of the box with i-installer
    The gwTeX part of this distribution contains all the setup files you need to use a couple of fonts from your Mac. The setup has been created by Thomas A. Schmitz (he did the main work) and Adam Lindsay, hence the naming: gtamacfonts.
    To use these fonts with LaTeX, put e.g. the following in your file:
            \usepackage[T1]{fontenc}
            \usepackage{gtamachoefler}
    Such a style file will make Hoefler Text the serif (roman) text font and Gill Sans the sans serif font. The following basic styles are available:
            gtamacbaskerville.sty
            gtamacdidot.sty
            gtamacgeorgia.sty
            gtamachoefler.sty
    There are  more. See the manual for details. For the same effect using ConTeXt, enter e.g.:
            \usetypescriptfile[type-gtamacfonts]
            \usetypescript[Hoefler][ec]
            \setupbodyfont[Hoefler,12pt]
    Example documents and a manual can be found in the texmf.gwtex/doc/fonts/gtamacfonts subdirectory. To get the manual you can type "texdoc gtamacfonts" in a Terminal window.
  • Latin Modern
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}

Installation TeX

Tex on MacOsX

  • !TexLive is the most recent /easy distribution. You may add new packages easilly in $HOME/Library/texmf (see a reference) or using the TexLive tool: tlmgr
  • to install :
    wget http://ftp.klid.dk/ftp/texlive/tlnet/mactex-2009-sept-20.mpkg.zip
    unzip mactex-2009-sept-20.mpkg.zip
    sudo installer -pkg MacTeX-2009.mpkg -target /

    (check before on http://ftp.klid.dk/ftp/texlive/tlnet/ the correct name)

  • I had to set up a new source repository :
    sudo tlmgr option location http://ftp.klid.dk/ftp/texlive/tlnet
  • to upgrade
    sudo tlmgr update --self
    sudo tlmgr update --all