41

What is the best/the usual way to typeset a placeholder for a variable in an equation?

Specifically, I want to do something like g = f(x, .) (which of course means that g is defined by g(y) = f(x,y)). I tried \cdot, but it somehow does not look right (and the spacing needs to be adjusted either). On the other hand, a \bullet seems to be too fat.

Any other suggestions?

3
  • Sometimes a stroke is used: \[ g(-) = f(x,-) \]. Mar 6, 2012 at 22:55
  • Why not a normal stop $g(y) = f(x,.)$? Mar 6, 2012 at 23:01
  • OK, the <code>g=f(x,\cdot)</code> does not look too bad, I mixed something up in my memory. What did not look good was something like <code>M \otimes \cdot</code> denoting the functor given by tensoring. But in my particular case, the <code>\cdot</code> is already taken for a left action on modules... I will consider the "normal" stop-dot and the asterisk
    – michael88
    Mar 6, 2012 at 23:09

5 Answers 5

39

Here are some considerations, since this question is open-ended:

enter image description here

\documentclass{article}
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\newcommand{\parm}{\mathord{\color{black!33}\bullet}}%
\begin{document}
\[
  f(x,.) \quad f(x,\cdot) \quad f(x,\ast) \quad f(x,\star) \quad 
  f(x,\bullet) \quad f(x,\parm)
\]
\end{document}​

I've included \parm which is a 33% black \bullet, perhaps a little more subtle than the full-fledged solid \bullet. Whatever you choose, best to define a command that sets such a "placeholder". If you're after something "fancy", I would suggest you peruse the tables of symbols contained in Scott Pakin's Comprehensive LaTeX Symbol List.

2
  • 4
    In any case I suggest to enclose the symbol in braces (equivalent to use \mathord) so it's surely treated as an ordinary math atom. For \cdot one could consider {\cdot\,} to give it more room; the same for the period.
    – egreg
    Mar 7, 2012 at 0:16
  • I think a resized textbullet is best. That is, a textbullet reduced in size to maybe 80% looks best.
    – Seamus
    Mar 7, 2012 at 17:36
15

How about using a ?, or putting it in a \fbox.. If you still want to use the \cdot, you could use \makebox to reserve enough space.

enter image description here

\documentclass{article}
\newcommand*{\X}{\textbf{?}}%
\newcommand*{\Y}{\textbf{\fbox{?}}}%
\newcommand*{\Z}{\makebox[1ex]{\textbf{$\cdot$}}}%
\begin{document}
    $g(y) = f(x,\X) = f(x,\Y)= f(x,\Z)$
\end{document}
1
11

Based on your last comment, I suggest to use a minus sign, that's widely used in category theory:

\newcommand{\blank}{{-}}

The additional braces mask its nature of binary operator, so it's treated as an ordinary symbol. Using a personal command allows you to change the symbol by only modifying its definition.

\documentclass{article}
\newcommand{\blank}{{-}}
\begin{document}
$f(x,\blank)$

$M\otimes_{R}\blank$
\end{document}

enter image description here

7

A placeholder is something used to denote or reserve a place for something to come later.

We can take an inspiration from cursors in text editors. They have usually the INSERT mode and the REPLACE mode. The cursor in the REPLACE mode is the character that is telling us: "I will be replaced with a provided character". And that's exactly what the placeholder in the equation is doing!

In the REPLACE mode text editors they use either:

Of these two I recommend the underscore character as it is already well established in programming languages: Python, Prolog, Scala, Haskell, Lua and many more, as a function argument that we don't care about.

That's why I recommend an underscore:

enter image description here

\documentclass{article}
\begin{document}
$f(x,\_)$
\end{document}
1
  • 3
    The actual representation of the placeholder is a question of taste and personal preference. It's more important that one uses a macro for it, so changing the representation doesn't require chasing in the document. So, even if it's just \newcommand{\blank}{\_}, such an indirect method is preferable to using \_ in the document.
    – egreg
    Mar 1, 2015 at 23:24
2

I use own macro:

\documentclass{article}
\def\argdot{{\hspace{0.18em}\cdot\hspace{0.18em}}}
\begin{document}
$f(x,\argdot)$
\end{document}

You must log in to answer this question.

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