I am dealing with tcolorbox
and it was working great until my title exceeded one line width. The problem is that text doesn't wrap to a new line.
Compared to a box with normal text width it looks like this:
I supply title
together with other variables like this:
\begin{tcolorbox}[title=...]
...
\end{tcolorbox}
I read in documentation on CTAN (ch. 4.1 on p. 18) that there are some alternatives to title
. Those alternatives are adjusted title
, squeezed title
and squeezed title*
but none of those offer multiline support.
Does anyone have an solution?
I probably won't use mdframed
package again, because it produced error tex capacity exceeded
multiple times while I was in the middle of a large project and it was a pain to swap it for tcolorbox
…
This is the minimal working example as requested:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[slovene]{babel}
\usepackage{units}
\usepackage{acronym}
\usepackage{hyperref}
\usepackage{multicol}
\usepackage{xcolor}
\usepackage{color}
\hypersetup{
colorlinks=true
}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\newcommand{\vprasanje}[4]{
\begin{tcolorbox}[%
breakable,%
left=5mm,%
right=5mm,%
top=5mm,%
bottom=5mm,%
toptitle=0mm,%
bottomtitle=0mm,%
lefttitle=0mm,%
righttitle=0mm,%
boxrule=0.15mm,%
arc=0.25mm,%
colback=red!20!white,%
colframe=red!80!white,%
fonttitle=\hypersetup{allcolors=white!10!white},%
title={\underline{\makebox[\textwidth]{\textit{"{#2}"}\hfill}}}\newline{\makebox[\textwidth]{\hfill{\scriptsize \uppercase{\textbf{Viri}}:~~\textit{#3}}}}%
]
#4
\end{tcolorbox}
}
\begin{document}
\vprasanje{1}{This is the longlonglong longlonglong longlong longlong longlong longlong longlong longlong long longlong long long long long long long long long long long long long long long long long long long long question.}{some references}{This is the long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long answer.}
\end{document}
Best Answer
The main cause for the problem is that
\underline
does not wrap the text inside its argument, but\uline
fromulem
package does, under certain conditions.There is no need of using outer
\parbox
etc. environments here, in my point of view.However, underlining should be not used (too much)