表格中的文本换行/文本超出页边距

表格中的文本换行/文本超出页边距

我想知道如何在表格中换行文本,以及如何使文本不超出文档页面。以下是我迄今为止编写的代码。

我正在尝试将文本换行到“相关课程”下,并防止文本超出文档范围。此外,“伊利诺伊州芝加哥,预计 2020 年 6 月”完全超出了页面范围。我该如何解决这个问题?我在下面提供了 pdf 的屏幕截图。

https://i.stack.imgur.com/kfULg.jpg

代码:

\documentclass[letterpaper,10pt]{article}

\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[pdftex]{hyperref}
% or \usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
%\usepackage[english]{babel}

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.375in} % -.5in
\addtolength{\evensidemargin}{-0.375in} % -0.5in
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}

\urlstyle{same}

\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large}{}{0em}{}[\color{black}\titlerule          \vspace{-5pt}]

%-------------------------
% Custom commands
\newcommand{\resumeItem}[2]{
\item\small{
\textbf{#1}{: #2 \vspace{-2pt}}
}
}

\newcommand{\resumeSubheadingEd}[6]{
\vspace{-1pt}\item
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
    \textbf{#1} & #2 \\
    \textit{\small#3} & \textit{\small #4} \\
    \textbf{\small#5} \small#6  
\end{tabular*}\vspace{-5pt}
}

\newcommand{\resumeSubheading}[4]{
\vspace{-1pt}\item
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
  \textbf{#1} & #2 \\
  \textit{\small#3} & \textit{\small #4} \\
\end{tabular*}\vspace{-5pt}
}

\newcommand{\resumeSubItem}[2]{\resumeItem{#1}{#2}\vspace{-4pt}}

\renewcommand{\labelitemii}{$\circ$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=*]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}

%-------------------------------------------
%%%%%%  CV STARTS HERE  %%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

%----------HEADING-----------------
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}
\textbf{\href{}{\Huge John J. Doe}} & Email :   \href{mailto:[email protected]}{[email protected]}\\
\href{}{} & Mobile : +1-312-xxx-xxxx \\
\href{}{} & Address : xxx x xxxxx xxxxx \\
\href{}{} & Chicago, IL. 60601
\end{tabular*}


%-----------EDUCATION-----------------
\section{Education}
\resumeSubHeadingListStart
\resumeSubheadingEd
  {University of Chicago}{Chicago, IL}{Master of Science in Computer Science,  GPA: 3.8 / 4.0}{Expected June 2020}{Relevant Coursework:}{Machine Learning, Data Management Systems, Data Mining, Build and Implement Financial Engines, Regression Analysis, Time Series Analysis, Quantitative Analysis}

\resumeSubheadingEd
  {Booth Graduate School of Business – University of Chicago}{Chicago, IL}{M.B.A in Finance,  GPA: 3.9 / 4.0}{Graduated June 2018}{}

\resumeSubheading
  {Northwestern University}{Chicago, IL}
  {Bachelor of Science in Finance, GPA: 3.9 / 4.0}{Graduated August 2015}

\resumeSubHeadingListEnd


%-------------------------------------------
\end{document}

答案1

使用 p 列而不是 l 列将允许列的内容换行:

\documentclass[letterpaper,10pt]{article}

\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[pdftex]{hyperref}
% or \usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
%\usepackage[english]{babel}

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Adjust margins
\addtolength{\oddsidemargin}{-0.375in} % -.5in
\addtolength{\evensidemargin}{-0.375in} % -0.5in
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}

\urlstyle{same}

\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}

% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large}{}{0em}{}[\color{black}\titlerule          \vspace{-5pt}]

%-------------------------
% Custom commands
\newcommand{\resumeItem}[2]{
\item\small{
\textbf{#1}{: #2 \vspace{-2pt}}
}
}

\newcommand{\resumeSubheadingEd}[6]{
\vspace{-1pt}\item
\begin{tabular*}{0.97\textwidth}{p{0.8\linewidth}@{\extracolsep{\fill}}r}
    \textbf{#1} & #2 \\
    \textit{\small#3} & \textit{\small #4} \\
    \textbf{\small#5} \small#6  
\end{tabular*}\vspace{-5pt}
}

\newcommand{\resumeSubheading}[4]{
\vspace{-1pt}\item
\begin{tabular*}{0.97\textwidth}{l@{\extracolsep{\fill}}r}
  \textbf{#1} & #2 \\
  \textit{\small#3} & \textit{\small #4} \\
\end{tabular*}\vspace{-5pt}
}

\newcommand{\resumeSubItem}[2]{\resumeItem{#1}{#2}\vspace{-4pt}}

\renewcommand{\labelitemii}{$\circ$}

\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=*]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}

%-------------------------------------------
%%%%%%  CV STARTS HERE  %%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

%----------HEADING-----------------
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}
\textbf{\href{}{\Huge John J. Doe}} & Email :   \href{mailto:[email protected]}{[email protected]}\\
\href{}{} & Mobile : +1-312-xxx-xxxx \\
\href{}{} & Address : xxx x xxxxx xxxxx \\
\href{}{} & Chicago, IL. 60601
\end{tabular*}


%-----------EDUCATION-----------------
\section{Education}
\resumeSubHeadingListStart
\resumeSubheadingEd
  {University of Chicago}{Chicago, IL}{Master of Science in Computer Science,  GPA: 3.8 / 4.0}{Expected June 2020}{Relevant Coursework:}{Machine Learning, Data Management Systems, Data Mining, Build and Implement Financial Engines, Regression Analysis, Time Series Analysis, Quantitative Analysis}

\resumeSubheadingEd
  {Booth Graduate School of Business – University of Chicago}{Chicago, IL}{M.B.A in Finance,  GPA: 3.9 / 4.0}{Graduated June 2018}{}

\resumeSubheading
  {Northwestern University}{Chicago, IL}
  {Bachelor of Science in Finance, GPA: 3.9 / 4.0}{Graduated August 2015}

\resumeSubHeadingListEnd


%-------------------------------------------
\end{document}

在此处输入图片描述

相关内容