Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is an MWE:



$$\blocks{\cosh u}{\sinh u}{\sinh u}{\cosh u}{0}{0}{1}.$$

Typesetting it generates what I expect, except that the | appear as horizontal bars. Why? And why does changing them to $|$ turn them vertical?

share|improve this question
First of all make a compilable example, I get several errors. –  egreg Jul 25 '14 at 15:09
Do you know Why is [ … ] preferable to $$ … $$? –  clemens Jul 25 '14 at 15:14

4 Answers 4

up vote 3 down vote accepted

the ascii | has the internal code "7C.

in computer modern text fonts, position "7C is occupied by the em-dash.

when you pack something into a box (\raisebox here), it reverts to horizontal mode, hence | accesses the em-dash.

as you have discovered, $|$ accesses the vertical bar, because in the math font, the ascii position is used for this symbol.

by pure blind luck, you have hit on a combination that looks like all that it changes is the orientation of the shape. if you want the bar to be vertical, remember that it has to be in math mode if it's in a box.

share|improve this answer

The example shows many issues, some of them:



        % @{} removes space at the left and right, because
        % the surrounding tabular adds already space.
      & \mbox{\Huge$#5$}\\
      % the following trick adds vertical space above
      % the contents of the row with the amount of the depth
      % of a table line. Then the `\hline` is in the middle.
      % \@finalstrut\@arstrutbox is the depth of a tabular
      % line (e.g. this is added at the end of a line in
      % a cell of column type "p".
      & \hugemath{#7}%

  \blocks{\cosh u}{\sinh u}{\sinh u}{\cosh u}{0}{0}{1}


share|improve this answer

It's really a bad idea to redefine \bar. Plus you're doing by hand things that are already available, using characters that are not what you're expecting: typing | in text mode is not really a good idea, unless you're loading the T1 encoding.

  #1 & #2 \\
  #3 & #4
  \end{array} &
  \xbox[-0.8ex]{#5} \\[2ex]
  & \\[-1.5ex]
  \xbox{#6} &
  \begin{tabular}{@{}c@{}}\raisebox{#1}{\Huge\ $#2$\ }\end{tabular}% 

\blocks{\cosh u}{\sinh u}{\sinh u}{\cosh u}{0}{0}{1}

enter image description here

share|improve this answer
By "redefine" do you mean \bar already has a definition or do you just mean I shouldn't redefine it every time I call \blocks? –  MickG Jul 25 '14 at 18:44
@MickG It has a definition, the “bar” math accent, so it's not wise to redefine it. For the general problem, one redefines something if its definition should depend on current conditions. –  egreg Jul 25 '14 at 19:24
I see. I didn't know. I will fix this. Thanks for telling me :). –  MickG Jul 25 '14 at 20:16
PS it should be \newcommand{\xbox} with braces around \xbox, shouldn't it? And the tabular around the \raisebox in \xbox? What is it for? –  MickG Jul 26 '14 at 18:17
\newcommand{\xbox} and \newcommand\xbox are equivalent. The tabular is for vertical centering and for using \Huge inside it. –  egreg Jul 26 '14 at 18:52

The default OT1 encoding has ligatures (emdash here) and other things in the ascii punctuation slots, try



OT1 is strange < | >

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.