我正在\colorbox
为我的简历做准备,并且非常喜欢我为文档创建样式的方式。
无论如何,我试图将文本居中对齐,但无法使用命令实现\centering
,如果我使用\begin{center}
对齐文本,\colorbox
宽度会增加两倍,这是我不想要的。
\newcommand \reshead [1]{\par \noindent \colorbox{black}{\begin{minipage}
{\textwidth}{\color{white} \centering \bfseries {#1}} \hfill \end{minipage}}}
除了这个问题,我希望我的简历看起来像这样,顶行的长度应该比\colorbox
但是,我的代码是相同的,有什么方法可以\colorbox
进一步扩展吗? -
%% (c) Shashwat Pant
%% Resume - C.V of Shashwat Pant
%% September 17th 2012
\documentclass[letterpaper,12pt]{article}
%\usepackage[charter]{mathdesign}
% \usepackage{charter}
% \usepackage{mathpazo}
%\usepackage{kpfonts}
%\usepackage{geometry}
\usepackage{palatino}
\usepackage{url}
\usepackage[empty]{fullpage}
\usepackage{color}
%\definecolor{mygrey}{gray}{0.95}
%\usepackage{xcolor}
\newcommand \reshead [1]{\par \noindent \colorbox{black}{\begin{minipage}{\textwidth}{ \color{white} \centering \bfseries {#1}} \hfill \end{minipage}}}
\begin{document}
\begin{center}
\bfseries {\huge {Shashwat Pant}} \\
\bfseries E-Mail - [email protected] ~ Voice -
\hrule \hrule
\end{center}
\noindent Seeking a challenging career to gain experience in rich evolving computing in the areas of :
\begin{itemize}
\item
\item Parallel and Vector computing (Open CL)
\end{itemize}
\reshead{Professional Profile}
\end{document}
使用我的代码,输出如下所示
有没有办法将colorbox
底层文本稍微向左拉伸以使其不对称?
答案1
您可以使用以下选项:
\documentclass[letterpaper,12pt]{article}
\usepackage[empty]{fullpage}% http://ctan.org/pkg/fullpage
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{changepage}% http://ctan.org/pkg/changepage
\newcommand\reshead[1]{%
\par\noindent%
\colorbox{black}{\makebox[\dimexpr\linewidth-2\fboxrule-2\fboxsep][c]{\textcolor{white}{\bfseries #1}}}}
\begin{document}
\begin{adjustwidth}{2em}{2em}
\begin{center}
\bfseries
{\huge Shashwat Pant} \\
E-Mail - [email protected] ~ Voice - \\
\end{center}
\noindent\hspace*{-1em}\rule{\dimexpr\linewidth+2em}{2pt}
\noindent Seeking a challenging career to gain experience in rich evolving computing in the areas of :
\begin{itemize}
\item
\item Parallel and Vector computing (Open CL)
\end{itemize}
\end{adjustwidth}
\bigskip
\reshead{Professional Profile}
\end{document}
我做了一些改变:
- 不要使用 ,而
\hrule\hrule
要使用指定的规则宽度:\rule{\dimexpr\linewidth-2em}{2pt}
。随着水平移动,此规则在两侧悬垂1em
; - 添加
chngpage
adjustwidth
为本地修改边距提供了环境; - 用来
\makebox
代替minipage
指定你的 的内容\reshead
。还更新了宽度以固定在边距内确切地(\linewidth-2\fboxrule-2\fboxsep
)。
答案2
我不会延伸\colorbox
,但会减少最重要的规则:
%% (c) Shashwat Pant
%% Resume - C.V of Shashwat Pant
%% September 17th 2012
\documentclass[letterpaper,12pt]{article}
%\usepackage[charter]{mathdesign}
% \usepackage{charter}
% \usepackage{mathpazo}
%\usepackage{kpfonts}
%\usepackage{geometry}
\usepackage{palatino}
\usepackage{url}
\usepackage[empty]{fullpage}
\usepackage{color}
%\definecolor{mygrey}{gray}{0.95}
%\usepackage{xcolor}
\newcommand\reshead[1]{%
\par\noindent
\colorbox{black}{%
\begin{minipage}{\dimexpr\textwidth-2\fboxsep\relax}
\color{white}\centering\bfseries#1
\end{minipage}%
}%
}
\begin{document}
\begin{center}
\bfseries
{\huge Shashwat Pant} \\[1ex]
E-Mail - [email protected] ~ Voice -
% Here I reduce the rule by 1in on both sides (adjust to suit)
% The rule thickness is 1pt; it's 2pt from the bottom of the text above it
\nointerlineskip
\moveright 1in \vbox{\hsize=\dimexpr\hsize - 2in \relax
\vskip 2pt % separation from the text above
\hrule width \hsize height 1pt % rule thickness
}
\end{center}
\noindent Seeking a challenging career to gain experience
in rich evolving computing in the areas of:
\begin{itemize}
\item \LaTeX
\item Parallel and Vector computing (Open CL)
\end{itemize}
\reshead{Professional Profile}
\end{document}
您必须稍微减少 的宽度minipage
,否则\colorbox
会太宽并溢出到右侧:这是 的目的
\dimexpr\textwidth-2\fboxsep\relax
这个\moveright
技巧比较低级,但偶尔还是很有用的。:)