1

I am trying to remove the indenting of some table entries under a section.

Yesterday I posted this question, where the solution was quite simple.

However, when I try to apply that solution to a different table, I get an errer: Extra alignment tab has been changed to \cr. Test Sentence D &

The markup I am using:

\documentclass[letterpaper,11pt]{article}
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\usepackage[
top    = 0.608cm,
bottom = 0.664cm,
left   = 1.20cm,
right  = 2.10cm]{geometry}
\begin{document}
\begin{tabular}{@{}p{15.5cm} p{4cm}}
Test sentence 1 & Test sentence 2
\end{tabular}\\
lorem ipsum etc etc etc
\vspace{-9mm}
\begin{itemize} 
    \item[--] asdasd
    \item[--] dsfsdf
\end{itemize}
\vspace{-6mm}
\section*{Section heading}
\begin{tabular*}{7.5in}{l@{\extracolsep{\fill}}r}

Test Sentence A  &  Test Sentence B\\
Test Sub-sentence A  &

\end{tabular*}              
\vspace{3mm}\vspace{1mm}
\begin{tabular*}@{}{7.5in}{l@{\extracolsep{\fill}}r}

Test Sentence D  &  Test Sentence E\\
Test Sub-sentence D  &

\end{tabular*}

\end{document}

I have made a screenshot demonstrating the output:

enter image description here

Additionally, it seems the table entries in the different tables don't align with each other (as shown with the shorter red line), and I would like to understand why.

7
  • the posted code is missing { and makes the error ! Missing number, treated as zero. <to be read again> @ l.28 \begin{tabular*}@ after any error the pdf is not intended to be usable at all. Dec 19 '19 at 19:58
  • @DavidCarlisle, right, that is my issue, I just copied the wrong error. If I remove the @{} the PDF compiles perfectly, however the entries are indented. Dec 19 '19 at 19:59
  • the @{} should be inside the preamble argument before the first l. But if you get an error ask about the error don't post output without mentioning it's an error. Dec 19 '19 at 20:01
  • @DavidCarlisle Thank you, I apologize. Would you prefer I delete this question, or would you like to post an answer? Dec 19 '19 at 20:04
  • no harm done,:-) I'll post something. Dec 19 '19 at 20:05
2

You have the @{} in the wrong place

\begin{tabular*}@{}{7.5in}{l@{\extracolsep{\fill}}r}

the @{} should be part of the column specification

\begin{tabular*}{7.5in}{@{}l@{\extracolsep{\fill}}r}

or more simply

\begin{tabular*}{7.5in}{@{\extracolsep{\fill}}lr}

You are adding space tokens before the second tabular, as you have no blank line before the \vspace so the ends of lines count as inter-word spaces.

Adding a blank line

\documentclass[letterpaper,11pt]{article}
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\usepackage[
top    = 0.608cm,
bottom = 0.664cm,
left   = 1.20cm,
right  = 2.10cm]{geometry}
\begin{document}
\begin{tabular}{@{}p{15.5cm} p{4cm}}
Test sentence 1 & Test sentence 2
\end{tabular}\\
lorem ipsum etc etc etc
\vspace{-9mm}
\begin{itemize} 
    \item[--] asdasd
    \item[--] dsfsdf
\end{itemize}
\vspace{-6mm}
\section*{Section heading}
\begin{tabular*}{7.5in}{@{}l@{\extracolsep{\fill}}r}

Test Sentence A  &  Test Sentence B\\
Test Sub-sentence A  &

\end{tabular*}              

\begin{tabular*}{7.5in}{@{}l@{\extracolsep{\fill}}r}

Test Sentence D  &  Test Sentence E\\
Test Sub-sentence D  &

\end{tabular*}

\end{document}

enter image description here

3
  • Thank you for your answer David. Is there a simple way to reduce the 'height' of the line? I was using vspace as this was given as an answer in another question, but this affects the indenting due to the reason you gave, so isn't working as a solution for me. If this problem warrants a separate question please let me know. Dec 19 '19 at 20:16
  • @JakeRankin you can use vspace if you want, just always leave a blank line before \vspace (but simpler would be to make it a single table) Dec 19 '19 at 20:18
  • Perfect, thank you for all your help. Dec 19 '19 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.