6

Expert,

is there any way to get the output of my equation more beautiful e.g. asking LaTeX to igrnore the horizontal space that \underbrace and \overbrace reserve for themselves?

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\begin{document}
\begin{picture}(300,20)
\put(50,10){\vector(2,-3){20}}
\put(50,10){\vector(2,-1){60}}
\put(-10,15){these guys \textbf{here} must be eliminated. The next one \textbf{here} too, of course.}
\put(230,10){\vector(-2,-3){20}}
\end{picture}
\[ \{ \underbrace{x \in \mathbb{Z}}_{\text{Menge aller $x$ aus $\mathbb{Z}$}} \overbrace{|}^{\text{mit der Eigenschaft}} -1 \le x \le 2 \} \]
\\[1cm]
And I want to get it like this:
\[ \{x \in \mathbb{Z} \ | \ -1 \le x \le 2 \}, \]
where the \verb|\overbrace| doesn't wait till the \verb|\underbrace| is going to have the work done.
\end{document}
0

2 Answers 2

9

I would like to suggest you load the mathtools package and use its \mathclap macro to "smash" the widths of the explanatory strings "\text{Menge aller $x$ aus $\mathbb{Z}$}" and "\text{mit der Eigenschaft}". I would use an \overset directive instead of \overbrace to typeset the (stacked) material above the vertical bar. (An overbrace is just too wide relative to the vertical bar.)

With this approach, the explanatory strings will be typeset in \scriptstyle, i.e., with a font that's 30% smaller than the main math font style (which is \textstyle).

Separately, do note that the vertical bar should be of type mathrel. If it's written as \vert or as |, it should be surrounded by thickspaces (\;). Or, more simply, just write \mid.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for \mathclap macro
\usepackage{amsfonts}  % for \mathbb macro
\begin{document}

\[ \{\,
\underbrace{x \in \mathbb{Z}}_{%
   \mathclap{\text{Menge aller $x$ aus $\mathbb{Z}$}}} 
\overset{\mathclap{\substack{%
   \text{mit der Eigenschaft}\\ \downarrow}}}{\mid}
-1 \le x \le 2 % wrap the minus symbol in braces so that it acts as a unary operator
\,\} \]

\end{document}
4
  • \overset{...}{\mid} becomes a Rel atom just like \mid. No need for tricks with minus one.
    – egreg
    Oct 12, 2016 at 6:09
  • @egreg - Thanks for this. I'll change the code.
    – Mico
    Oct 12, 2016 at 6:44
  • @ Mico, thank you for your answer! Your variant looks much better than the output I had! It seems like the number of manuals I should read grows exponentially according to the things a want to implement... :) Is \mathclap the only command that you used from the mathtools package? I have never heard about \mid and \overset before. Where can I get information about the correct usage of them? Thank you again! Oct 12, 2016 at 20:03
  • @Kirill - Glad you found my answer useful. :-) About the macros: \mid is defined in both PlainTeX and LaTeX;\overset, \substack and \text are defined in the amsmath package, which is loaded automatically by the mathtools package; and \mathclap is defined in the mathtools package.
    – Mico
    Oct 12, 2016 at 20:59
4

Here is a solution with mathtools (an extension of amsmath) and stackengine. For short underbraces, \underbracket looks nicer:

\documentclass{article}
\usepackage{mathtools, stackengine}
\usepackage{amsfonts}
\setstackEOL{\\}

\begin{document}

\begin{picture}(300,20)
\put(50,10){\vector(2,-3){20}}
\put(50,10){\vector(2,-1){60}}
\put(-10,15){these guys \textbf{here} must be eliminated. The next one \textbf{here} too, of course.}
\put(230,10){\vector(-2,-3){20}}
\end{picture}
\[ \bigl\{ \underbracket[0.5pt]{x \in \mathbb{Z}}_{\clap{\footnotesize Menge aller $x$ aus $\mathbb{Z}$}} \stackrel{\Shortstack {\clap{\footnotesize mit der Eigenschaft}\\$\downarrow $}}{\mid} -1 \le x \le 2\bigr\} \]
\\[1cm]
And I want to get it like this:
\[ \{x \in \mathbb{Z} \ | \ -1 \le x \le 2 \}, \]
where the \verb|\overbrace| doesn't wait till the \verb|\underbrace| is going to have the work done.

\end{document} 

enter image description here

7
  • If you enlarge the sizes of the outer curly braces, shouldn't you also enlarge the size of the vertical bar, i.e., write \bigm| instead of \mid?
    – Mico
    Oct 12, 2016 at 2:12
  • @Bernard, I get ! LaTeX Error: File listofitems.sty' not found.` when I try to load the stackengine. Should it be installed in a different way than \usepackage? Thank you for your answer! Oct 12, 2016 at 19:54
  • This means you don't have the listofitems package installed. It is required by stackengine. Which distribution do you have?
    – Bernard
    Oct 12, 2016 at 20:03
  • 1
    Yes, with MiKTeX Package Manager (admin). You made me discover it was required!
    – Bernard
    Oct 12, 2016 at 20:08
  • 1
    Looks like the compiler is waiting for an answer. You can't launch both the compiler and M.P.M. Also, synchronize the repository.
    – Bernard
    Oct 12, 2016 at 20:30

You must log in to answer this question.

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