I'm sure this question is a duplicate, but I can't find the main question.
If I write $|.|$ it doesn't appear with in my textbook, I wonder what is the correct way to do it. I'm using it to try to write a function $|.|: A \to B$
Do define a command for this. I chose \blank as the name, you might prefer a different one.
Why? Because you want that \blank is
Why condition 2? Because your new coauthor might prefer a dash rather than a dot, for instance, or you need to to comply with the house style of some big publisher.
\documentclass{article} \usepackage{mathtools} \newcommand{\blank}{\mathord{{}\cdot{}}} \DeclarePairedDelimiter{\abs}{|}{|} \begin{document} \subsection*{How not using a command might get things wrong} \begin{enumerate} \item \makebox[\width][s]{$|{}\cdot{}|\colon A\to B$} \item \makebox[\width][s]{$|\blank|\colon A\to B$} \item \makebox[0.8\width][s]{$|{}\cdot{}|\colon A\to B$} \item \makebox[0.8\width][s]{$|\blank|\colon A\to B$} \item \makebox[1.2\width][s]{$|{}\cdot{}|\colon A\to B$} \item \makebox[1.2\width][s]{$|\blank|\colon A\to B$} \end{enumerate} \subsection*{Easy to redefine} \begin{enumerate} \item $|\blank|\colon A \to B$ \item $\abs{\blank}\colon A\to B$ \renewcommand{\blank}{\mathord{-}} \item $|\blank|\colon A \to B$ \item $\abs{\blank}\colon A\to B$ \renewcommand{\blank}{\mathord{{}\operatorname{--}{}}} \item $|\blank|\colon A \to B$ \item $\abs{\blank}\colon A\to B$ \end{enumerate} \end{document} Do you see why I don't recommend something like {}\cdot{}? The simulation of stretching for justification in the first part should clarify it: you don't want that the spaces around the lonely \cdot participate in stretching or shrinking for justification. The \mathord around the construction makes a subformula with frozen spacing and makes it impossible to use \blank outside of math mode. You can see that using \blank always produces the same symbol (consisting of the dot and of the space around it).
In the second part I show a couple of possible redefinitions of \blank.
{\cdot} will do the job as well. Is there any reason to use \mathord{\cdot} in favor of {\cdot}? {}\cdot{}, which might be a valid style decision; I'd prefer an explicit marker, but that's a personal choice. Something like this?
Note that I've replaced . with \cdot and that I use \colon rather than :, since the latter is treated by TeX and LaTeX as a relational operator.
\documentclass{article} \usepackage{mathtools} % for \DeclarePairedDelimiter macro \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} \begin{document} $\abs{ {}\cdot{} }\colon A\to B$ \end{document} lvert and rvert which I believe are better that | for typsetting abs. tex.stackexchange.com/questions/498/…
·appears to be used as a placeholder/wildcard here → Spacing around \cdot when used as a wildcard - TeX - LaTeX Stack Exchange ■ symbols - Placeholder for variable as in f(x, .) - TeX - LaTeX Stack Exchange ■ math mode - Spacing around \cdot - TeX - LaTeX Stack Exchange