我该如何修复“出生地”部分以使其位于同一行?
\documentclass[paper=a4,fontsize=11pt]{scrartcl} % KOMA-article class
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{graphicx} % Enable pdflatex
\usepackage[svgnames]{xcolor} % Colors by their 'svgnames'
\usepackage{geometry}
\textheight=700px % Saving trees ;-)
\usepackage{url}
\frenchspacing % Better looking spacings after periods
\pagestyle{empty} % No pagenumbers/headers/footers
%%% Custom sectioning (sectsty package)
%%% ------------------------------------------------------------
\usepackage{sectsty}
\sectionfont{% % Change font of \section command
\usefont{OT1}{phv}{b}{n}% % bch-b-n: CharterBT-Bold font
\sectionrule{0pt}{0pt}{-5pt}{3pt}}
%%% Macros
%%% ------------------------------------------------------------
\newlength{\spacebox}
\settowidth{\spacebox}{8888888888} % Box to align text
\newcommand{\sepspace}{\vspace*{1em}} % Vertical space macro
\newcommand{\MyName}[1]{ % Name
\Huge \usefont{OT1}{phv}{b}{n} \hfill #1
\par \normalsize \normalfont}
\newcommand{\MySlogan}[1]{ % Slogan (optional)
\large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1}
\par \normalsize \normalfont}
\newcommand{\NewPart}[1]{\section*{\uppercase{#1}}}
\newcommand{\PersonalEntry}[2]{
\noindent\hangindent=2em\hangafter=0 % Indentation
\parbox{\spacebox}{ % Box to align text
\textit{#1}} % Entry name (birth, address, etc.)
\hspace{1.5em} #2 \par} % Entry value
\newcommand{\SkillsEntry}[2]{ % Same as \PersonalEntry
\noindent\hangindent=2em\hangafter=0 % Indentation
\parbox{\spacebox}{ % Box to align text
\textit{#1}} % Entry name (birth, address, etc.)
\hspace{1.5em} #2 \par} % Entry value
\newcommand{\EducationEntry}[4]{
\noindent \textbf{#1} \hfill % Study
\colorbox{Black}{%
\parbox{6em}{%
\hfill\color{White}#2}} \par % Duration
\noindent \textit{#3} \par % School
\noindent\hangindent=2em\hangafter=0 \small #4 % Description
\normalsize \par}
\newcommand{\WorkEntry}[4]{ % Same as \EducationEntry
\noindent \textbf{#1} \hfill % Jobname
\colorbox{Black}{\color{White}#2} \par % Duration
\noindent \textit{#3} \par % Company
\noindent\hangindent=2em\hangafter=0 \small #4 % Description
\normalsize \par}
%%% Begin Document
%%% ------------------------------------------------------------
\begin{document}
% you can upload a photo and include it here...
%\begin{wrapfigure}{l}{0.5\textwidth}
% \vspace*{-2em}
% \includegraphics[width=0.15\textwidth]{photo}
%\end{wrapfigure}
\MyName{Your Name}
\MySlogan{Curriculum Vitae}
\sepspace
%%% Personal details
%%% ------------------------------------------------------------
\NewPart{Personal details}{}
\PersonalEntry{Place of Birth}{January 1, 1980}
\PersonalEntry{Address}{111 First St, New York}
\PersonalEntry{Phone}{(123) 000-0000}
\PersonalEntry{Mail}{\url{[email protected]}}
\end{document}
答案1
正如您在 的定义中所看到的\PersonalEntry
,名为 的框\spacebox
用于\PersonalEntry
命令的第一个参数。其宽度最初定义为\settowidth{\spacebox}{8888888888}
。“出生地”被分成两行,因为它比“8888888888”宽。为了解决这个问题,您只需将“8888888888”替换为“出生地”或您可能想要添加的任何不同的更长的条目。
\documentclass{scrartcl}
\newlength{\spacebox}
\settowidth{\spacebox}{Place of Birth} % Box to align text
\newcommand{\sepspace}{\vspace*{1em}} % Vertical space macro
\newcommand{\PersonalEntry}[2]{
\noindent\hangindent=2em\hangafter=0 % Indentation
\parbox{\spacebox}{ % Box to align text
\textit{#1}} % Entry name (birth, address, etc.)
\hspace{1.5em} #2 \par} % Entry value
\begin{document}
\PersonalEntry{Place of Birth}{January 1, 1980}
\PersonalEntry{Address}{111 First St, New York}
\end{document}