# LaTeX Hints and Notes

This is not intended as a general LaTeX page, but more like a tips and tricks corner where I share some of my favorite LaTeX packages. (If you use LaTeX, you will probably have come to the same conclusion as me, that the best source for LaTeX tips, tricks, and problem solutions is to ask other LaTeX users around you.)

There are also several interesting subpages concerning TikZ, a graphics/drawing package which I discovered in 2007 and which is certainly one of the best LaTeX packages I know (not surprisingly, it is by the same author as Beamer, which is the best solution I know for creating presentations using LaTeX).

## Cross-References

For cross-references, I have been using prettyref a lot. For example, I have this in my preamble:

\usepackage{prettyref}
\newrefformat{fig}{Fig.~\ref{#1}}
\newrefformat{par}{section~\ref{#1}}
\newrefformat{sec}{section~\ref{#1}}
\newrefformat{sub}{section~\ref{#1}}
\newrefformat{table}{table~\ref{#1}}
\newrefformat{alg}{algorithm~\ref{#1}}
\newrefformat{Def}{definition~\ref{#1}}
\newrefformat{Thm}{theorem~\ref{#1}}
\newrefformat{step}{step~\ref{#1}}
\newrefformat{eq}{equation~\eqref{#1}}
\def\Eqref Eq:#1:{\eqref{eq:#1}}
\newrefformat{Eq}{Equation~\Eqref#1:}

Then, I use labels like \label{fig:house-example} for my figures, \label{sub:preliminaries} for sub(sub)sections and so on. A special trick has been used for equations: When I want to start a sentence with "Equation (4) defines ..." I have the problem that prettyref would normally not capitalize the word "equation" automatically. I solved this by introducing a reference format "Eq:" which I can use for referencing an equation at the beginning of a sentence. This which nevertheless references the corresponding equation whose label starts with "eq:" (the de-capitalization is done through the helper definition "Eqref").

I have been told that cleveref does this automatically, with a syntax similar to prettyref, and I have been pointed to the newer refstyle package. (As a side note, there's also fancyref, but that's considered outdated.)

I have been using prettyref successfully with LyX for a very long time, so I did not yet try out these alternatives (which seem to be supported by latest LyX versions, too).