将第二列的标题基线与第一列的基线对齐

将第二列的标题基线与第一列的基线对齐

我有一个包含整页框的双列文档。这些框有时包含表格或图形标题,这些标题通常位于框的第二列顶部,看起来效果最佳。

但是,标题放在表格/图形上方时,并不与第一列中的文本垂直对齐。下图显示了左列和标题名称的特写,此处均带有下划线,以强调基线未对齐。

左栏和标题的特写。两者都带有下划线以强调基线

梅威瑟:

\documentclass[parskip=half-]{scrreprt}
\usepackage[twocolumn,landscape]{geometry}
\usepackage{multicol}
\newlength{\currentparskip}
%\usepackage{microtype}
\usepackage{newfloat}
\usepackage{float}
\usepackage{tikz}
\usepackage[tikz]{mdframed}
\usepackage{caption}

\usepackage{ulem}  % for underline
\usepackage{lipsum}

\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}

\makeatletter
\newenvironment{bigbox*}[2]{%
  \setlength{\currentparskip}{\parskip}
  \@dblfloat{boxe}%
  \begin{mdframed}
  \caption{#1}\label{#2}%
  \setlength{\columnsep}{1mm}  % deliberately narrow to exhibit baselines
  \begin{multicols}{2}
  \setlength{\parskip}{\currentparskip}% restore the value
}{%
  \end{multicols}\end{mdframed}
  \end@dblfloat
}
\makeatother


\begin{document}
\lipsum

\begin{bigbox*}{This is the box title}{box:box}
\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae,
felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tris-
tique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et
lectus vestibulum urna fringilla ultrices. Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis
in, pretium quis, viverra ac, nunc. Praesent eget sem vel
leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor
semper nulla. Donec varius orci eget risus. Duis nibh mi,
congue eu, accumsan eleifend, sagittis quis, diam. Duis eget
orci sit amet orci dignissim rutrum.}

\lipsum[2]
\columnbreak
\begin{table}[H]
\captionsetup{justification=raggedright, name={\uline{Table}}, font={small}, singlelinecheck=false}
\captionabove{\underline{Table caption}}
\begin{tabular}{lllllllll}
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
\end{tabular}
\end{table}

 Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. 

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum
\end{bigbox*}
\lipsum

\end{document}

我尝试在 之前添加以下内容(组合)\begin{table}[H],但没有效果:

\newlength{\oldcaptionskip}
\setlength{\oldcaptionskip}{\abovecaptionskip}
\setlength{\abovecaptionskip}{0pt}
\newlength{\oldintextsep}
\setlength{\oldintextsep}{\intextsep}
\setlength{\intextsep}{0pt}

我也尝试position=above按照caption包装文档 并将这些长度放在之内\captionsetup,但这并没有什么区别。

由于这是一个网格问题(我理解这是 LaTeX 比较弱的任务),我尝试过,\usepackage[fontsize=10pt, baseline=12pt]{grid}但它使差异更加明显。

我了解我可以解决\vspace*{-magic number pt}这个问题,但我认为我忽略了一些东西captionsetup

我的任务确实需要font={small}保持一致性。尽管如此,我仍然对不适用于表格标题中不同字体的解决方案感兴趣。

答案1

可以将顶行与 对齐\strut,两次都排版为\normalsize

\strut\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

\captionabove{{\normalsize\strut}\uline{Table caption}}

(请注意,我将\underline其改为\uline另外(因此两次都\uline用到了),因为结果略有不同。)

在此处输入图片描述

您的示例,经过修改:

\documentclass[parskip=half-]{scrreprt}
\usepackage[twocolumn,landscape]{geometry}
\usepackage{multicol}
\newlength{\currentparskip}
%\usepackage{microtype}
\usepackage{newfloat}
\usepackage{float}
\usepackage{tikz}
\usepackage[tikz]{mdframed}
\usepackage{caption}

\usepackage{ulem}  % for underline
\usepackage{lipsum}

\DeclareFloatingEnvironment[listname={List of boxes}, name = {Box}]{boxe}

\makeatletter
\newenvironment{bigbox*}[2]{%
  \setlength{\currentparskip}{\parskip}
  \@dblfloat{boxe}%
  \begin{mdframed}
  \caption{#1}\label{#2}%
  \setlength{\columnsep}{1mm}  % deliberately narrow to exhibit baselines
  \begin{multicols}{2}
  \setlength{\parskip}{\currentparskip}% restore the value
}{%
  \end{multicols}\end{mdframed}
  \end@dblfloat
}
\makeatother


\begin{document}
\lipsum

\begin{bigbox*}{This is the box title}{box:box}
\strut\uline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae,
felis. Curabitur dictum gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque. Pellentesque habitant morbi tris-
tique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et
lectus vestibulum urna fringilla ultrices. Phasellus eu tellus
sit amet tortor gravida placerat. Integer sapien est, iaculis
in, pretium quis, viverra ac, nunc. Praesent eget sem vel
leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla,
malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor
semper nulla. Donec varius orci eget risus. Duis nibh mi,
congue eu, accumsan eleifend, sagittis quis, diam. Duis eget
orci sit amet orci dignissim rutrum.}

\lipsum[2]
\columnbreak
\begin{table}[H]
\captionsetup{justification=raggedright, name={\uline{Table}}, font={small}, singlelinecheck=false}
\captionabove{{\normalsize\strut}\uline{Table caption}}
\begin{tabular}{lllllllll}
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
a & b & c &a & b & c &a & b & c \\
\end{tabular}
\end{table}

 Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at,
mollis ac, nulla. 

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum

Curabitur auctor semper nulla. Donec
varius orci eget risus. Duis nibh mi, congue eu, accumsan
eleifend, sagittis quis, diam. Duis eget orci sit amet orci
dignissim rutrum
\end{bigbox*}
\lipsum

\end{document}

相关内容