Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am looking for something like \fbox but it seems that you cannot use it when a math environment is included. However its not only a math environment (then you could use \boxed I know) but also text, I need to be in a frame.

example:

\rdmframeboxaroundwhatever{

blablabla

\begin{align}
Formula of the universe
\end{align}


Hoaray

}
share|improve this question

migrated from stackoverflow.com Nov 29 '11 at 14:33

This question came from our site for professional and enthusiast programmers.

1  
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Torbjørn T. Nov 29 '11 at 15:03

3 Answers 3

You could take a look at mdframed, which also allows pagebreaks, and allows you to customize the look of the frame. A simple example, which puts a box similar to \fbox around the content.

\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum} % for creating dummy text

\begin{document}
\begin{mdframed}
\lipsum[1]
\begin{equation}
 f(x) = \sin(x)
\end{equation}
\lipsum[2]
\end{mdframed}
\end{document}

A second example, showing some more of what the package can do. See the manual for the full story.

\documentclass{article}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\mdfdefinestyle{MyFrame}{%
    linecolor=blue,
    outerlinewidth=2pt,
    roundcorner=20pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=20pt,
    innerleftmargin=20pt,
    backgroundcolor=gray!50!white}

\begin{document}

\begin{mdframed}[style=MyFrame]
\lipsum[1]
\begin{equation}
 f(x) = \sin(x)
\end{equation}
\lipsum[2]
\end{mdframed}
\end{document}

enter image description here

share|improve this answer

Wrap the math and text in a minipage, then put that in the fbox:

\documentclass{minimal}

\begin{document}
\fbox{%
\begin{minipage}{4 in}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed fringilla
purus bibendum odio ultricies non bibendum massa condimentum. Morbi
scelerisque pulvinar quam, sed porta ipsum blandit ac.
\begin{equation}
    \frac{Lorem}{Ipsum}=Do^2lr+\int_i^t\,d(amet)
\end{equation}
Sed felis arcu, pretium ut vulputate at, feugiat vitae orci. In hac
habitasse platea dictumst. Integer mollis vulputate dui. Fusce
eget sollicitudin purus.
\end{minipage}}
\end{document}
share|improve this answer
    
This won't break across pages whereas the mdframed solution will. –  Seamus Nov 29 '11 at 16:30

My combination of a frame box and math (trying to align the formula vertically as well as horizontally - give more space when the math gets really tall and allow more room horizontally for better visual effect):

\framebox{

\parbox[t][1.0cm]{4.50cm}{

\addvspace{0.2cm} \centering 

$ p \;=\; -\, \dfrac{17}{23}\;;\; \quad q \;=\; \dfrac{10}{23} $ 

} 

}\\
share|improve this answer
    
Tip: You can mark code sch as I did in my edit by either indenting it with four spaces, or selecting the block and clicking the button marked {} above the text field (keyboard shortcut, Ctrl + K). –  Torbjørn T. Nov 29 '11 at 15:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.