我一直在尝试用 latex 创建带有灰色侧边栏的简历,该侧边栏横跨多页。在第一页,我希望它稍微宽一点(约 0.3 倍侧边宽度),里面有文字;在其他页面上,我希望它是空的,宽度约为 0.1 倍侧边宽度。
这是我尝试过的(见下文),但似乎不起作用。此外,我收到无法找到文件的错误tcbskins.code.tex
。如果我注释掉那部分,我会遇到颜色框增强选项的问题。
任何帮助将非常感激!
========================================================================
\documentclass[11pt]{article}
\usepackage{array}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{calc}
\usepackage[breakable,skins]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix}
\usepackage{titlesec}
% define length
\newlength\cvmargin
\setlength\cvmargin{1cm}
% define more lengths
\newlength\cvsidewidth
\setlength\cvsidewidth{0.3\paperwidth}
\newlength\cvmainwidth
\setlength\cvmainwidth{\paperwidth-\cvsidewidth-4\cvmargin}
%Change titles part CV
\titleformat{\section}
{\color{blue}\normalfont\Large\bfseries}
{\color{blue}\thesection}{1em}{}
\definecolor{lightgray}{gray}{0.8}
\newtcolorbox{minipageside}{colback=lightgray,breakable,boxsep=\cvmargin,boxrule=0pt,width=\cvsidewidth+2\cvmargin,height=\paperheight,enhanced,spread inwards,arc=0mm}
\newtcolorbox{minipagemain}{breakable,boxsep=0pt,boxrule=0pt,width=\cvmainwidth,arc=0mm}
% set a4paper width minimal options
\usepackage[margin=\cvmargin,noheadfoot,a4paper]{geometry}
%Define inside CV
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}
\definecolor{blue}{RGB}{65,105,225}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Contents sidebar %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{\fill}
\begin{minipageside}
% contents
\section*{\huge{Name}}
email \\
\vspace{1em}
\textit{Institution}\\
Address \\
Address
\section*{Research Interest}
\begin{itemize}
\item Item 1
\item 2
\item 3
\item 4
\end{itemize}
\end{minipageside}%
\vspace*{\fill}
\hspace{\cvmargin}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Rest of the CV %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{minipagemain}
\section*{Research positions}
\begin{tabular}{L!{\VRule}R}
2017--today & {\bf Postdoctoral researcher }
\end{tabular}
\vspace{1em}
\section*{Education}
\begin{tabular}{L!{\VRule}R}
2012--2017 & PhD in Theoretical Physics \\
& \begin{tabular}{ll}
Thesis & Title\\
Advisor & Professor X
\end{tabular} \\[5pt]
2010--2012 & MSc \\
& \begin{tabular}{ll}
Thesis & Title \\
Advisor & Professor Y
\end{tabular} \\[5pt]
2009 & Exchange, University \\ [5pt]
2007-2010 & BSc
\end{tabular}
\vspace{1em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{plain}
\nobibliography{publication}
\section*{Publications}
\subsection*{Refereed publications in physics journals}
\subsection*{Other publications}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{References}
Prof X \\
Prof Y \\
Prof Z
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Invited seminar presentations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Conferences \& workshops}
\subsection*{Invited presentations}
\subsection*{Contributed presentations}
\subsection*{Attended conferences}
\subsection*{Schools}
\subsection*{Professional development conferences}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Teaching experience}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Awards}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Fellowships \& grants}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Referee services}
Refereed for ....
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Services}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Outreach \& diversity}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{minipagemain}
\end{document}
答案1
这只是一个提议。
我理解您希望将所有页面分为两个垂直部分,即左侧边栏和正文。并且您希望侧边栏具有两种不同的宽度,用于首页和其他页面。
我建议使用paracol
包来进行这些垂直划分。您可以使用\columnratio
参数来控制两个部分的相对宽度。
该提案的主要缺点是您必须控制首页中包含的内容以及首页之后的内容。据我所知,无法更改不同部分的宽度,tcolorbox
因此您需要手动进行更改。
以下代码显示了一个示例,“首页”使用一个\columnratio{.3}
,其他页面将其固定为 0.2。请根据您的喜好进行更改。之后,首页由一个tcolorbox
占据整个文本高度的文本和右侧的一些文本组成。您必须进行一些试验才能确定此页面中显示的内容。对于第二页及以后的页面,由于左侧tcolorbox
是可拆分的,因此您不必担心页面拆分。
\documentclass[11pt]{article}
\usepackage{array}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{calc}
\usepackage[most]{tcolorbox}
\usepackage{paracol}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix}
\usepackage{titlesec}
% define length
\newlength\cvmargin
\setlength\cvmargin{1cm}
% define more lengths
\newlength\cvsidewidth
\setlength\cvsidewidth{0.3\paperwidth}
\newlength\cvmainwidth
\setlength\cvmainwidth{\paperwidth-\cvsidewidth-4\cvmargin}
%Change titles part CV
\titleformat{\section}
{\color{blue}\normalfont\Large\bfseries}
{\color{blue}\thesection}{1em}{}
\definecolor{lightgray}{gray}{0.8}
\newtcolorbox{minipageside}{colback=lightgray,breakable,boxsep=\cvmargin,boxrule=0pt,width=\cvsidewidth+2\cvmargin,height=\paperheight,enhanced,spread inwards,arc=0mm}
\newtcolorbox{minipagemain}{breakable,boxsep=0pt,boxrule=0pt,width=\cvmainwidth,arc=0mm}
% set a4paper width minimal options
\usepackage[margin=\cvmargin,noheadfoot,a4paper]{geometry}
%Define inside CV
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}
\definecolor{blue}{RGB}{65,105,225}
\begin{document}
%Front page
\columnratio{.3}
\begin{paracol}{2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Contents sidebar %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tcolorbox}[colback=lightgray, height=\textheight]
\section*{\huge{Name}}
email \\
\vspace{1em}
\textit{Institution}\\
Address \\
Address
\section*{Research Interest}
\begin{itemize}
\item Item 1
\item 2
\item 3
\item 4
\end{itemize}
\end{tcolorbox}
\switchcolumn %<--------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% Rest of the CV %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Research positions}
\begin{tabular}{L!{\VRule}R}
2017--today & {\bf Postdoctoral researcher }
\end{tabular}
\vspace{1em}
\section*{Education}
\begin{tabular}{L!{\VRule}R}
2012--2017 & PhD in Theoretical Physics \\
& \begin{tabular}{ll}
Thesis & Title\\
Advisor & Professor X
\end{tabular} \\[5pt]
2010--2012 & MSc \\
& \begin{tabular}{ll}
Thesis & Title \\
Advisor & Professor Y
\end{tabular} \\[5pt]
2009 & Exchange, University \\ [5pt]
2007-2010 & BSc
\end{tabular}
\vspace{1em}
\bibliographystyle{plain}
\nobibliography{publication}
\section*{Publications}
\subsection*{Refereed publications in physics journals}
\subsection*{Other publications}
\section*{References}
Prof X \\
Prof Y \\
Prof Z
\section*{Invited seminar presentations}
\section*{Conferences \& workshops}
\subsection*{Invited presentations}
\subsection*{Contributed presentations}
\subsection*{Attended conferences}
\subsection*{Schools}
\subsection*{Professional development conferences}
\section*{Teaching experience}
\section*{Awards}
\section*{Fellowships \& grants}
\section*{Referee services}
Refereed for ....
\section*{Services}
\section*{Outreach \& diversity}
\end{paracol}
%%%% End of front page
%%% Second page and ...
\columnratio{.2}
\begin{paracol}{2}
%Gray margin column, breakable
\begin{tcolorbox}[enhanced, breakable, colback=lightgray]
\lipsum[1-2]
\end{tcolorbox}
\switchcolumn %<----------
% Main contents of second and further pages
\lipsum[1-10]
\end{paracol}
\end{document}