无法使表格彼此对齐或调整文本宽度

无法使表格彼此对齐或调整文本宽度

我无法让表格以这样的方式显示:最左边的元素和最右边的元素出现在文档文本宽度的开始和结束处。不仅最右边的文本在相同的表格环境中不会以相同的位置结束(例如,参见下面的“教育”和“教学经验”部分,前者使用tabular,后者使用longtable),而且在相同的表格环境中也不会以相同的位置结束(例如,参见下面的“教育”和“学术任命”部分,两者都使用tabular)。并且没有一个表格以与“出版物”部分中的正常段落文本相同的位置结束。

提前为冗长的例子道歉。我想提供几个例子来说明它们之间的细微差异。此外,当谈到 的代码时longtable,这个问题可能与提出的问题密切相关这里,它处理与该包相关的奇怪缩进。当我能够让 longtable 结束在页面右侧我想要的位置时,它总是会在左侧创建一个缩进。

感谢您提供的任何帮助,如果其中有任何不清楚的地方,请谅解。

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

表格环境的右对齐彼此不一致,也与 longtable 输出不一致

最右边的文本落在垂直线的两侧,而不是与垂直线对齐。

答案1

以下 MWE 显示了如何使用tabularxltablex来实现跨整个文本宽度(由黑线表示)的均匀宽度表格。为了使tabularx跨页面拆分的也跨整个文本宽度,您必须添加\keepXColumns到前言中。

来自ltablex手动的

已添加的另一个功能是,如果表格内容允许这样做且不超过表格的指定宽度,X则将列视为l 列。换句话说,指定的宽度被视为允许的最大值,而不是表格的确切宽度。此功能是默认功能,但可以使用 (或 )禁用(或\keepXColumns启用\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}

在此处输入图片描述


以下 MWE 包含使用包中的tabulongtabu环境的替代方案tabu

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

这个 MWE 的输出与第一个非常相似。

相关内容