如何强制元素在同一行?

How to force elements to be on the same line?

我想在我用 LaTeX 创建的 CV 的边栏中添加技能,我正在使用 tcolorbox 包在文本周围创建一个椭圆形框,但每次我创建一个新的椭圆形框时文本(带框)换行。怎样强制在同一行中一个接一个添加?

这是模板的代码(latex 模板 twentysecondcv):

\documentclass[letterpaper]{twentysecondcv} % a4paper for A4
\definecolor{shadecolor}{rgb}{1,0.8,0.3}

\usepackage{times,tcolorbox}
\newtcbox{\ovalbox}{colback=gray!50!white,boxrule=0pt,arc=5pt,
  boxsep=0pt,left=4pt,right=4pt,top=2pt,bottom=2pt}

\profilepic{alice.jpeg}
\cvname{Your Name}
\cvjobtitle{about me}

\begin{document}

\aboutme{}
\contact{contact}

%----------------------------------------------------------------------------------------
%    SKILLS
%----------------------------------------------------------------------------------------

\myskills{
\ovalbox{Skill 1} 
\ovalbox{Skill2} 
\ovalbox{Skill3}
\ovalbox{Skill4}

}

\references{references document 1}

\makeprofile % Print the sidebar

%----------------------------------------------------------------------------------------
%    MAIN PAGE
%----------------------------------------------------------------------------------------

\section{About Me}

\hrulefill 

\section{Experience}

\hrulefill 

\section{Education}

\hrulefill 

\section{Courses}

\hrulefill 
\section{Other information}
\end{document} 
  • 要在同一行中包含所有 \tcbox,请将 nobeforeafter 选项添加到 \ovalbox

    [=27 的定义中=]
  • 如果修改了class文件,最好连名字也改一下(如twentysecondcvx.cls),避免版本不同造成混淆。 [还相应地更改 .cls 文件中的第一行]


\documentclass[letterpaper]{twentysecondcvx} % a4paper for A4
\definecolor{shadecolor}{rgb}{1,0.8,0.3}

\usepackage{tcolorbox}
\newtcbox{\ovalbox}{colback=gray!50!white,boxrule=0pt,arc=5pt,
  boxsep=0pt,left=4pt,right=4pt,top=2pt,bottom=2pt,nobeforeafter}

\profilepic{alice.jpeg}
\cvname{Your Name}
\cvjobtitle{about me}

\begin{document}

\aboutme{}
\contact{contact}

%----------------------------------------------------------------------------------------
%    SKILLS
%----------------------------------------------------------------------------------------

\myskills{
\ovalbox{Skill 1} 
\ovalbox{Skill2} 
\ovalbox{Skill3}
\ovalbox{Skill4}

}

\references{references document 1}

\makeprofile % Print the sidebar

%----------------------------------------------------------------------------------------
%    MAIN PAGE
%----------------------------------------------------------------------------------------

\section{About Me}

\hrulefill 

\section{Experience}

\hrulefill 

\section{Education}

\hrulefill 

\section{Courses}

\hrulefill 
\section{Other information}
\end{document}