在小页面内将图片与文本右侧对齐

在小页面内将图片与文本右侧对齐

我想在迷你页面中显示简历文本中的大学徽标。我无法做到这一点,无论是使用表格还是使用环绕图。但我承认我是新手。在 LaTeX 中应该如何做到这一点?

现在看起来像:

坏的

但我希望它看起来像:

好的

\documentclass[11pt,oneside,a4paper,titlepage]{article}
\usepackage{geometry}
\usepackage[most]{tcolorbox}

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

\definecolor{titleBack}{RGB}{100, 84, 82} % Wenge brown

\begin{document}
    
    \tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}
    \begin{tcolorbox}
        \begin{minipage}{4.5cm}
            %Picture
        \end{minipage}
        \begin{minipage}{15cm}
            \begin{center}
                \Huge{\textcolor{white}{Name}} \\
                \vspace*{0.5cm}
                \Large{\textcolor{white}{Curriculum Vitae}}
            \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!15,colframe=white]
                \section*{Profile}
            \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{
                        \begin{tabular}[!t]{l r}
                            \begin{tabular}[c]{@{}l@{}}\textbf{University of X} \\ \emph{MSc Y} \\ \emph{April, 2024}\end{tabular} & \rule{4ex}{4ex}
                        \end{tabular}
                    
                        Some Text.
                    }
                    \item Another University
                \end{itemize}
            \end{tcolorbox}
        \end{minipage}
    \end{tcolorbox}
\end{document}

答案1

我认为我会使用tcolorboxsidebyside选项,至少在第一个实例中。然后您有minipage未提供的附加对齐选项。不像棺材那么灵活,但更直接,因为您已经在使用tcolorbox

例如,

\documentclass[11pt,oneside,a4paper,titlepage]{article}
\usepackage{geometry}
\usepackage[most]{tcolorbox}
\geometry{
    a4paper,
    left=0.1cm,
    right=0.1cm,
    top=0.1cm,
    bottom=0.1cm
}

\definecolor{titleBack}{RGB}{100, 84, 82} % Wenge brown

\begin{document}

\tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}%
\begin{tcolorbox}
  \begin{minipage}{4.5cm}
    %Picture
  \end{minipage}
  \begin{minipage}{15cm}
    \begin{center}
      \Huge{\textcolor{white}{Name}} \\
      \vspace*{0.5cm}
      \Large{\textcolor{white}{Curriculum Vitae}}
    \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!15,colframe=white]
      \section*{Profile}
    \end{tcolorbox}
  \end{minipage}
  \begin{minipage}[t]{11cm}
    \vspace*{-0.5cm}
    \begin{tcolorbox}[grow to right by=0.75cm,colframe=white,colback=white,sidebyside,sidebyside align=center seam,righthand width=4ex+10pt]% adjust width as required for image and/or use width=\linewidth for \includegraphics
      \section*{Education}
      \begin{itemize}
        \item{
            \begin{tabular}[c]{@{}l@{}}\textbf{University of X} \\ \emph{MSc Y} \\ \emph{April, 2024}\end{tabular} 
          
          Some Text.
        }
        \item Another University
      \end{itemize}
      \tcblower
      \rule{4ex}{4ex}
      
    \end{tcolorbox}
  \end{minipage}
\end{tcolorbox}
\end{document}

编辑

tabularx这是一个可能更适合大学排的版本。

\documentclass[11pt,oneside,a4paper,titlepage]{article}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{array,tabularx}
% \usepackage{kantlipsum}
\usepackage[most]{tcolorbox}
\geometry{
    a4paper,
    left=0.1cm,
    right=0.1cm,
    top=0.1cm,
    bottom=0.1cm
}

\definecolor{titleBack}{RGB}{100, 84, 82} % Wenge brown

\newlist{edulist}{itemize}{1}
\setlist[edulist]{label=\textbullet,nosep}
\renewcommand{\tabularxcolumn}[1]{>{\raggedright\arraybackslash}m{#1}}
\begin{document}

\tcbset{colframe=gray!95!black,colback=titleBack,arc=0mm}%
\begin{tcolorbox}
  \begin{minipage}{4.5cm}
    %Picture
  \end{minipage}
  \begin{minipage}{15cm}
    \begin{center}
      \Huge{\textcolor{white}{Name}} \\
      \vspace*{0.5cm}
      \Large{\textcolor{white}{Curriculum Vitae}}
    \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!15,colframe=white]
      \section*{Profile}
    \end{tcolorbox}
  \end{minipage}
  \begin{minipage}[t]{11cm}
    \vspace*{-0.5cm}
    \begin{tcolorbox}[grow to right by=0.75cm,colframe=white,colback=white]% adjust width as required for image and/or use width=\linewidth for \includegraphics
      \section*{Education}
      \begin{tabularx}\linewidth{Xm{5ex}}
        \begin{edulist}
          \item\textbf{University of X}
          
          \emph{MSc Y}
          
          \emph{April, 2024}
          
          Some Text.
        \end{edulist}
        &
        \rule{4ex}{4ex}
        \\
        \begin{edulist}
          \item \textbf{Another University}
          
          \emph{BPhil}
          
          \emph{July, 2024}
          
          Super quick!
        \end{edulist}
        &
        \includegraphics[width=4ex,height=4ex]{example-image-b}
        \\
      \end{tabularx}
    \end{tcolorbox}
  \end{minipage}
\end{tcolorbox}

% \kant[1-5]
\end{document}

相关内容