0

I need to create a longtable with fixed average width that contains one adaptive column and two others with derived widths to fit the average table width.

I tried this answer but I need a parbox in last column.

\documentclass{article}
\usepackage{longtable}

\begin{document}


Perfect Fit

\begin{longtable}[l]{|p{0.35\textwidth}|p{0.05\textwidth}|p{0.6\textwidth}|}%   

    HTML & - & HyperText Markup Language \\
    PHP & - & Hypertext Preprocessor \\
    Oceanogr. Oceanogr. .& - &          oceanography, oceanographic(al) oceanography, oceanographic(al) oceanography, oceanographic(al)

\end{longtable}

Manual Adjustment 1

\begin{longtable}[l]{|l|p{0.05\textwidth}|p{0.26\textwidth}|}%  

HTML & - & HyperText Markup Language \\
PHP & - & Hypertext Preprocessor \\
Oceanogr. Oceanogr. Oceanogr. Oceanogr. Oceanogr.& - &          oceanography, oceanographic(al) oceanography, oceanographic(al) oceanography, oceanographic(al)

\end{longtable}


Manual Adjustment 2

\begin{longtable}[l]{|l|p{0.05\textwidth}|p{0.54\textwidth}|}%  

    HTML & - & HyperText Markup Language \\
    PHP & - & Hypertext Preprocessor \\
    Oceanogr. Oceanogr. Oceanogr. & - &         oceanography, oceanographic(al) oceanography, oceanographic(al) oceanography, oceanographic(al)

\end{longtable}     

\end{document}

Can I just get the resulted first column width someway and substract it from textwidth to set widths for other columns?

  • 1
    I'd suggest taking a look at the xltabular package. It combines the features of longtable(mid-table pabe breaks) with tabularx (flexible width X type columns). – leandriis Apr 08 '20 at 08:29
  • 1
    By the way, although the numbers of your p type columns in your first table add up to 1\textwidth, the table is still too wide. To make it exactly as wide as the textwidth, you would have to take the value of \tsbcolsep (2 per column) and the width of the vertical lines (`\arrayrulewidth) into account. – leandriis Apr 08 '20 at 08:32
  • Answered here: https://tex.stackexchange.com/questions/539658/how-to-use-xltabular-environment-in-glossaries-package/539737#539737 – Shalom Alecheim Apr 21 '20 at 07:20

0 Answers0