我的論文中有幾個方程,變數的解釋如下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
包,它擴展longtable
到tabularx
功能:首先是一個差異(我不太明白,您的邊距應該是多少,所以這可能是錯誤的,但您明白了。)
\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}