Very strange discovery today for a newbie. If I want to type pounds, I could use \pounds
to get the British Pounds symbol, but apparently, LaTeX does not recognize \dollars
. (I have to type \$
).
Is there a reason behind that?
The reason is good old ASCII code that has a slot for $
, but no slot for £
.
Since $
has a special meaning for TeX, Knuth decided that in order to obtain the “$” glyph one just needed to escape $
, so to type \$
.
The pound symbol is available in fonts, but there used to be no straightforward way to input it (remember that when TeX was born there was no Unicode and code pages extending ASCII differed wildly among operating systems). Hence the solution was to define a control sequence for it.
There is no need for \dollars
: I don't think you believe that typing \dollars
is more practical than typing \$
.
Now that we have Unicode and UTF-8 it's much simpler to type £
instead of \pounds
.
\documentclass{article}
\begin{document}
\$100 is good, but £100 is better.
\end{document}
£
and see.
The LaTeX kernel has \textdollar
, as well as \textsterling
, \texteuro
, \textcent
, \textyen
and \textdollaroldstyle
for a dollar sign with two bars.
On older kernels, you might need to include the fontspec
or textcomp
packages to use some of these.
FWIW, dollars and pounds are on equal footing in ConTeXt:
\starttext
\textdollar 100 is good, but \textsterling 100 is better.
\stoptext
or an Wolfgang Schuster mentions in the comments, use \asciimode
and directly enter the symbols:
\asciimode
\starttext
$100 is good, but £100 is better.
\stoptext
\asciimode
you can write $100 is good, but £100 is better.
without the need for TeX commands.
Commented
Apr 27, 2020 at 21:38
Is that nobody use \EyesDollar
? XD
Seriously, there are a few other dollar commands beside \$
(or \textdollar
), but one must take into account if they work also in both math and text mode, if they need a package (that can be lost in a copy and paste, and then find out ...) o more "fun", it is custom macro based in a composed character, instead a simple glyph, that could be "decomposed", or even produce a fatal error, changing something else in the document or using another compiler.
\documentclass[a5paper]{article}
\usepackage{fontspec} % compile with xelatex !!
\setmainfont[Mapping=tex-text]{Symbola} % needed for some glyphs !!
\usepackage{geometry} \usepackage{graphicx,xcolor}
\usepackage{tabto}
\TabPositions{5cm,7.5cm,8.5cm,12cm}
\usepackage{circledsteps}
\usepackage{fontawesome}
\usepackage{marvosym}
\usepackage{dsfont}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\parindent0pt\parskip.8em\pagestyle{empty}
\begin{document}
\subsubsection*{Just for the sake of completeness}
Symbol \tab Math \tab Text\par
\medskip\par
\verb.\$(\textdollar)£(\pounds). \tab {\Large$\$(\textdollar)£(\pounds)$} \tab {\Large\$(\textdollar)£(\pounds)} \par
\verb.\mathdollar. \tab {\Large$\mathdollar$} \tab \vbox to 1.25em {\textcolor{red}{oops! ⛔}} \par
\verb.\textdollaroldstyle. \tab {\Large$\textdollaroldstyle$} \tab {\Large\textdollaroldstyle}\par
\verb.\faDollar. \tab {\Large$\faDollar$} \tab {\Large\faDollar}\par
\verb!S+...//! \tab
{\Large$S\kern-.52em\vbox to .8em{\hbox{/}}\kern-.15em\vbox to .8em{\hbox{/}}$} \tab
{\Large S\kern-.52em\vbox to .8em{\hbox{/}}\kern-.15em\vbox to .8em{\hbox{/}}}\par
\verb!S+ ...||! \tab
{\Large $S\kern-.42em\vbox to .8em{\hbox{|}}\kern-.1em\vbox to .8em{\hbox{|}}$}
\tab
{\Large S\kern-.42em\vbox to .8em{\hbox{|}}\kern-.1em\vbox to .8em{\hbox{|}}} \par
There are also \verb.\bbdollar. of the \href{https://www.ctan.org/pkg/mbboard}{\ttfamily mbboard} package (in CTAN but not available from \TeX Live nor Mik\TeX\ download managers).
\section*{Just joking: 🤣}
\TabPositions{1cm,4cm}
\tab {\Large\EyesDollar} \tab Tempting dollars (evil snake)\par
\tab {\Large\rotatebox[origin=c]{180}{\EyesDollar}} \tab Healing dollars (Aesculapius snake) \par\tab
{\Large\textcircled{\resizebox{!}{.55em}{\$}} \mbox{\vbox to .61em{\hbox to .5em{\$}}⃝} }
{\Large\Circled[outer color=gray,inner color=gray!10, fill color=gray!60]{\$}}
\tab Silver dollar coins \par % U+20DD
\tab{\Large\Circled[outer color=black,inner color=orange!30!yellow, fill color=orange!60!brown]{\$}}
\tab Fiat (fake) copper dollar\par
\tab {\Large 💵} \tab Fiat (fake) banknote dollar \par % U+1F4B5
\tab {\Large$\mathds{S}$} \tab Half dollar (50 ¢)\par
\tab {\Large\mbox{\vbox to .6em{\hbox to .5em{\scalebox{.97}{\$}}}⃠}} \tab I am broke (0 \$) % U+20E0
\end{document}
\newcommand\dollars{\$}
? Maybe the creator(s) of LaTeX didn't bother providing such a definition since writing\$
would seem quicker than writing\dollars
does?