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 recently asked this question. The solution worked for me but I have a problem. cropped images are as small as possible. I would like to have a gif that bounds to borders of box of the equation. so I add \boxed to all my equations. Now sizes are good but I don't know how do I remove black borders around equation. Probably changing its color to white will help. [?]

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

You could redefine the \boxed command. For example:

\renewcommand{\boxed}[1]{\textcolor{\boxedcolor}{%
  \fbox{\normalcolor\m@th$\displaystyle#1$}}}

It's originally defined in amsmath.sty:

\newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}

Here's a complete minimal example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\newcommand*{\boxedcolor}{red}
\makeatletter
\renewcommand{\boxed}[1]{\textcolor{\boxedcolor}{%
  \fbox{\normalcolor\m@th$\displaystyle#1$}}}
\makeatother
\begin{document}
text
\begin{equation}
\boxed{1+1=2}
\end{equation}
text
\end{document}
share|improve this answer
    
Is it possible to add a background??? –  71GA Oct 3 '12 at 8:31
add comment

Another idea of Herbert in mathmode.pdf for coloured boxes is to use package empheq (now in the mh bundle)

\documentclass{article}
\usepackage{amsmath,empheq}
\usepackage{xcolor}

\begin{document}

 \[
  f(x)=\int_1^{\infty}\frac{1}{x^2}\,\mathrm{d}x=1 
 \]
\begin{empheq}[box={\color{white}\fboxsep=10pt\fbox}]{align}
\color{red}
f(x)=\int_1^{\infty}\frac{1}{x^2}\,\mathrm{d}x=1
\end{empheq} 

\begin{empheq}[box={\fboxsep=10pt\fbox}]{align}
\color{red}
f(x)=\int_1^{\infty}\frac{1}{x^2}\,\mathrm{d}x=1
\end{empheq}  
\end{document}

enter image description here

share|improve this answer
add comment

Set a border for the preview.

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage[active,displaymath,tightpage]{preview}
\setlength\PreviewBorder{10pt}
\begin{document}

\[y=x\]
\begin{align} g(x)=x^2 \end{align}

\end{document} 
share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.