页面内容超出边距

页面内容超出边距

在编写课程时,我遇到了一个问题,即内容超出了定义的边距。下图中的线条表示边距:

边距

(右侧的黑色边框是我的 PDF 查看器超出范围)。

我已经仔细检查过是否没有任何东西定义它的宽度\textwidth或类似的东西可能导致它超出页边距,但没有。可能发生了什么事情导致内容超出页边距?

完整代码:github.com/(...)/cv.tex

答案1

你需要

\newenvironment{aside}{%
\noindent               %% added
\begin{minipage}[t]{0.25\textwidth}%
\begin{flushright}
}{%
\end{flushright}%
\end{minipage}%
}

\newenvironment{main}{%
\noindent
\begin{minipage}[t]{\dimexpr0.75\textwidth-1pt-2em\relax}%   %% modified
}{%
\end{minipage}%
}

\end{aside}%    %% % here is badly needed
%
\hspace{1em}\vrule width1pt\hspace{1em}%  % leave no spaces in between and width1pt make life easier.
\begin{main}%

完整代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage[inline]{enumitem}
\usepackage[a4paper,margin=1in,showframe]{geometry}   %% remove showframe
\usepackage{svg}

\newcommand{\sectiontitle}[1]{\section*{\uppercase{#1}} \hrule \vspace{1em}}
\newcommand{\formationentry}[4]{%
    \noindent \textbf{#1} \hfill
    \colorbox{black}{%
        \parbox[c][1em]{8em}{%
            \hfill \color{white} #2%
        }
    } \par
    \noindent \textit{#3}\par
    \normalsize
    \vspace{1em}
}
\newcommand{\experienceentry}[4]{%
    \noindent \textbf{#1} \hfill
    \colorbox{black}{%
        \parbox[c][1em]{8em}{%
            \hfill \color{white} #2%
        }%
    } \par
    \noindent \textit{#3} \par
    \noindent \hangindent=1.5em \hangafter=0 \small #4 \par
    \normalsize%
    \vspace{1em}%
}
\newcommand{\contactentry}[2]{%
    \parbox{\textwidth}{\hfill #2 \includesvg[height=1em]{#1}}%
}
\newcommand{\languageentry}[2]{%
    \parbox{\textwidth}{\hfill \textbf{#1}\hspace{1em}#2}%
}

\newenvironment{aside}{%
\noindent
\begin{minipage}[t]{0.25\textwidth}%
\begin{flushright}
}{%
\end{flushright}%
\end{minipage}%
}
\newenvironment{main}{%
\noindent
\begin{minipage}[t]{\dimexpr0.75\textwidth-1pt-2em\relax}%
}{%
\end{minipage}%
}

\begin{document}
\fontfamily{lmss} \selectfont

\title{Ranieri Althoff -- Résumé}

\Huge \hfill \textbf{Ranieri Althoff}
\normalsize \par
\vspace{3em}
\pagenumbering{gobble}

\noindent
\begin{aside}
\section*{Contact}
\contactentry{email}{[email protected]}
\contactentry{github}{ranisalt}
\contactentry{twitter}{ranisalt}


\section*{Languages}
\languageentry{Portuguese}{native}
\languageentry{English}{fluent}


\section*{Programming}
\center
\subsection*{\small some thousand lines}
\begin{itemize*}
\item{Python}
\item{PHP}
\item{Shell}
\end{itemize*}

\subsection*{\small just a thousand lines}
\begin{itemize*}
\item{C++}
\item{Coffeescript}
\item{Java}
\item{Javascript}
\end{itemize*}

\subsection*{\small just started learning}
\begin{itemize*}
\item{Haskell}
\item{\LaTeX}
\item{Lua}
\item{Prolog}
\item{Ruby}
\end{itemize*}


\section*{Tools}
\subsection*{\small databases}
\begin{itemize*}
\item{MongoDB}
\item{MySQL}
\item{PostgreSQL}
\item{Redis}
\item{SQLite}
\end{itemize*}

\subsection*{\small frameworks}
\begin{itemize*}
\item{CodeIgniter}
\item{Flask}
\item{Laravel}
\item{Rails}
\end{itemize*}

\subsection*{\small version control}
\begin{itemize*}
\item{Git}
\item{Mercurial}
\end{itemize*}

\subsection*{\small web servers}
\begin{itemize*}
\item{Nginx}
\item{uWSGI}
\end{itemize*}
\end{aside}%
%
\hspace{1em}\vrule\hspace{1em}%
\begin{main}%
\sectiontitle{Academic Formation}
\formationentry{Bachelor in Computer Science}{2013 - now}{Federal University
of Santa Catarina (UFSC)}

\formationentry{Technician in Information Technology}{2010 - 2012}{Federal
Catarinense Institute (IFC)}


\sectiontitle{Professional Experience}
\experienceentry{Scholarship}{4/2014 - now}{Tutorial Education Program (PET) at
UFSC}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam a turpis
nisi. Cras velit tortor, congue eget eleifend non, pellentesque ut eros.
Integer commodo arcu quis orci congue, eget suscipit nulla pulvinar.
Phasellus bibendum tellus sed sapien nullam.}

\experienceentry{Internship}{6/2011 - 11/2012}{LabMat(i)\textsuperscript{2} at
IFC}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam a turpis
nisi. Cras velit tortor, congue eget eleifend non, pellentesque ut eros.
Integer commodo arcu quis orci congue, eget suscipit nulla pulvinar.
Phasellus bibendum tellus sed sapien nullam.}


\sectiontitle{Skills and Interests}


\sectiontitle{Additional Information}


\end{main}%
\end{document}

在此处输入图片描述

您的\newcommands 中有许多虚假空格,并且我添加了许多%符号,请找出差异来找到它们。

答案2

你有

parindent+0.25\textwidth+1em+\space+1em+\space+0.75\textwidth=\textwidth+parndent+2em+2\space > textwidth

尝试像这样重新定义你的环境

编辑:感谢 Harish Kumar 的回答,我添加了 \ignorespaces

    \newenvironment{aside}{\noindent
\begin{minipage}[t]{0.25\textwidth}
\begin{flushright}
}{
\end{flushright}
\end{minipage}\ignorespaces
}
\newenvironment{main}{
\begin{minipage}[t]{\dimexpr.75\textwidth-3em\relax}
}{
\end{minipage}
}

相关内容