[Tex/LaTex] What’s the difference between \|, \textdoublevertline, \textdoublepipe and \parallel

renderingsemanticssymbols

I'm currently writing my bachelors thesis about on-line handwriting recognition of mathematical formulae (see http://write-math.com). I'm currently only recognizing symbols with the same technique as detexify uses (I know that it's the same technique, because I read the diploma thesis of detexify).

One thing that I always thought could be better in detexify is "similarity groups". So some symbols seem to be rendered the same and only have semantic difference or a difference when you have context (that means other symbols). One example is \Sigma and \sum. I think those symbols should be treated the same when it comes to pure symbol recognition. Only when you have context, you can distinguish them.

After drawing tons of symbols and looking at their classification, I've just found those four

  • \| (math mode)
  • \textdoublepipe (text mode)
  • \textdoublevertline (text mode)
  • \parallel (and, obviously different but not that much: \shortparallel)

Is there any difference between \| and \parallel in terms of context-dependant rendering?

Is there any difference between \textdoublepipe and \textdoublevertline in terms of context dependant rendering or semantics?

Best Answer

The commands \| and \parallel print the same symbol; here are their definitions in fontmath.ltx:

\DeclareMathDelimiter{\Vert}
   {\mathord}{symbols}{"6B}{largesymbols}{"0D}
\let\|=\Vert

\DeclareMathSymbol{\parallel}{\mathrel}{symbols}{"6B}

The meaning of the first definition is that \Vert (of which \| is an alias) prints the glyph in slot "6B of the font in mathgroup symbols when requested at normal size and, when not used in the context of delimiters (after \left, \right, \bigl, \bigr and friends) it behaves as an ordinary symbol.

The definition of \parallel tells TeX to use the very same glyph, but treating it as a relation symbol. So

$\|\alpha v\|=\alpha\|v\|$

will result in

‖𝛞v‖ = 𝛞‖v‖

whereas

$\alpha\parallel\beta$

will produce

𝛞 ‖ ð›―

where $\alpha\|\beta$ would produce

ð›žâ€–ð›―

with no spaces around the double bar. In Unicode, \Vert is U+2016 DOUBLE VERTICAL LINE, while \parallel is U+2225 PARALLEL TO.

The command \textdoublepipe is found in tipa and produces the symbol Į (Unicode U+01C1 LATIN LETTER LATERAL CLICK) which is glyph 123 in a T3 encoded font. Also \textdoublevertline is defined by tipa and refers to glyph 147 in a T3 encoded font

The manual of tipa refers to the former as alveolar lateral click and to the latter as major (intonation) group; according to http://en.wikipedia.org/wiki/Prosodic_unit, this is the same U+2016 as before.

So, even if the four glyphs are similar, their meaning is different and should be used in the proper context.