如何强制元素在同一行?

问题描述 投票:-1回答:1

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

这是模板的代码(latex template 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} 
latex box oval
1个回答
1
投票
  • 让所有\tcboxes在同一行,将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

© www.soinside.com 2019 - 2024. All rights reserved.