LaTeX forum ⇒ Graphics, Figures & TablesAdding a shaded background to a floating box

Information and discussion about graphics, figures & tables in LaTeX documents.
jackd
Posts: 1
Joined: Thu Oct 12, 2017 6:05 pm

Adding a shaded background to a floating box

Postby jackd » Thu Oct 12, 2017 6:10 pm

Hi all!

I haven't yet been able to figure this out so putting it to the community. I have loaded a module called boxedfloat (http://www.spitzmueller.org/tools/lyx/boxedfloat.module) so that I can add boxes to my document. The float format is preferable since I want them to span a two column file and not interfere with the formatting of the main text. Without using the float module I have a few aesthetic controls over a box including shading th background but I can't figure out a way of shading this extended float type.

Any ideas??


Many thanks

Tags:

eekBR
Posts: 1
Joined: Sun Nov 12, 2017 11:33 pm

Postby eekBR » Sun Nov 12, 2017 11:39 pm

May I sugest:
https://tex.stackexchange.com/questions ... nvironment

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{mdframed}% http://ctan.org/pkg/mdframed
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\newenvironment{inline}[3][black!25]{
\begin{figure}[h!]
\begin{mdframed}[backgroundcolor=#1]
\centering\caption{#2}\label{#3}
\vspace{10pt}%
}{%
\end{mdframed}
\end{figure}
}
\begin{document}
\lipsum[1]
\begin{inline}{An image}{image}
\rule{150pt}{100pt}
\end{inline}
\lipsum[2]
\end{document}


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests