对连续表的列设置相同的特定宽度会产生水平偏移

对连续表的列设置相同的特定宽度会产生水平偏移

当我按顺序排列具有特定列宽的多个表格时,我得到了奇怪的结果

平均能量损失

\documentclass[ngerman]{scrartcl}

\usepackage[german]{babel}
\usepackage{booktabs, array}
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


\begin{document}
\begin{longtable}{R{139.4185pt} L{278.837pt}} %Numbers are .3333 and .6666 of \textwidth
    Bla & Bla\\
\end{longtable}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\end{document}

这会产生不必要的偏移,有时取决于 a 之前是否有空行tabular。无论我将 longtable 放在哪里,下一个表格的偏移都是错误的:

错误偏移的示例

这是怎么回事?

答案1

此效果是文档默认缩进的结果。\setlength{\parindent}{0pt}如果您想要零缩进,请将其放在序言中,或者\noindent在每个表格之前删除缩进,效果将被删除。

\documentclass[ngerman]{scrartcl}

\usepackage[german]{babel}
\usepackage{booktabs, array}
\usepackage{longtable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\setlength{\parindent}{0pt}

\begin{document}
\begin{longtable}{R{139.4185pt} L{278.837pt}} %Numbers are .3333 and .6666 of \textwidth
    Bla & Bla\\
\end{longtable}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}

\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\begin{tabular}{R{139.4185pt} L{278.837pt}}
    Bla & Bla\\
\end{tabular}
\end{document}

相关内容