LaTeX colorbox and text alignment

Today I found out that when you use a colorbox statement in your LaTeX code, you have to put comments at the end of the lines inside all text environments where you want to keep offsest and text alignment right. Just like this:

begin{center}
includegraphics[width=.5textwidth]{logo.png}
vspace{10ex}
begin{Huge}
texttt{%
textbf{%
colorbox[rgb]{0.137255, 0.137255, 0.862745}%
{textcolor[rgb]{1, 1, 1}{g}}ruppo%
colorbox[rgb]{0.137255, 0.137255, 0.862745}%
{textcolor[rgb]{1, 1, 1}{r}}icerche%
}%
}%
end{Huge}
vspace{2ex}
Istituto Internazionale di Studi LiguriSezione di Genova
vspace{10ex}
end{center}

Otherwise, the line that contains the colorbox(es) will have a wrong offset.

Pubblicato da

Stefano Costa

Archaeologist, I study the Late Antique and Early Medieval/Byzantine period on the northern side of the Mediterranean, focusing on pottery usage patterns. I'm also involved in open source and open knowledge communities, like OSGeo, the IOSA project and the Open Knowledge Foundation.

Rispondi