3

I need to place two different boxes on the same line with the word 'and' separating them, if anyone could help it would be much appreciated, thanks.

Something like this:

enter image description here

3
  • 2
    Could you provide us with some more detail? Perhaps a visual clue by means of an image of what you're after exactly? We deal with boxes and alignment here, every day, so this question is very general/vague at the moment. – Werner Nov 30 '15 at 22:13
  • @Werner I have now added the image :) – Ben Lindon Nov 30 '15 at 22:18
  • If boxes contain math expressions, take a look at tex.stackexchange.com/questions/109900/… – Ignasi Dec 1 '15 at 7:52
5

This is quite 'easy' with the tcolorbox package -- I've defined a special infobox environment -- the parameters can be changed using the optional argument -- the important setup is baseline=3.5mm -- this is most likely to be adapted to the real situation:

\documentclass{article}

\usepackage[most]{tcolorbox}
\begin{document}

\newtcolorbox{infobox}[1][]{%
  enhanced,
  left=2pt,
  nobeforeafter,
  width=0.2\textwidth,
  colback={white!30!yellow},
  box align=center,
  baseline=3.5mm,
  #1
}


Running text
\begin{infobox}
Info
\end{infobox}
and 
\begin{infobox}[colback={yellow!30!white}]
Info
\end{infobox}


\end{document}

enter image description here

2
  • Do you have any idea why it is not working with fractions? The fraction messes up :/ – Ben Lindon Nov 30 '15 at 23:19
  • @BenLindon: Fractions? Where is a fraction? – user31729 Nov 30 '15 at 23: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.