0

I have several equations in my paper, with variables explained below in the form of longtable (so it can be split into two pages). I want my table to be as wide as the text. I try to use \LTright but it doesnt work (\LTleft works fine)...(why???) I can define the width of the last column with p{xcm} but thanks to second column every table differs in the width and I dont want to test the width for every single table. I want to have the margin between table and right edge of the paper fixed.

\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}
3
  • You're missing \begin{document}
    – Toscho
    Commented Apr 11, 2013 at 16:15
  • Please make your compilable: you forgot to load lipsum, and \begin{document} is nowhere to be seen. Also, please remove all packages that are unnecessary for explaining your problem.
    – jub0bs
    Commented Apr 11, 2013 at 16:18
  • yeah, sorry I forgot to include lipsum package and \begin{document} while posting here... Commented Apr 11, 2013 at 16:23

2 Answers 2

1

You need some flexibility somewhere if you want to stretch the line to be full width.

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

Is the easiest way: adding stretchable glue between each column (and removing the fixed glue before the first column and after the last)

1

You can use the tabu package, which extends longtable to tabularx functionality: First a diff (I don't exactly understand, how far your margin should be, so this might be wrong, but you get the idea.)

\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}
%[…]

Then the whole code (with \usepackage{lipsum} and \begin{document} added as well:

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .