10

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$

3

2 Answers 2

14

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

  1. an ordinary math atom
  2. dependable on the required style

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.

enter image description here

4
  • 1
    As far as I can tell, {\cdot} will do the job as well. Is there any reason to use \mathord{\cdot} in favor of {\cdot}?
    – antshar
    Jul 6, 2022 at 9:30
  • 1
    @antshar This would have smaller spaces around the dot than with {}\cdot{}, which might be a valid style decision; I'd prefer an explicit marker, but that's a personal choice.
    – egreg
    Jul 6, 2022 at 9:32
  • I've never seen dash used as a placeholder in math for absolute value / norm so cdot is fine I think
    – qwr
    Jul 6, 2022 at 18:42
  • @qwr I've seen used it as a placeholder in category theory books.
    – egreg
    Jul 6, 2022 at 19:46
7

Something like this?

enter image description here

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}
2
  • 2
    See my answer for possible shortcomings of this approach.
    – egreg
    Jul 6, 2022 at 9:02
  • 1
    Aside from the shortcomings, this answer uses lvert and rvert which I believe are better that | for typsetting abs. tex.stackexchange.com/questions/498/…
    – pheon
    Jul 12, 2022 at 21:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .