删除长表内的表格的垂直填充

删除长表内的表格的垂直填充

我想要我的长表有两行标题,我正在使用这个:

\documentclass[12pt,landscape,a4paper]{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{hyphenat}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ragged2e}
\begin{document}
\begin{longtable}{cp{1.7cm}p{1.7cm}p{1.7cm}c}
\parbox{1.4cm}{blable\-bloblu} &
\multicolumn{3}{l}{
\begin{tabular}{@{}p{1.7cm}p{1.7cm}p{1.7cm}@{}}
\multicolumn{3}{c}{onetwothreefour}\\
one &   two  & three
\end{tabular}
}
& \parbox{0.7cm}{bla\-ble} \\
\hline
one & two & three & four & five
\endhead
\end{longtable}
\end{document}

它看起来很棒,只有“一二三”行垂直方向有点太高,并且与“bloblu”和“ble”不对齐(见截图):在此处输入图片描述知道如何把它放低吗?(也欢迎使用更简单的解决方案来制作两行对齐的标题。)(删除水平填充的解决方案来自这里:如何将表格周围的边距设置为 0pt?

更新:根据@Heiko Oberdiek 的建议,我制作了此文档:

\documentclass[12pt,landscape,a4paper]{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{hyphenat}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ragged2e}
\begin{document}
\begin{longtable}{p{1.4cm} p{0.7cm} p{0.7cm} p{0.7cm} p{0.7cm}c}
\strut Název \strut & 
\multicolumn{3}{l}{\begin{tabular}{@{}p{0.7cm}p{0.7cm}p{0.7cm}@{}}\multicolumn{3}{c}{Distribuce} \\ Svět &   ČR  & DVD \end{tabular}} &
\parbox{0.7cm}{\strut Pů\-vod \strut}   
\\
\end{longtable}
\normalsize
\end{document}

它看起来像这样(“Původ”太高了):在此处输入图片描述 这是我通过剥离几乎所有内容而生成的实际文档。

结果:[-0.3pt]应用:在此处输入图片描述

使用后[-0.3pt]:(在此处输入图片描述 我想需要下载图片然后连续查看才能看出区别,但确实有区别。最后的查看效果非常令人满意,谢谢!)

答案1

一种使用multirow、 和的解决方案,其规则命令有一些垂直填充(此填充可以通过和长度booktabs进行更改):\aboverulesepbelowrulesep

\documentclass[12pt,landscape,a4paper]{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable, multirow}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{hyphenat}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ragged2e}

\begin{document}

\begin{longtable}{p{1.4cm} p{0.7cm} p{0.7cm} p{0.7cm} p{0.7cm}}
  \toprule
  \multirow{2}{*}{ Název} & \multicolumn{3}{c}{Distribuce} &
  \multirow{2}{*}[1.25pt]{\parbox{0.7cm}{ Pů\-vod}} \\
    & Svět & ČR & DVD & \\
  \bottomrule
\end{longtable}
\vskip1cm

\begin{longtable}{cp{1.7cm}p{1.7cm}p{1.7cm}c}
  \multirow{2}{*}[1.2pt]{\parbox{1.4cm}{blable\-bloblu}} &
  \multicolumn{3}{c}{onetwothreefour}& \multirow{2}{*}[1.2pt]{\parbox{0.7cm}{bla\-ble}} \\
      & one & two & three & \\
  \midrule
  one & two & three & four & five
  \endhead
\end{longtable}

\normalsize
\end{document} 

在此处输入图片描述

答案2

表格行会自动添加 struts,这在 中是没有的\parbox。因此,\strut在这里添加 有助于获得更好的对齐(使用\arraystretch其默认的 定义1):

\documentclass[12pt,landscape,a4paper]{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{hyphenat}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ragged2e}
\begin{document}
\begin{longtable}{cp{1.7cm}p{1.7cm}p{1.7cm}c}
\parbox{1.4cm}{\strut blable\-bloblu\strut} &
\multicolumn{3}{l}{
\begin{tabular}{@{}p{1.7cm}p{1.7cm}p{1.7cm}@{}}
\multicolumn{3}{c}{onetwothreefour}\\
one &   two  & three
\end{tabular}
}
& \parbox{0.7cm}{\strut bla\-ble\strut} \\
\hline
one & two & three & four & five
\endhead
\end{longtable}
\end{document}

结果

使用内部tabulars 代替 的替代版本\parbox

\begin{longtable}{cp{1.7cm}p{1.7cm}p{1.7cm}c}
  \begin{tabular}{@{}p{1.4cm}@{}}blable\-bloblu\end{tabular} &
\multicolumn{3}{l}{
\begin{tabular}{@{}p{1.7cm}p{1.7cm}p{1.7cm}@{}}
\multicolumn{3}{c}{onetwothreefour}\\
one &   two  & three
\end{tabular}
}
& \begin{tabular}{@{}p{.7cm}@{}}bla\-ble\end{tabular} \\
\hline
one & two & three & four & five
\endhead
\end{longtable}

具有内部 s 的第二个 MWE tabular

\documentclass[12pt,landscape,a4paper]{article}
\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{hyphenat}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ragged2e}
\begin{document}
\begin{longtable}{p{1.4cm} p{0.7cm} p{0.7cm} p{0.7cm} p{0.7cm}c}
Název &
\multicolumn{3}{l}{\begin{tabular}{@{}p{0.7cm}p{0.7cm}p{0.7cm}@{}}\multicolumn{
\\ Svět &   ČR  & DVD \end{tabular}} &
\begin{tabular}{@{}p{0.7cm}@{}}Pů\-vod\end{tabular}
\\
\end{longtable}
\end{document}

结果 2nd MWE 表格

相关内容