14

I am wondering why so many duplicates of a symbol exist in latex. Let me provide some: For prime I know two types: 1. $f'$ 2. $f^\prime$ in Wiki Prime Symbol it is explained why \prime is introduced:

"LaTeX provides an oversized prime symbol, \prime for use in subscripts [for example $f_\prime$]"

Yet I wonder why an oversized symbol? Or the backslash: 1. \backslash 2. \setminus what is the difference? For a long list of slashes in latex visit unicode slashes. I can't understand why so many duplicates and if I don't know the difference, maybe I use it in wrong place. BTW I don't mean the characters that have minor differences (like \nu and \upsilon which look nearly the same).

How can I make sure I am using the correct symbol despite the similar look? What is the real difference between them?

6
  • 1
    @Yasser, according to the moderator here: tex.stackexchange.com/questions/8021/… >Please don't use quote (>) markup for emphasis. That's not what it's for. Jan 3, 2011 at 12:37
  • Many thanks. I didn't know that. Is it for highlighting the question? Is the new format OK? Jan 3, 2011 at 12:53
  • 1
    @Yasser, I think the quote markup is created to enclose text quoted from other sources. :-) Jan 3, 2011 at 12:59
  • Thanks for your advice :D. FYI, in the brotherhood of this forum (cstheory.stackexchange.com) we nearly always use such a mechanism to highlight the question :D. This is more like highlighting rather than quoting. Any way, I give up using it :-). Jan 3, 2011 at 13:02
  • 5
    Regarding \backslash/\setminus, from TeXbook: "It’s customary to say $G\backslash H$ to denote double cosets of G by H (G\H), and $p\backslash n$ to mean that p divides n (p\n); but $X\setminus Y$ denotes the elements of set X minus those of set Y (X \ Y). Both operations use the same symbol, but \backslash is type Ord, while \setminus is type Bin (so TEX puts more space around it)."
    – morbusg
    Jan 4, 2011 at 13:19

4 Answers 4

19

For many symbols it’s just that the purpose is different. Consider the set minus: what you want there isn’t a backslash. You really want a “set minus” – which just happens to be displayed (sometimes) identically to a backslash. But it’s still fundamentally different.

Now, which of the two LaTeX codes is more readable:

\mathcal{F} \backslash \{ 0 \}
% or
\mathcal{F} \setminus \{ 0 \}

If the two are really identical (which I don’t believe since as Carsten points out there’s always the issue of spacing in math mode) one can simply be defined in terms of the other – e.g.:

\newcommand*\setminus{\backslash}

No harm in that. This still makes the usage more readable (see above) and the macro can be exchanged very quickly if you decide that the symbol should be displayed differently. For example, consider that the set minus is actually often written like a normal minus instead of like a backslash. If you have used the \backslash command, you now need to change all occurrences of that in your document.

If you have used a dedicated command then you only need to redefine that:

\newcommand*\setminus{\ensuremath{{}-{}}}

In practice, I redefine aliases for almost all macros that I use to fit my current use-case.

14

The reason why \prime is "oversized" is so that, when it occurs in a superscript, it will appear to be the "right" size.

Most of the time, you would not really need to explicitly refer to the \prime macro; you would just use '. And indeed, in ten years of LaTeX coding, I used \prime for the first time only just recently — in a superscript, even — but in a way that I couldn't possibly achieve with ' alone: in the code f^{\prime\prime\cdots\prime}.

2
  • Wow, very nice! It's the first time I see real use for \prime!
    – mbork
    Mar 7, 2012 at 15:09
  • An even better usage (but one which I avoid for aesthetic reasons): a^{\prime\;-1}, for when you want to take the inverse of a primed variable. Apr 8, 2012 at 14:54
13

The prime ' and the control sequence \prime are in fact quite different beasts. The former is defined in terms of the latter: The \mathcode of ' is "8000, which makes it an active character in math mode. It is defined to be a macro that is clever enough so that ' expands to ^{\prime}, '' expands to ^{\prime\prime},''' expands to ^{\prime\prime\prime}, and so forth. This is necessary because multiple exponents aren't allowed.

9

Very often what seems as duplicates have some (more or less) subtle differences regarding size and spaces.

Concerning your examples, you will see the difference in spacing for \backslash and \setminus and in the size for \prime and '. Which one you would use in what case is probably an entirely different question.

\[ A\backslash B\quad A\setminus B \qquad  b_{'}\quad b_\prime\]

You must log in to answer this question.

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