如何强制元素在同一行上?

时间:2019-04-17 15:34:56

标签: latex box oval

我想向在LaTeX中创建的CV的侧边栏添加技能,我正在使用tcolorbox包在文本周围创建一个椭圆形框,但是每次我创建一个新的椭圆形框时,文本(带有框)都会转到新线。如何强制在同一行中一个接一个地添加它?

这是模板的代码(胶乳模板二十秒cv):

\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} 

1 个答案:

答案 0 :(得分:1)

  • 要在同一行中包含所有\tcbox,请将nobeforeafter选项添加到\ovalbox

  • 的定义中
  • 如果您修改类文件,最好也更改名称(例如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} 

enter image description here