1

I'm having trouble getting my tables to display such that the leftmost elements and rightmost elements appear at the start and end of the document text width. Not only does the rightmost text not end at the same position across the same table environments (e.g., see the "Education" and "Teaching Experience" sections below, the former using tabular and the second using longtable), but neither does it end in the same position across the same table environments (e.g., see the "Education" and "Academic Appointments" sections below, which both use tabular). And none of the tables end at the same position as the normal paragraph text in the "Publications" section.

Apologies in advance for the lengthy example. I wanted to provide a few examples to illustrate the slight deviance across them. Also, when it comes to the code for longtable, this question may be closely related to the one posed here, which deals with the odd indenting related to that package. When I am able to get the longtable to end where I want it on the right side of the page, it invariable creates an indent on the left side.

Thanks for any help you can provide, and sorry if anything in herein is unclear.

\documentclass[11pt]{article}
\usepackage[top=1in,bottom=0.75in,left=1in,right=1in]{geometry}
\geometry{letterpaper,portrait}
\usepackage{multicol} %to split doc into columns
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage[none]{hyphenat} %to keep latex from hyphenating words

\usepackage{ragged2e} %to right justify text in column; with below
\usepackage{array} %to right justify text in column; with above

\usepackage{longtable} %allow table to cross page breaks
\setlength{\LTpre}{0pt} %remove extra whitespace before longtable
%\setlength{\LTpost}{0pt} %remove extra whitespace after longtable
\usepackage{ltxtable}
\usepackage{filecontents} 

\usepackage{amssymb}
\renewcommand{\labelitemi}{$\circ$}

\setlength{\parindent}{0pt}
\setlength\columnsep{20pt}

\begin{document}
%\pagenumbering{gobble} %removes page numbers

\subsection*{EDUCATION}
\begin{tabular}{@{} p{6in} p{0.25in} @{}}
  PhD---Political Science and Public Policy, Wisconsin University & 2014\\[5pt]
  BA---Political Sci., History, Economics, and Near Eastern Cultures, 
  Ohio University & 2007\\ \\
\end{tabular}


\subsection*{ACADEMIC APPOINTMENTS}
\begin{tabular}{@{} p{5.55in} >{\RaggedLeft\arraybackslash}p{0.7in} @{}}
Assistant Professor---American University, School of Global Affairs \& Policy 
    & 2016--2018\\[5pt]
Lecturer---Boston University, Metropolitan College 
    & 2016\\[5pt]
Lecturer---Massachusetts Institute of Technology, Political Science Department 
    & 2015\\ \\
\end{tabular}

\subsection*{PUBLICATIONS}
\hangindent=1cm
``Low Socio-Economic Status Favor Redistribution.'' In Todd K. Shackelford and 
Viviana A. Weekes-Shackelford (eds.), \textit{Encyclopedia of Evolutionary 
Psychological Science}, Springer. 2017.\vspace{5pt}

\hangindent=1cm
``Externalities.'' In Todd K. Shackelford and Viviana A. Weekes-Shackelford 
(eds.), \textit{Encyclopedia of Evolutionary Psychological Science}, Springer. 
With UWK. 2017.\vspace{5pt}

\hangindent=1cm
``Earning Our Place, More or Less: Responsibility's Uncertain Relationship with 
Desert.'' Under review.\\


\subsection*{INVITED TALKS}
\begin{tabular}{@{} p{6in} p{0.25in} @{}}
    Leiden University, Political Science Department & 2017\\[5pt]
    John Cabot University, Political Science and International Affairs 
    Deptartment & 2016\\[5pt]
    American University of Beirut, Deptartment of Political Studies and Public 
    Administration & 2016\\[5pt]
    University of Connecticut, Political Economy Workshop & 2015\\ \\
\end{tabular}

\subsection*{TEACHING EXPERIENCE}
\begin{longtable}{@{}p{5.25in}>{\raggedleft\arraybackslash}p{1in}}
\textbf{Graduate Courses} & \\
IUPUI, School of Public and Environmental Affairs & \\
    \hspace{1cm}Statistical Analysis for Effective Decision-making (V506) & 
    SP17, FA17\\[5pt]
\textbf{Undergraduate Courses} & \\
Boston University, Metropolitan College \& Prisoner Education Program & \\
    \hspace{1cm}Politics and Philosophy: Theories of Justice (PH155) & 
    SP16\\[5pt]
