5

I would like to insert an inline box. I have tried this:

\usepackage{color}
\definecolor{shadecolor}{rgb}{1,.8,.3}

\begin{document}
{\setlength{\fboxsep}{0pt}
 \framebox{\setlength{\fboxsep}{5pt}\colorbox{shadecolor}{\hspace{1cm}}} }
\end{document}

Is it possible to remove the black line of the border around the frame?

Best regards

  • Why not using \colorbox then? – user31729 Sep 28 '17 at 13:51
  • @ChristianHupfer Sorry, I do not know how to make it. – user1993416 Sep 28 '17 at 13:54
6

The simplest way is to use \setlength{\fboxrule}{0pt} within a TeX group, i.e. {...}, this will set the rule width to 0pt and no rule is drawn.

Or ... use \colorbox{shadecolor}{...} only.

\documentclass{article}


\usepackage{xcolor}
\definecolor{shadecolor}{rgb}{1,.8,.3}

\begin{document}
{\setlength{\fboxsep}{0pt}%
  \setlength{\fboxrule}{0pt}%
  \framebox{\setlength{\fboxsep}{5pt}\colorbox{shadecolor}{Foo}}%
}%
\end{document}
  • thanks. The box is not centered in the middle of the line, but it lays in the bottom of the line. Do you know how to raise the box to get it centered to the line hight?. – user1993416 Sep 28 '17 at 14:12
  • If I frame some text, it gets centered in the middle of the line. Thank you. – user1993416 Sep 28 '17 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.