2

I am using longtable to present the list of Notations, and the codes are as follows.

\documentclass[10pt]{book}
\usepackage{newpxtext,newpxmath}
\linespread{1.05}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{lipsum} % just for dummy text- not needed for a longtable
\setlength{\parindent}{0pt}

\setlength\LTleft{0pt}
\setlength\LTright{0pt}

\begin{document}
    \par a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
    \vspace{10pt} \par
    \begin{longtable}{@{\extracolsep{\fill}}p{0.2\textwidth}p{0.6\textwidth}w{r}{0.2\textwidth}}
        \multicolumn{3}{l}{\textbf{List of Notations}\vspace{1mm}}\\
        notation 1&   explain of the notation 1   & unit 1 \\
        notation 2&   explain of the notation 2   & unit 2 \\
    \end{longtable}
    \par a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
\end{document}

The output is as follows.

enter image description here

It can generally show what I expect, but there are two problems.

  1. the lengths of the three columns are set as 0.2\textwidth, 0.6\textwidth and 0.2\textwidth, but the total length of the table is longer than the textwidth. Is there any solution to ensure the length of the table is exactly the same as the textwidth? Maybe if I set the length for the 1st and the 2nd column, then the length of the 3rd column will be automatically set to fit the length?

  2. the text "List of Notations" in the first row of the table has a left margin, which I do not want. Is there any solution to set it as zero margin?

2 Answers 2

2

both questions have the same answer, you can set \setlength\tabcolsep{0pt} to make the cell padding 0, or remove each case with

\multicolumn{3}{@{}l@{}}{

and

{@{\extracolsep{\fill}}
p{0.2\textwidth}
@{}
p{0.6\textwidth}
@{}
w{r}{0.2\textwidth}
@{}
}
2

It makes little sense to specify w{r}{0.2\textwidth} as the column type for the third column of the table at hand. Instead, just use r.

enter image description here

\documentclass[10pt]{book}
\usepackage{newpxtext,newpxmath}
\linespread{1.05}

\usepackage{longtable}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}

\setlength{\parindent}{0pt}

\begin{document}

\begin{longtable}{@{\extracolsep{\fill}}
      p{0.2\textwidth}
      p{0.6\textwidth} 
      r @{}}
% headers and footers
\hline
\multicolumn{2}{@{}l}{\textbf{List of Notations}} &
\textbf{Units}\\[1ex]
\endhead

\hline
\endfoot

% body of table
notation 1 & explanation of notation 1 & unit 1 \\
notation 2 & explanation of notation 2 & unit 2 \\

\end{longtable}

\end{document}

You must log in to answer this question.

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