使用 geometry 和 tcolorbox 包并排堆叠框

使用 geometry 和 tcolorbox 包并排堆叠框

我一直在使用 tcolorbox 和 geometry 包编辑简历,我想将两个框并排堆叠在顶部框下方,但当我运行代码时,顶部框单独位于第一页的顶部,后面两个框开始第二页,甚至不并排堆叠:第二个框位于第三个框上方,而第三个框甚至不显示全部内容。可能是什么问题?

下面是代码:

\documentclass[11pt, oneside, a4paper, titlepage]{article}

\usepackage{tcolorbox}

\usepackage{geometry}
\geometry{
  a4paper, 
  left=0.1cm,
  right=0.1cm,
  top=0.1cm,
  bottom=0.1cm
}

\definecolor{titleBack}{RGB}{0,70,21}

\title{Pablo CV}
\date{\today}

\begin{document}
\tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}

 \begin{tcolorbox}
   \begin{minipage}{4.0cm}
     \hspace*{-0.3cm}\includegraphics[width=4cm]{me12.jpg}
   \end{minipage}
     \begin{minipage}{15cm}
    \begin{center}
      \Huge{\textcolor{white}{Pablo}} \\
      \vspace*{0.5cm}
      \Large{\textcolor{white}{\emph{Electrical Engineer}}}
    \end{center}  
     \end{minipage}
 \end{tcolorbox} 
 
 \tcbset{colframe=white,colback=white,arc=0mm}
 
  \begin{tcolorbox}
    \begin{minipage}[t]{8cm}
      \vspace*{-0.5cm}
      \begin{tcolorbox}[grow to left by=0.6cm,colback=gray!25,colframe=white]
      
  \section*{Profile}
  Introductory profile....
  
  \section*{Contact}
  \begin{tabular}{r l}
    Tel: & +00 000 000 0000 \\
    Home: & +00 000 000 0000 \\
    Email: & [email protected] 
    
  \end{tabular}
  
  \section*{Expertise}
  \begin{itemize}
    \item{Item one}
    \item{Item Two}
    \item{Item Three}
    \item{Item Four}
    \item{Item Five}
    \item{Item Six}
    \item{Item Seven}
    \item{Item Eight}
  \end{itemize}
  
  \section*{Interests}
  \begin{itemize}
    \item{Item 1 (Details)}
    \item{Item 2}
    \item{Item 3}
  \end{itemize}                      
  \end{tcolorbox}  
\end{minipage} \\