MIT, Political Science \& Department of Urban Studies and Planning & \\
    \hspace{1cm}Making Public Policy (11.002J / 17.30J) & FA15\\[5pt]
\end{longtable}

\end{document}

The right alignment of the tabular environments do not line up with each other, nor do they align with the longtable output

The rightmost text falls to either side of the vertical line rather than aligning to it.

  • The in my opinion easiest solution would be using \begin{tabularx}{\textwidth}{@{} X r @{}} for all your tables. – leandriis May 7 '18 at 17:34
  • That is an infuriatingly simple solution. Thanks, @leandriis! One question: It appears I can use tabularx with ltablex to deal with tables that span pages, but when I do so, the tables with indents (e.g., the "Teaching Experience" section in the above example) no longer take up the entirety of the text width. Any recommendations? – jbowerbir May 8 '18 at 9:01
1

The following MWE shows how to use tabularx and ltablex in order to achieve uniformly wide tables that span the whole textwidth (which is indicated by the black lines). In order to make a tabularx that is split over pages span the whole textwidth as well, you have to add \keepXColumns to the preamble.

From the ltablex manual:

Another feature that has been added is to treat the X columns like l columns if the table contents would allow that to happen without exceeding the specified width of the table. In other words, the specified width is treated as the maximum allowed and not the exact width of the table. This feature is the default but can be disabled (or enabled) with \keepXColumns (or \convertXColumns )

\documentclass[11pt]{article}

\usepackage[top=1in,bottom=0.75in,left=1in,right=1in]{geometry}
\geometry{letterpaper,portrait}
\usepackage[none]{hyphenat}

\usepackage{ltablex}

\setlength{\parindent}{0pt}
\setlength\columnsep{20pt}
\keepXColumns


\begin{document}

\subsection*{EDUCATION}
\begin{tabularx}{\textwidth}{@{} Xr @{}}
  PhD---Political Science and Public Policy, Wisconsin University & 2014\\[5pt]
  BA---Political Sci., History, Economics, and Near Eastern Cultures, 
  Ohio University & 2007\\ \\
\end{tabularx}


\subsection*{ACADEMIC APPOINTMENTS}
\begin{tabularx}{\textwidth}{@{} Xr @{}}
Assistant Professor---American University, School of Global Affairs \& Policy 
    & 2016--2018\\[5pt]
Lecturer---Boston University, Metropolitan College 
    & 2016\\[5pt]
Lecturer---Massachusetts Institute of Technology, Political Science Department 
    & 2015\\ \\
\end{tabularx}

\subsection*{PUBLICATIONS}
\hangindent=1cm
``Low Socio-Economic Status Favor Redistribution.'' In Todd K. Shackelford and 
Viviana A. Weekes-Shackelford (eds.), \textit{Encyclopedia of Evolutionary 
Psychological Science}, Springer. 2017.\vspace{5pt}

\hangindent=1cm
``Externalities.'' In Todd K. Shackelford and Viviana A. Weekes-Shackelford 
(eds.), \textit{Encyclopedia of Evolutionary Psychological Science}, Springer. 
With UWK. 2017.\vspace{5pt}

\hangindent=1cm
``Earning Our Place, More or Less: Responsibility's Uncertain Relationship with 
Desert.'' Under review.\\


\subsection*{INVITED TALKS}
\begin{tabularx}{\textwidth}{@{} Xr @{}}
    Leiden University, Political Science Department & 2017\\[5pt]
    John Cabot University, Political Science and International Affairs 
    Deptartment & 2016\\[5pt]
    American University of Beirut, Deptartment of Political Studies and Public 
    Administration & 2016\\[5pt]
    University of Connecticut, Political Economy Workshop & 2015\\ \\
\end{tabularx}

\subsection*{TEACHING EXPERIENCE}

\begin{tabularx}{\linewidth}{@{}Xr@{}}
\textbf{Graduate Courses} & \\
IUPUI, School of Public and Environmental Affairs & \\
    \hspace{1cm}Statistical Analysis for Effective Decision-making (V506) & 
    SP17, FA17\\[5pt]
\textbf{Undergraduate Courses} & \\
Boston University, Metropolitan College \& Prisoner Education Program & \\
    \hspace{1cm}Politics and Philosophy: Theories of Justice (PH155) & 
    SP16\\[5pt]
MIT, Political Science \& Department of Urban Studies and Planning & \\
    \hspace{1cm}Making Public Policy (11.002J / 17.30J) & FA15\\
    \textbf{Graduate Courses} & \\
