Difference between revisions of "Latex"
From MohidWiki
Anatrancoso (talk | contribs) (→Documentation) |
|||
Line 21: | Line 21: | ||
That's it! | That's it! | ||
− | == | + | ===Available documentation=== |
I heartily recommend: | I heartily recommend: | ||
* <goto>The Not So Short Introduction To Latex</goto>, | * <goto>The Not So Short Introduction To Latex</goto>, | ||
Line 27: | Line 27: | ||
* [http://en.wikibooks.org/wiki/LaTeX/Introduction wikibook on Latex]. | * [http://en.wikibooks.org/wiki/LaTeX/Introduction wikibook on Latex]. | ||
− | == Difference between latex and pdflatex == | + | === Difference between latex and pdflatex === |
Advantages of pdflatex over simple latex: | Advantages of pdflatex over simple latex: | ||
Line 37: | Line 37: | ||
:*From a original ps files, final pdf size of document is higher (This was tested with a 730.3 kB ps figure, which gave a 151 kB pdf document with latex/dvi2pdf and 153.5 kB with pdflatex) | :*From a original ps files, final pdf size of document is higher (This was tested with a 730.3 kB ps figure, which gave a 151 kB pdf document with latex/dvi2pdf and 153.5 kB with pdflatex) | ||
+ | ==Useful tips== | ||
==Commandline syntax== | ==Commandline syntax== | ||
Compile and create dvi file | Compile and create dvi file | ||
Line 52: | Line 53: | ||
''NOTE: Do it twice.'' | ''NOTE: Do it twice.'' | ||
− | ==[[Latex template|Template]]== | + | ===[[Latex template|Template]]=== |
[[Latex template|Here]] you'll find a full latex template. | [[Latex template|Here]] you'll find a full latex template. | ||
− | ==[[Latex makefile|Makefile]]== | + | ===[[Latex makefile|Makefile]]=== |
[[Latex makefile|Here]] you'll find a useful [[Latex makefile|makefile]]. | [[Latex makefile|Here]] you'll find a useful [[Latex makefile|makefile]]. | ||
− | == Links in Table Of Contents == | + | === Links in Table Of Contents === |
\usepackage[pdftex]{hyperref} | \usepackage[pdftex]{hyperref} | ||
− | == Nomenclature Table == | + | === Nomenclature Table === |
Use [http://www.ctan.org/tex-archive/macros/latex/contrib/nomencl/ nomencl] package from [http://www.ctan.org/ CTAN]. | Use [http://www.ctan.org/tex-archive/macros/latex/contrib/nomencl/ nomencl] package from [http://www.ctan.org/ CTAN]. | ||
Line 95: | Line 96: | ||
− | ==Graphics== | + | ===Graphics=== |
Side by side: | Side by side: | ||
Line 126: | Line 127: | ||
} | } | ||
− | == pspictures == | + | === pspictures === |
Example with MOHID hierarchical structure (download [http://rosatrancoso.googlepages.com/MohidStructure_beamer2.eps eps_image]/[http://rosatrancoso.googlepages.com/MohidStructure_beamer2.tex code]). The image was made with [http://latexdraw.sourceforge.net/ latexdraw], which is a visual interface that produces the pspicture code. To compile: latex -> dvips. | Example with MOHID hierarchical structure (download [http://rosatrancoso.googlepages.com/MohidStructure_beamer2.eps eps_image]/[http://rosatrancoso.googlepages.com/MohidStructure_beamer2.tex code]). The image was made with [http://latexdraw.sourceforge.net/ latexdraw], which is a visual interface that produces the pspicture code. To compile: latex -> dvips. |
Revision as of 13:17, 1 July 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!
Available 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),
- wikibook on Latex.
Difference between latex and pdflatex
Advantages of pdflatex over simple latex:
- allows for hyperlinked hyperlinked table of contents,
- includes png graphics
Disadvantages:
- doesn't include ps files. Have to be converted to pdf
- From a original ps files, final pdf size of document is higher (This was tested with a 730.3 kB ps figure, which gave a 151 kB pdf document with latex/dvi2pdf and 153.5 kB with pdflatex)
Useful tips
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>
- wikibook on latex