![在新环境中将部分标题居中](https://linux22.com/image/401823/%E5%9C%A8%E6%96%B0%E7%8E%AF%E5%A2%83%E4%B8%AD%E5%B0%86%E9%83%A8%E5%88%86%E6%A0%87%E9%A2%98%E5%B1%85%E4%B8%AD.png)
我为简历模板的章节定义了一个新环境。我不确定如何在此代码中将章节标题居中。
\newenvironment{rSection}[1]
{
% 1 input argument - section name
\sectionskip
\begingroup
\colorbox{mygrey}
{
{\rlap{\MakeUppercase{\bf #1}}\hspace{\linewidth}\hspace{-2\fboxsep}}
}
\endgroup
\begin{list}{} { \setlength{\leftmargin}{0 em} } \item[] } { \end{list}
}
答案1
尝试像这样使用中心环境:
\begin{center}
Section title
\end{center}
或者像这样命令居中:
\begingroup
\centering
\colorbox{mygrey}
{
{\rlap{\MakeUppercase{\bf #1}}\hspace{\linewidth}\hspace{-2\fboxsep}}
Section title }
....
....