General ⇒ Color inside a minipage?
Color inside a minipage?
I've been trying to make boxes with a backgroundcolor including text and equations - and have found that the minipage environment does this kind of how I want it to. But I still haven't figured out how to make a background color inside a minipage.
Is there anyone who knows this? Or should I actually try with some different environment instead..?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Color inside a minipage?
use \colorbox{color}{...}, you can set \parbox and even a minipage as argument into the box.
Stefan
Color inside a minipage?
hmm, but when I use colorbox it makes the color go outside or inside the box I'we maked.. An example of my code might be appropriate:Stefan_K wrote:Hi Bozack,
use \colorbox{color}{...}, you can set \parbox and even a minipage as argument into the box.
Stefan
Code: Select all
\begin{center}
\colorbox{red}{
\fbox{
\begin{minipage}[t]{1.0\textwidth}
text
\end{minipage}
}
}
\end{center}
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Color inside a minipage?
change \fbox and \colorbox, set \fbox outside:
Code: Select all
\begin{center}
\fbox{\colorbox{red}{
\begin{minipage}[t]{1.0\textwidth}
text
\end{minipage}
}
}
\end{center}
Stefan
Re: Color inside a minipage?

- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Color inside a minipage?

Stefan
Re: Color inside a minipage?

fcolorbox did the job to perfection

- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Color inside a minipage?

Code: Select all
\setlength{\fboxrule}{1pt}
Re: Color inside a minipage?

Color inside a minipage?
E.G.:
Code: Select all
\begin{center}
\fcolorbox{black}{red}{
\begin{minipage}[t]{1.0\textwidth}
text
\end{minipage}
}
\end{center}
Thanks!
Andrea