固定长表右边距

固定长表右边距

我的论文中有几个方程式,变量以以下形式解释longtable(因此可以分成两页)。我希望我的表格和文本一样宽。我尝试使用\LTright但它不起作用(\LTleft工作正常)......(为什么???)我可以用定义最后一列的宽度,p{xcm}但由于第二列,每个表格的宽度都不同,我不想测试每个表格的宽度。我希望表格和纸张右边缘之间的边距是固定的。

\documentclass[a4paper, 12pt,titlepage]{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{palatino, url, multicol}
\usepackage{graphicx}
\setlength{\parindent}{1cm}
\usepackage{indentfirst}
\setcounter{secnumdepth}{3}
\usepackage{mdframed}
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{light-gray}{gray}{0.85}
\setcounter{tocdepth}{3}
\usepackage{titlesec}
\titleformat{\chapter}[display]   
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}  
\titlespacing*{\chapter}{0pt}{-20pt}{40pt}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{enumerate}
\usepackage{here}
\usepackage{longtable}
\usepackage[bottom]{footmisc}
\usepackage[font={small,it}]{caption}
\usepackage{ctable}

\usepackage[left=3.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}

\begin{equation}
  EVA = NOPAT - WACC \cdot Capital
\end{equation}

\setlength\LTleft{-0.2cm}
\setlength\LTright{-10cm} %I want 2.5 cm of the margin
\begin{longtable}{llll}
  kde:  & NOPAT &=& Zisk z operativní činnosti podniku po dani (ang. "net operating profit after taxes") \\
   & WACC &=& Průměrné vážené náklady kapitálu \\
   & Capital &=& Aktiva potřebná k hlavnímu provozu podniku   \\
\end{longtable}
\setlength{\parindent}{1cm}

\lipsum[1]

\end{document}

答案1

如果您想将线拉伸至全宽,则需要在某些地方具有一定的灵活性。

 \begin{longtable}{@{\extracolsep{\fill}}llll@{}}

是最简单的方法:在每列之间添加可拉伸胶水(并去除第一列之前和最后一列之后的固定胶水)

答案2

您可以使用tabu扩展longtabletabularx功能的包:首先是差异(我不完全明白,您的边距应该有多远,所以这可能是错的,但您明白了。)

\usepackage{tabu}
%[…]
%\begin{longtable}{llll}
\setlength\LTright{-2.5cm} %I want 2.5 cm of the margin
\newlength{\mytablewidth}
\setlength{\mytablewidth}{\textwidth}
\addtolength{\mytablewidth}{\LTright}
\begin{longtabu} to \mytablewidth {lllX}
%[…]
\end{longtabu}
%\end{longtable}
%[…]

然后是整个代码(\usepackage{lipsum}\begin{document}添加了:

\documentclass[a4paper, 12pt,titlepage]{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{palatino, url, multicol}
\usepackage{graphicx}
\setlength{\parindent}{1cm}
\usepackage{indentfirst}
\setcounter{secnumdepth}{3}
\usepackage{mdframed}
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{light-gray}{gray}{0.85}
\setcounter{tocdepth}{3}
\usepackage{titlesec}
\titleformat{\chapter}[display]   
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}  
\titlespacing*{\chapter}{0pt}{-20pt}{40pt}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{enumerate}
\usepackage{here}
\usepackage{longtable}
\usepackage{tabu}
\usepackage[bottom]{footmisc}
\usepackage[font={small,it}]{caption}
\usepackage{ctable}

\usepackage[left=3.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}

\usepackage{lipsum}
\begin{document}
\begin{equation}
  EVA = NOPAT - WACC \cdot Capital
\end{equation}

\setlength\LTleft{-0.2cm}
\setlength\LTright{-2.5cm} %I want 2.5 cm of the margin
\newlength{\mytablewidth}
\setlength{\mytablewidth}{\textwidth}
\addtolength{\mytablewidth}{\LTright}
\begin{longtabu} to \mytablewidth {lllX}
  kde:  & NOPAT &=& Zisk z operativní činnosti podniku po dani (ang. "net operating profit after taxes") \\
   & WACC &=& Průměrné vážené náklady kapitálu \\
   & Capital &=& Aktiva potřebná k hlavnímu provozu podniku   \\
\end{longtabu}
\setlength{\parindent}{1cm}

\lipsum[1]

\end{document}

相关内容