IUPUI, School of Public and Environmental Affairs & \\
    \hspace{1cm}Statistical Analysis for Effective Decision-making (V506) & 
    SP17, FA17\\[5pt]
\textbf{Undergraduate Courses} & \\
Boston University, Metropolitan College \& Prisoner Education Program & \\
    \hspace{1cm}Politics and Philosophy: Theories of Justice (PH155) & 
    SP16\\[5pt]
MIT, Political Science \& Department of Urban Studies and Planning & \\
    \hspace{1cm}Making Public Policy (11.002J / 17.30J) & FA15\\
\end{tabularx}

\end{document}

enter image description here


The following MWE includes an alternative using the tabu and longtabu environments from the tabu package:

\documentclass[11pt]{article}

\usepackage[top=1in,bottom=0.75in,left=1in,right=1in]{geometry}
\geometry{letterpaper,portrait}
\usepackage[none]{hyphenat}

\usepackage{longtable}
\usepackage{tabu}

\setlength{\parindent}{0pt}
\setlength\columnsep{20pt}



\begin{document}

\subsection*{EDUCATION}
\begin{tabu}to \textwidth{@{} Xr @{}}
  PhD---Political Science and Public Policy, Wisconsin University & 2014\\[5pt]
  BA---Political Sci., History, Economics, and Near Eastern Cultures, 
  Ohio University & 2007\\ \\
\end{tabu}


\subsection*{ACADEMIC APPOINTMENTS}
\begin{tabu}to \textwidth{@{} Xr @{}}
Assistant Professor---American University, School of Global Affairs \& Policy 
    & 2016--2018\\[5pt]
Lecturer---Boston University, Metropolitan College 
    & 2016\\[5pt]
Lecturer---Massachusetts Institute of Technology, Political Science Department 
    & 2015\\ \\
\end{tabu}

\subsection*{PUBLICATIONS}
\hangindent=1cm
``Low Socio-Economic Status Favor Redistribution.'' In Todd K. Shackelford and 
Viviana A. Weekes-Shackelford (eds.), \textit{Encyclopedia of Evolutionary 
Psychological Science}, Springer. 2017.\vspace{5pt}

\hangindent=1cm
``Externalities.'' In Todd K. Shackelford and Viviana A. Weekes-Shackelford 
(eds.), \textit{Encyclopedia of Evolutionary Psychological Science}, Springer. 
With UWK. 2017.\vspace{5pt}

\hangindent=1cm
``Earning Our Place, More or Less: Responsibility's Uncertain Relationship with 
Desert.'' Under review.\\


\subsection*{INVITED TALKS}
\begin{tabu}to \textwidth{@{} Xr @{}}
    Leiden University, Political Science Department & 2017\\[5pt]
    John Cabot University, Political Science and International Affairs 
    Deptartment & 2016\\[5pt]
    American University of Beirut, Deptartment of Political Studies and Public 
    Administration & 2016\\[5pt]
    University of Connecticut, Political Economy Workshop & 2015\\ \\
\end{tabu}

\subsection*{TEACHING EXPERIENCE}

\begin{longtabu}to \textwidth{@{} Xr @{}}
\textbf{Graduate Courses} & \\
IUPUI, School of Public and Environmental Affairs & \\
    \hspace{1cm}Statistical Analysis for Effective Decision-making (V506) & 
    SP17, FA17\\[5pt]
\textbf{Undergraduate Courses} & \\
Boston University, Metropolitan College \& Prisoner Education Program & \\
    \hspace{1cm}Politics and Philosophy: Theories of Justice (PH155) & 
    SP16\\[5pt]
MIT, Political Science \& Department of Urban Studies and Planning & \\
    \hspace{1cm}Making Public Policy (11.002J / 17.30J) & FA15\\
    \textbf{Graduate Courses} & \\
IUPUI, School of Public and Environmental Affairs & \\
    \hspace{1cm}Statistical Analysis for Effective Decision-making (V506) & 
    SP17, FA17\\[5pt]
\textbf{Undergraduate Courses} & \\
Boston University, Metropolitan College \& Prisoner Education Program & \\
    \hspace{1cm}Politics and Philosophy: Theories of Justice (PH155) & 
    SP16\\[5pt]
MIT, Political Science \& Department of Urban Studies and Planning & \\
    \hspace{1cm}Making Public Policy (11.002J / 17.30J) & FA15\\
\end{longtabu}

\end{document}

The ouput of this MWE is very similar to the first one.

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.