# Shortcut commands for referencing floats

I always include the following commands in the preamble of my latex documents to make sure I refer to floats consistently in the text. I was wondering if the community had any thoughts about this, is it a good/bad idea or is there a package which duplicates this functionality?

\newcommand{\figref}[1]{Figure~\ref{fig:#1}}
\newcommand{\figsref}[2]{Figures~\ref{fig:#1}~and~\ref{fig:#2}}
\newcommand{\figtoref}[2]{Figures~\ref{fig:#1}~through~\ref{fig:#2}}

\newcommand{\tblref}[1]{Table~\ref{tbl:#1}}
\newcommand{\eref}[1]{Equation~\ref{eqn:#1}}
\newcommand{\esref}[2]{Equations~\ref{eqn:#1}~and~\ref{eqn:#2}}
\newcommand{\etoref}[2]{Equations~\ref{eqn:#1}~through~\ref{eqn:#2}}

\newcommand{\secref}[1]{Section~\ref{sec:#1}}
\newcommand{\charef}[1]{Chapter~\ref{cha:#1}}
\newcommand{\aref}[1]{Appendix~\ref{apndx:#1}}


Also, my supervisors insist all Latin expressions are italicised, so this saves me some typing.

\newcommand{\etal}{\mbox{\emph{et al.\ }}}
\newcommand{\ie}{\mbox{\emph{i. e.\ }}}
\newcommand{\etals}{\mbox{\emph{et al.\ }'s }}

-
You could be interested in the [cleveref](ctan.org(pkg/cleveref) package. –  Gonzalo Medina Sep 28 '12 at 19:13
Have a look at tex.stackexchange.com/questions/39349/… –  lockstep Sep 28 '12 at 19:14
In most cases the use of the word equation is not appropriate for mathematical expressions. Strictly speaking an equation is a mathematical expression involving equality. –  Guido Sep 28 '12 at 19:41
I'd never pluralize "et. al." which is already plural, since it means "et alii" (with possible declension), that is, "and others". –  egreg Sep 28 '12 at 19:45
@Guido I can't easily figure out a massive usage for the possessive; writing \etal's would be as easy, in any case, and probably more semantically sound. –  egreg Sep 28 '12 at 20:00

As already mentioned in the comments, the cleveref package provides you with extra commands:

• \cref{<key>} will expand to figure~\ref{<key>}, table~\ref{<key>}, equation~\eqref{<key>} depending on what you refer to.
• \Cref{<key>} capitalizes at the start of sentences. (There is a package option that capitalize every "Figure", "Table", etc., if you prefer that style. Use \Cref only at the start of sentences.)
• \cref{eq2,eq1,eq3,eq5,thm2,def1} produces: eqs.~(1) to~(3) and~(5), theorem~5, and definition~1. [Taken from the package manual]
• \crefrange{eq1}{eq5} gives eqs.~(1) to~(5). [Taken from the package manual]
• There is also \cpageref which will come in handy if you need to refer to multiple pages.
• \namecref
• It works very well with babel.
• It does work with varioref (it hacks into varioref's commands so you can use it like \vref, etc.) and hyperref if loaded in the order
1. varioref
2. hyperref
3. cleveref

Regarding the second part of your question, I recommend "\emph or \textit".

You may also look at xspace.

\documentclass{article}
\usepackage{xspace}
% Choose one of the two follwing:
\newcommand{\latinphrase}[1]{\textit{#1}}  % always italic
% \newcommand{\latinphrase}[1]{\emph{#1}}    % italic in roman text, upshaped in italicized text
\newcommand{\etal}{\latinphrase{et~al.}\xspace}
\newcommand{\ie}{\latinphrase{i.e.}\xspace}
\newcommand{\etals}{\latinphrase{et~al.}'s\xspace}

\begin{document}\noindent
\emph{This is \emph{very} important.} -- \emph{This is \textit{very} important}\\
\emph{You better read Knuth's books, \ie The \TeX book''.}\\

I'm not sure I follow you when you say "don't use \emph. That is used to emphasize, not to italicize". Well, emphasis in LaTeX is nearly universally achieved through italicizing, so there's no difference in the outcome (unless the user employs a highly unusual document class that defines \emph to do something else than italicization). To adhere to the LaTeX spirit of things, it's actually preferable to use a command name that indicates its purpose (emphasis) rather than the means by which the purpose is achieved (italicization). –  Mico Sep 28 '12 at 19:40
The question about \, or not has already been debated here; it seems to be common in German texts, much less in other typographic traditions. –  egreg Sep 28 '12 at 19:44
If \emph is inside a part in italics it will be typeset in roman. \textit{fisrt \emph{second}} then we get first second. –  Guido Sep 28 '12 at 19:46
@Guido - The ability to have nested \emph statements (and LaTeX's ability to switch between upright and italics depending on the level of nesting) would be another reason for preferring use of \emph to \textit, right? –  Mico Sep 28 '12 at 19:48
In addition to the other comments don't use \mbox in definitions such as \newcommand{\etal}{\mbox{\emph{et al.\ }}} using a box there freezes the word space at its natural size and so it will look out of place on a line in which other spaces have been stretched or shrunk. Also \emph normally looks ahead and adds italic correction \/ as needed to allow space for switching between italic and upright font shapes, but the box layer will defeat this lookahead. –  David Carlisle Sep 28 '12 at 20:24