2

I have a code like this:

This sentence is written by Chinese. 這是中文字。This sentence is written by Chinese.\\
\hspace*{2em}\fbox{\begin{minipage}[t][][t]{\textwidth-4em}
    $\begin{alignedat}[t]{3}
    &(\mathcal{MS}1)~~\text{\scshape Positive Definite}&&\quad&&\forall x,y\in X,~d(x,y)\geq 0\wedge(d(x,y)=0\Leftrightarrow x=y)\\
    &(\mathcal{MS}2)~~\text{\scshape Symmetric}&& &&\forall x,y\in X,~d(x,y)=d(y,x)\\
    &(\mathcal{MS}3)~~\text{\scshape Triangle Inequality}&& &&\forall x,y,z\in X,~d(x,z)\leq d(x,y)+d(y,z)
    \end{alignedat}$
    \end{minipage}}\\
This sentence is written by Chinese. 這是中文字。This sentence is written by Chinese. 這是中文字。This sentence is written by Chinese. 這是中文字。

The result is: enter image description here

(PS: The reason that the line-space is big, is because I'm typesetting a Chinese document, a wide space is needed.)

As the picture shown, the up border of the box is adjacent to the baseline of the first line above, and the down border of the box is adjacent to the top of the first line below.

If I want these two line-space be wider(see the red places in the figure below), how can I do this? What method is more ideal?(i.e. not just \\[0.3cm] or \vspace{...}) And what I want to know, is the behavior when a pretty high box (or pretty high content, such like $\displaystyle\frac{\displaystyle\frac{3}{2}}{5}$) occurs in some line in a paragraph? enter image description here

UPDATE: A quick test code is:

\documentclass[12pt,a4paper,openany,fleqn]{book}
\usepackage[margin=1.8cm, top=2cm]{geometry}
\usepackage{amsmath,amssymb, amsfonts}
\usepackage[no-math]{fontspec}
\parindent = 0 pt 

\begin{document}
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. \\
\hspace*{2em}\fbox{\begin{minipage}[t][][t]{15cm}
    $\begin{alignedat}[t]{3}
    &(\mathcal{MS}1)~~\text{\scshape Positive Definite}&&\quad&&\forall x,y\in X,~d(x,y)\geq 0\wedge(d(x,y)=0\Leftrightarrow x=y)\\
    &(\mathcal{MS}2)~~\text{\scshape Symmetric}&& &&\forall x,y\in X,~d(x,y)=d(y,x)\\
    &(\mathcal{MS}3)~~\text{\scshape Triangle Inequality}&& &&\forall x,y,z\in X,~d(x,z)\leq d(x,y)+d(y,z)
    \end{alignedat}$
    \end{minipage}}\\
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. 

\end{document}

Output: enter image description here

  • 2
    The boxed minipage is both very high and deep, so it's separated from the lines that precede and follow by \lineskip (default 1pt). I'd use \[...\] instead of \\\hspace*{2em} and so on. Please, make a fully compilable example. – egreg Feb 26 '17 at 10:32
  • @egreg I just have added a compilable code. – Eric Feb 26 '17 at 10:59
2

As the document is written, the minipage has quite a large height (because of the top rule of the box) and a very large depth (because of the [t] option).

Thus the separation from the lines above and below is given by \lineskip (default value 1pt).

In this case it's much better to use a display; since you have fleqn, the only option is center:

\documentclass[12pt,a4paper,fleqn]{book}
\usepackage[margin=1.8cm, top=2cm]{geometry}
\usepackage{amsmath}

\linespread{1.4} % because of Chinese

\begin{document}
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD.
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD.
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD.
\begin{center}
\fbox{%
  $\begin{alignedat}{2}
  (\mathcal{MS}1)\quad& \textsc{Positive Definite}&\quad&
    \forall x,y\in X,\ d(x,y)\geq 0\wedge(d(x,y)=0\Leftrightarrow x=y)
  \\
  (\mathcal{MS}2)\quad& \textsc{Symmetric}&\quad&
    \forall x,y\in X,~d(x,y)=d(y,x)
  \\
  (\mathcal{MS}3)\quad& \textsc{Triangle Inequality}&\quad&
    \forall x,y,z\in X,~d(x,z)\leq d(x,y)+d(y,z)
  \end{alignedat}$%
}
\end{center}
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. 
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. 
THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. THIS IS SOME WORD. 

\end{document}

Note that the minipage is not needed (so you haven't to guess at the right horizontal size). By the way, using the second and third optional argument to minipage should be very rarely needed.

enter image description here

  • I see! Thanks a lot! Also thanks for correcting my bad code in alignedat. – Eric Feb 26 '17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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