6

In the code below, I am only getting a box around part of my equation like this:

enter image description here

How do I get the box to appear around the full equation? Thanks!

CODE

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\begin{document}

\fbox{
$
  \zeta\nearrow
  \underset
     {\mathrlap{\displaystyle\Searrow\text{ overshoot}\searrow}}
     {\mathrlap{\Rightarrow\text{P.M.} \nearrow}}
$
}
\end{document}

2 Answers 2

6

Add a phantom.

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\begin{document}

\fbox{
$
  \zeta\nearrow
  \underset
     {\mathrlap{\displaystyle\Searrow\text{ overshoot}\searrow}}
     {\mathrlap{\Rightarrow\text{P.M.} \nearrow}}
\hphantom{\Searrow\text{ overshoot}\searrow}$
}
\end{document}

enter image description here

3

The problem is due to the use of \mathrlap. Here is another approach, based on the eqparbox package and a simple \boxed command:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}
\usepackage{eqparbox}
\newcommand{\eqlmathbox}[2][M]{\eqmakebox[#1][l]{$\displaystyle#2$}}

\begin{document}

$ \boxed{%
 \zeta\nearrow \underset {\eqlmathbox{\displaystyle\Searrow\text{ overshoot}\searrow}}%
     {\eqlmathbox{\Rightarrow\text{P.M.} \nearrow}}
}$

\end{document} 

enter image description here

2
  • thanks for your solution. However, when I tried your code, the double arrows are not aligned as you have in your graphic. Could this be due to the fact that I am using XeLaTeX?
    – Joe
    Commented Oct 27, 2018 at 18:50
  • 1
    You have to compile twice, because the package has to measure both \eqmakeboxes.
    – Bernard
    Commented Oct 27, 2018 at 18:57

You must log in to answer this question.

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