# Some Latex tips

#### dwsmith

##### Well-known member
This works when making your own pdf files. On site, I don't know. If you can set it in the background of Math Jax, then it would be good here too.

Latex doesn't have a \arctanh. That probably means there is no sinh, cosh, etc versions as well.

I only know for a fact about arctanh because I use that one a lot.

Before you start you document, add

Code:
\DeclareMathOperator\arctanh{arctanh}
Now \arctanh works.

#### dwsmith

##### Well-known member
Latex tip #3 references itemize cases

Have you ever done

Code:
\begin{enumerate}[{Case} 1:]
\item
blah
\item
blah
...
and then wanted to reference to one of your itemized cases? Well I have and here is how you do this. Add the following in your preamble before you start your document.

Code:
%  phantom sections for itemize linking use hyperref and name
\AtBeginEnvironment{itemize}{\apptocmd{\item}{\phantomsection}{}{
\errmessage{couldn't patch item}}}
Now you can do this

Code:
\item
\label{case1}

some time later

See Case~\ref{case1}

#### dwsmith

##### Well-known member
Latex tip #4 referencing figure but the jump is never center on the figure

Have you ever referenced a figure, and when you click the hyper link, it jumps to the caption and not the figure?

Well if you haven't adjusted the caption package or added hypcap, this is what happens.

Your options to correct this are:

I recommend not using the caption package though see tip 5.
You can load the package caption. The default setting is hypcap=true.

If you don't load the package caption, you can load the package hypcap. Load this after hyperref
\usepackage[all]{hypcap}

#### dwsmith

##### Well-known member
Latex tip #5 don't use the caption package

Instead of the caption package use float and subfig.

For subfig, you want to set

\usepackage[caption = false]{subfig}

This will be valuable to you if you ever use the IEEEtran two column class.

#### Ackbach

##### Indicium Physicus
Staff member
Re: Latex tip #2

Or, if you prefer the function inverse notation, you could go

Code:
\DeclareMathOperator\arctanh{tanh^{-1}}

#### dwsmith

##### Well-known member
Re: Latex tip #2

Or, if you prefer the function inverse notation, you could go

Code:
\DeclareMathOperator\arctanh{tanh^{-1}}
You wouldn't need to define that one. Just do \tanh^{-1} and you have it.

#### dwsmith

##### Well-known member
Latex tip #6 the use of dollar signs

This is for preparing your own pdfs. In $\LaTeX3$, I believe the use of dollar signs will be removed since they are a $\TeX$ delimiter.
If you have ever had a compiling error and the information didn't help or make sense, it may be because you are using dollar delimiters over the $\LaTeX$ delimiters unless you already use the appropriate delimiters.

In $\LaTeX$, you should never the dollar sign or double dollar sign.

For inline math, you should use $${\verb|\($$|}\) as the delimiters, and for displaymath, you should use $${\verb||}$$ or
Code:
\begin{displaymath}\end{displaymath}
Note: this is in regards to document preparation not the forum.

Last edited by a moderator:

#### Ackbach

##### Indicium Physicus
Staff member
Re: Latex tip #2

You wouldn't need to define that one. Just do \tanh^{-1} and you have it.
Oh, yeah. Right. It might be a tad faster to type the definition, though. Or you could use something like \at as a shortcut.