\begin{minipage}[t]{11cm}
  \vspace*{-0.5cm}
  \begin{tcolorbox}[grow to right by=0.75cm, colframe=white, colback=white]
    \section*{Education}
      \begin{itemize}
        \item
        {
          \textbf{Most Recent School} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }
        \item
        {
          \textbf{School 2} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 3} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 4} \\
          \emph{Degree} \\
          \emph{Date - Date}
        } 
      \end{itemize}
      
      \section*{Experience}
      \begin{itemize}
        \item
        {
          \textbf{Work 1} \\
          \emph{Position} \\
          \emph{Date - NOW} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 2} \\
          \emph{Position} \\
          \emph{Date - Date} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 3} \\
          \emph{Position} \\
          \emph{Date - Date}\\
          \emph{Work details}
        }
      \end{itemize}
      
      \section*{Professional Trainings}
      \begin{itemize}
        \item
        {
          \textbf{Training Institution 1} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        \item
        {
          \textbf{Training Institution 2} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        
      \end{itemize}
  \end{tcolorbox}

\end{minipage}
  \end{tcolorbox}
\end{document}

答案1

minipages我认为,与inside相比tcolorboxes,固定宽度更好tcolorbox。使用 options nobeforeafterbox align=top并且第二和第三个框之间没有空行,可以完成以下工作:

\documentclass[11pt, oneside, a4paper, titlepage]{article}

\usepackage{tcolorbox}

\usepackage{geometry}
\geometry{
  a4paper, 
  left=0.1cm,
  right=0.1cm,
  top=0.1cm,
  bottom=0.1cm
}

\definecolor{titleBack}{RGB}{0,70,21}

\title{Pablo CV}
\date{\today}

\begin{document}
\tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}

 \begin{tcolorbox}
   \begin{minipage}{4.0cm}
     \hspace*{-0.3cm}\includegraphics[width=4cm]{example-image-a}
   \end{minipage}
     \begin{minipage}{15cm}
    \begin{center}
      \Huge{\textcolor{white}{Pablo}} \\
      \vspace*{0.5cm}
      \Large{\textcolor{white}{\emph{Electrical Engineer}}}
    \end{center}  
     \end{minipage}
 \end{tcolorbox} 
 
 \tcbset{colframe=white,colback=white,arc=0mm, nobeforeafter, box align=top}
 
  \noindent\begin{tcolorbox}[width=8cm,colback=gray!25,colframe=white]
   
  \section*{Profile}
  Introductory profile....
  
  \section*{Contact}
  \begin{tabular}{r l}
    Tel: & +00 000 000 0000 \\
    Home: & +00 000 000 0000 \\
    Email: & [email protected] 
    
  \end{tabular}
  
  \section*{Expertise}
  \begin{itemize}
    \item{Item one}
    \item{Item Two}
    \item{Item Three}
    \item{Item Four}
    \item{Item Five}
    \item{Item Six}
    \item{Item Seven}
    \item{Item Eight}
  \end{itemize}
  
  \section*{Interests}
  \begin{itemize}
    \item{Item 1 (Details)}
    \item{Item 2}
    \item{Item 3}
  \end{itemize}                      
  \end{tcolorbox}  
%
 \begin{tcolorbox}[grow to right by=0.75cm, colframe=white, colback=white]
    \section*{Education}
      \begin{itemize}
        \item
        {
          \textbf{Most Recent School} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }
        \item
        {
          \textbf{School 2} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 3} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 4} \\
          \emph{Degree} \\
          \emph{Date - Date}
        } 
      \end{itemize}
      
      \section*{Experience}
      \begin{itemize}
        \item
        {
          \textbf{Work 1} \\
          \emph{Position} \\
          \emph{Date - NOW} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 2} \\
          \emph{Position} \\
          \emph{Date - Date} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 3} \\
          \emph{Position} \\
          \emph{Date - Date}\\
          \emph{Work details}
        }
      \end{itemize}
      
      \section*{Professional Trainings}
      \begin{itemize}
        \item
        {
          \textbf{Training Institution 1} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        \item
        {
          \textbf{Training Institution 2} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        
      \end{itemize}
%  \end{tcolorbox}
%
%\end{minipage}
  \end{tcolorbox}
\end{document}

在此处输入图片描述

答案2

在此处输入图片描述

\documentclass[11pt, oneside, a4paper, titlepage]{article}

\usepackage{tcolorbox}

\usepackage{geometry}
\geometry{
  a4paper, 
  left=0.1cm,
  right=0.1cm,
  top=0.1cm,
  bottom=0.1cm
}

\definecolor{titleBack}{RGB}{0,70,21}

\title{Pablo CV}
\date{\today}
\usepackage{graphicx}
\usepackage[allfiguresdraft]{draftfigure}

\begin{document}
\tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}

 \begin{tcolorbox}
   \begin{minipage}{4.0cm}
     \hspace*{-0.3cm}\includegraphics[width=4cm]{me12.jpg}
   \end{minipage}
     \begin{minipage}{15cm}
    \begin{center}
      \Huge{\textcolor{white}{Pablo}} \\
      \vspace*{0.5cm}
      \Large{\textcolor{white}{\emph{Electrical Engineer}}}
    \end{center}  
     \end{minipage}
 \end{tcolorbox} 
 
 \tcbset{colframe=white,colback=white,arc=0mm}
 
%  \begin{tcolorbox}
    \begin{minipage}[t]{8cm}
      \vspace*{-0.5cm}
      \begin{tcolorbox}[grow to left by=0.6cm,colback=gray!25,colframe=white]
      
  \section*{Profile}
  Introductory profile....
  
  \section*{Contact}
  \begin{tabular}{r l}
    Tel: & +00 000 000 0000 \\
    Home: & +00 000 000 0000 \\
    Email: & [email protected] 
    
  \end{tabular}
  
  \section*{Expertise}
  \begin{itemize}
    \item{Item one}
    \item{Item Two}
    \item{Item Three}
    \item{Item Four}
    \item{Item Five}
    \item{Item Six}
    \item{Item Seven}
    \item{Item Eight}
  \end{itemize}
  
  \section*{Interests}
  \begin{itemize}
    \item{Item 1 (Details)}
    \item{Item 2}
    \item{Item 3}
  \end{itemize}                      
  \end{tcolorbox}  
\end{minipage}
\begin{minipage}[t]{11cm}
  \vspace*{-0.5cm}
  \begin{tcolorbox}[grow to right by=0.75cm, colframe=white, colback=green!30]
    \section*{Education}
      \begin{itemize}
        \item
        {
          \textbf{Most Recent School} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }
        \item
        {
          \textbf{School 2} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 3} \\
          \emph{Degree} \\
          \emph{Date - Date}
        }   
         \item
        {
          \textbf{School 4} \\
          \emph{Degree} \\
          \emph{Date - Date}
        } 
      \end{itemize}
      
      \section*{Experience}
      \begin{itemize}
        \item
        {
          \textbf{Work 1} \\
          \emph{Position} \\
          \emph{Date - NOW} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 2} \\
          \emph{Position} \\
          \emph{Date - Date} \\
          \emph{Work details}
        }
        
        \item
        {
          \textbf{Work 3} \\
          \emph{Position} \\
          \emph{Date - Date}\\
          \emph{Work details}
        }
      \end{itemize}
      
      \section*{Professional Trainings}
      \begin{itemize}
        \item
        {
          \textbf{Training Institution 1} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        \item
        {
          \textbf{Training Institution 2} \\
          \emph{Topic} \\
          \emph{Date - Date} \\
          Training details
        }
        
      \end{itemize}
  \end{tcolorbox}

\end{minipage}
%  \end{tcolorbox}
\end{document}

相关内容