Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Thursday, January 14, 2010

More latex tweaks

1) if you ever are in the situation that you want to use a *.bst file and don't know where to put it, the answer is simple. *.bst-files (used for defining personal bibliography styles) go into the same directory where your sourcefile is located.

2) *.cls-files (customised class files; often used by journals) go into /usr/share/texmf-texlive/tex/latex/whateveryouwannacallit and afterwards you run sudo mktexlsr

Afterwards, your document should compile. 

Friday, November 20, 2009

latex insertgraphics

Apparently there is a kind of bug:

\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{./images/figure.jpg}
\caption{AFM schematics \cite{Aierken}}
\label{fig:AFM}
\end{figure}

gives a reference to Figure 6 (which is the number under the figure)
whereas this:
\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{./images/figure.jpg}
\label{fig:lala}
\caption{kdlseiosj}
\end{figure}

gives 3.1.2 as a reference while the number under the picture is 7.

Friday, October 30, 2009

installing latex packages in ubuntu

I installed the new Ubuntu yesterday and as I expected my latex file didn't compile anymore. I'm using so exotic packages as siunitx and bpchem which do not come with ubuntu (I got everything installed together with kile).

To get it working, I needed to do the following:
1) download the *.zip packages from ctan.
2) extract to a random directory, you'll see that they contain a package.ins and a package.dtx file
3) go to the random directory and do pdflatex package.ins (you could also do pdflatex package.dtx but it was complaining about a missing template.sty)
4) copy the whole folder to /usr/share/texmf-texlive/tex/latex (sudo cp -r source dest)
5) sudo mktexlsr

and voila, it works.

Thursday, July 30, 2009

Numbering of Appendices in Latex

Just fixed the appendices for my thesis so that they work properly for me.

Wanted behaviour:
  • give me a separate heading 'appendices' in the toc
  • after 'appendices' come the appendices with A app 1, B app2, ...
  • tables, equations, figures are named correnspondingly (A.1, ... )
  • avoid warnings from the hyperref package about doubly defined pages/tables/...
This can be achieved like this:
\appendix is the usual command to start appendices, leading to A name_of_chapter/section in the table of contents and as heading. The equations/figures/tables would though keep their numbering - with
\numberwithin{equation}{section}
\numberwithin{table}{section}
\numberwithin{figure}{section} it can be adapted to A.1 and so on.
In my case I have a big document, so I include the appendices from a separate file. Now is the time to do so
\include{appendices}
because the following commands
\appendixpage
\addappheadtotoc
exhibit unwanted behavior when invoked out of the included file. The first command adds a heading 'Appendices' before the appendices in the text and the second one adds a similar line to the table of contents (thanks to here for this tip).
An appendix is then created with the following command:
\section{Name of Appendix}
\label{sec:appendixA}

For the numbering the package amsmath has to be included, for the additional appendix commands the appendix-package is needed:
\usepackage{appendix}
\usepackage{amsmath}

Monday, June 9, 2008

Latex: Putting footnotes in tables

If you just use a \footnote command within a table gives the footnote superscript, but the text just doesn't appear. To overcome this, put the tabular bit of the table inside a minipage environment, as
\begin{table}[htp]
\centering
\begin{minipage}{\textwidth}
\centering
\begin{tabular}{|l|l|l|}
....
\end{tabular}
\end{minipage}
\caption{...}
\end{table}
The footnote text will then appear under a short line just above the caption.

If the table is in a 2-column-per-page document, use {0.5\textwidth}. (from here)

For multiple references to one footnote, \textsuperscript{\ref{footnote}}

Friday, September 28, 2007

bibtex/latex 'tricks'

position im latex file:
\addcontentsline{toc}{chapter|section}{Bibliography}
\bibliography{report}
\bibliographystyle{plain|unsrt|alpha|anythingelse_in_folder}
\end{document}

zitieren:
according to \cite{compMed} blablabla
angeben aber nicht verwendet:
\nocite{ref1}