0

I am using the boxed equation format shown here.

However, it flows out of column bounds when following the IEEE journal format as shown in image.

\documentclass{article}

\usepackage{color}
\definecolor{myblue}{rgb}{.8, .8, 1}

\usepackage{amsmath}
\usepackage{empheq}

\newlength\mytemplen
\newsavebox\mytempbox

\makeatletter
\newcommand\mybluebox{%
    \@ifnextchar[%]
       {\@mybluebox}%
       {\@mybluebox[0pt]}}

\def\@mybluebox[#1]{%
    \@ifnextchar[%]
       {\@@mybluebox[#1]}%
       {\@@mybluebox[#1][0pt]}}

\def\@@mybluebox[#1][#2]#3{
    \sbox\mytempbox{#3}%
    \mytemplen\ht\mytempbox
    \advance\mytemplen #1\relax
    \ht\mytempbox\mytemplen
    \mytemplen\dp\mytempbox
    \advance\mytemplen #2\relax
    \dp\mytempbox\mytemplen
    \colorbox{myblue}{\hspace{1em}\usebox{\mytempbox}\hspace{1em}}}

\makeatother

\begin{document}


 \begin{empheq}[box={\mybluebox[5pt]}]{equation*}
a really long equation resides here that flows out of bounds completely, please behave
\end{empheq}
\end{document}

I need to contain it within the column. Usually in figures, I have the option width=\columnwidth. I tried that but it does not work in this environment. I have searched online but have no solutions.

How can I contain this boxed equation within the column?enter image description here

learnerX
  • 149
  • 8
  • 2
    If the equation is wider than the column, it will obviously overflow; you need to split it. But a real world example is needed, with the proper document class. – egreg Mar 29 '18 at 23:17
  • The document class is: \documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}. I am not sure how to split it into multiple lines, I tried: \\\. – learnerX Mar 29 '18 at 23:24
  • I used the split environment to split it but I would still like to reduce the actual size of the text in the equation to fit the column if that is possible. – learnerX Mar 29 '18 at 23:26
  • 2
    Is the equation a military secret? Without seeing it, it's impossible to give advice. – egreg Mar 29 '18 at 23:29
  • \[ believe me, a really long non-emphasized equation does not behave better, you need to take care of what you type\] –  Mar 29 '18 at 23:39
  • Alright, I will make more fundamental changes to the equation itself in terms of formatting. I thought maybe there is a LaTeX trick that I do not know about. Thanks anyway. – learnerX Mar 29 '18 at 23:41

0 Answers0