parbox的外部位置为c的排版效果与书上描述的不同

发布于 2021-08-11 20:43:40

在用parbox命令排版的时候,看到书上阐述[外部位置]为c的定义时说这样的段落盒子的基线为盒子的水平中线,但是我在自己MWE中发现并不是这样的(基线要在水平中线下方一些)image.png

\documentclass{ctexart}
\begin{document}
\makebox[0cm][l]{\rule{32mm}{0.4pt}}
\parbox[c]{4em}{夏大鱼羊} \makebox[0cm][l]{\rule{32mm}{0.4pt}}夏大鱼羊
\end{document}

请问是书上说的有问题,还是需要怎么去理解?

查看更多

关注者
0
被浏览
1.2k
越来越少
越来越少 2021-08-12
这家伙很懒,什么也没写!

在《source2e》(2021-06-01)中查到,\parbox 的外部位置参数 c 对应 \vcenter, 猜测,盒子内容放到 $\vcenter{...}$ 中,这是个垂直盒子。关于 \vcenter 可以参考《The TeXbook》,《LaTeX2e文类和宏包学习手册》,盒子 \vcenter 的中线一般与数学式的轴线对齐。不过数学式的轴线一般不与普通文字的基线对齐。

$\div\frac{A}{B}---$
\parbox[c][1cm][c]{4cm}
{\tikz[baseline=(b.base)]{
  \node[draw,inner sep=0pt,outer sep=0pt](b){测试};
  \draw[red] ([xshift=-5mm]b.west)--([xshift=5mm]b.east);}
  案例}

9481b5e56181b10f591a784680c74466.png

3 个回答
啸行
啸行 2021-08-11
这家伙很懒,什么也没写!

The optional argument inner-pos controls the placement of content inside the parbox.

Its default is the value of position.

Its possible values are: t to put the content at the top of the box, c to put it in the vertical center, b to put it at the bottom of the box, and s to stretch it out vertically (for this, the text must contain vertically stretchable space).

我觉得这段话的描述应该是准确的。

夏大鱼羊-xkwxdyy
这家伙很懒,什么也没写!

用tikz把LaTeX2e中说的vertical center和 centerline of the adjacent line画出来了,确实是这样的,中文书的说法果然有问题

\documentclass{ctexart}
\usepackage{tabularray}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{minipage}[c]{3em}
    \begin{tikzpicture}[baseline]
        \node[draw,inner sep=0pt,outer sep=0pt](b){测试};
        \draw[fill=black] ([xshift=-2mm]b.west)--([xshift=2mm]b.east);
    \end{tikzpicture}
\end{minipage}
\begin{minipage}[c]{3cm}
    \begin{tikzpicture}[baseline]
        \node[draw,inner sep=0pt,outer sep=0pt](a){\includegraphics[width=30mm]{tx.pdf}};
        \draw[fill=black] (a.west) circle (0.5pt);
    \end{tikzpicture}
\end{minipage}
\end{document}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览