Difference between revisions of "Latex"
From MohidWiki
Anatrancoso (talk | contribs) |
(→Graphics) |
||
Line 108: | Line 108: | ||
\begin{figure} | \begin{figure} | ||
\centering | \centering | ||
− | \includegraphics[0.5 \textwidth]{#1}\includegraphics[0.5 \textwidth]{#2}\\ | + | \includegraphics[width=0.5 \textwidth]{#1}\includegraphics[width=0.5 \textwidth]{#2}\\ |
− | \includegraphics[0.5 \textwidth]{#3}\includegraphics[0.5 \textwidth]{#4}\\ | + | \includegraphics[width=0.5 \textwidth]{#3}\includegraphics[width=0.5 \textwidth]{#4}\\ |
\caption{#5} | \caption{#5} | ||
\label{#6} | \label{#6} |
Revision as of 09:55, 14 January 2009
The (in)famous scientific text-processor. Good for producing high quality documents in scientific and literary areas. You can also use a subset of latex commands in this wiki editor for producing mathematical formulas.
Contents
Installing
Windows
- Download and install <goto>miktex</goto>, the latex processor for windows,
- Download and install <goto>ghostscript</goto>, the postscript processor,
- Download and install <goto>ghostview</goto>, the postscript viewer,
- Download and install <goto>acrobat reader</goto>, the pdf reader (only if it isn't already installed),
- Download and install <goto>winedt</goto>, the popular latex text-editor,
- Download <goto>winedt dictionaries</goto> for spelling auto-correction,
- Unzip the dictionaries somewhere in a folder,
- To configure winedt with the dictionaries do
winedt-->Options-->Dictionaries Add new dictionary (black upside down triangle icon), Give it a name, Open the .dic file (farther right open folder icon); should appear in the definition text-area, Then load the dictionary (farther left open folder icon), Tick load on start, save on exit, add new words, Tick enabled, Save configuration as a .dat file (farther left save disk icon) in some folder.
That's it!
Documentation
I heartily recommend:
- <goto>The Not So Short Introduction To Latex</goto>,
- <goto>Uma Não Tão Pequena Introdução Ao Latex</goto> (same, but in portuguese).
Commandline syntax
Compile and create dvi file
> latex main.tex
Compile and create pdf file
> pdflatex main.tex
Create postscript file
> dvi2ps main.dvi
Create pdf file
> dvipdf main.dvi
Create a bibliography
> bibtex main > latex main.tex > latex main.tex
NOTE: Do it twice.
Template
Here you'll find a full latex template.
Makefile
Here you'll find a useful makefile.
Links in Table Of Contents
\usepackage[pdftex]{hyperref}
Nomenclature Table
Use nomencl package from CTAN.
Add to preamble:
\usepackage[refpage]{nomencl} \makenomenclature
Add to main (after \tableof contents):
\printnomenclature
In the text:
bla bla bla numerical weather prediction (NWP) \nomenclature{NWP}{Numeric Weather Prediction} models are very good. bla bla bla
The make file must have 2 prior calls to pdflatex and then makeindex like below:
FILE = 00_main TEXFILE = "$(FILE).tex" all: pdflatex $(TEXFILE) bibtex $(FILE) pdflatex $(TEXFILE) pdflatex $(TEXFILE) makeindex $(FILE).nlo -s nomencl.ist -o $(FILE).nls pdflatex $(TEXFILE) clean: @rm -f *.aux *.lof *.log *.lot *.nlo *.nls *.out *.pdf *.toc *.bbl *.blg *.bak *.sav
Graphics
Side by side:
\newcommand{\myfigcol}[6]{ \begin{figure}[htb] % Duas figuras lado a lado \begin{minipage}[b]{0.48 \linewidth} \includegraphics[width=\linewidth]{#1}\\ \caption{#2} \label{#3} \end{minipage}\hfill \begin{minipage}[b]{0.48 \linewidth} \includegraphics[width=\linewidth]{#4}\\ \caption{#5} \label{#6} \end{minipage} \end{figure} }
4-Mosaic:
\newcommand{\quadmosaic}[6]{ \begin{figure} \centering \includegraphics[width=0.5 \textwidth]{#1}\includegraphics[width=0.5 \textwidth]{#2}\\ \includegraphics[width=0.5 \textwidth]{#3}\includegraphics[width=0.5 \textwidth]{#4}\\ \caption{#5} \label{#6} \end{figure} }
pspictures
Example with MOHID hierarchical structure (download eps_image/code). The image was made with latexdraw, which is a visual interface that produces the pspicture code. To compile: latex -> dvips.
Troubleshootings
P : When I convert my document to pdf I get deteriorated fonts and a poor readibility!
A: Check if you're using
\usepackage[T1]{fontenc}
If so, then that's your problem. Either erase it (not recommended) or simply add this extra package
\usepackage[T1]{fontenc} \usepackage{ae,aecompl}
Recompile your tex file and convert it to pdf, and that should do the trick.
External references
- Wikipedia
- <goto>Miktex</goto>
- <goto>Winedt</goto>
- <goto>The Not So Short Introduction To Latex</goto>
- <goto>CiteULike</goto>
- <goto>Comprehensive TeX Archive Network</goto>