I have trouble positioning a box and am not sure why this is happening. First, the expected behavior. I want the box to appear 1cm left and 1cm down from my text, like this:
\documentclass{article}
\usepackage{enumitem}
\usepackage[usenames,table]{xcolor}
\usepackage{tcolorbox}
\begin{document}
Here is some text, and a box should appear 1cm underneath, 1cm from the left:
\vspace{1cm}
\hspace{1cm}
\colorbox{orange}{\LARGE 6-10}
\end{document}
However, I now want the same within a label of a description list, but very weird things happen.
Here is the code:
\documentclass{article}
\usepackage{enumitem}
\usepackage[usenames,table]{xcolor}
\usepackage{tcolorbox}
\begin{document}
\begin{description}[style=multiline,leftmargin=3cm]
\item[Third item\\
%\vspace{1cm} -- These I rotatively turn on and off
%\hspace{1cm} -- These I rotatively turn on and off
\colorbox{orange}{\LARGE 6-10}]
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information. This is
a multiline description. We will copy these lines a few times.Here is
information. This is a multiline description. We will copy these lines a few
time.
\end{description}
\end{document}
Here is what it looks WITHOUT any hspace and vspace:
1cm vspace (???):
1cm hspace (nothing happens):
1cm hspace AND 1cm vspace:
I am a LaTeX beginner and I continue to struggle positioning boxes. I am therefore interested in the solution, but also very much would like to know a) why is this happening, b) and how could I find this out myself?
Best Answer
You need
\hspace*
rather than\hspace
to avoid space being dropped at start of line, and you can add vertical space with\\[1cm]