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 aware that there are plentiful similar questions, but since (even after several reading) I don't understand the the answers, I am unable to apply them to my problem. I simply want to define a new align environment based on the old one, e.g.

\documentclass[11pt]{scrbook}

\usepackage{empheq}
\usepackage[many]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=black,arc=8pt,boxrule=1pt}}
\newenvironment{alignteo}%
  {
  \begin{empheq}[box=\tcbhighmath]{align}
  }{
  \end{empheq}
  }

\begin{alignteo}
f = a x
\end{alignteo}

\end{document}

Using \begin{alignteo} and \end{alignteo} I get the error

! LaTeX Error: \begin{empheq} on input line 448 ended by \end{alignteo}.

Is there any way to do this without using environ package?

share|improve this question
    
Can you make a complete example? –  egreg Oct 25 '13 at 10:41
    
OK, I'll try to build MWE –  Pygmalion Oct 25 '13 at 10:45

1 Answer 1

up vote 8 down vote accepted

With environ:

\documentclass{article} 
\usepackage[svgnames,hyperref]{xcolor}
\usepackage{empheq}
\usepackage[many]{tcolorbox}

\tcbset{highlight math style={enhanced,
  colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
  drop fuzzy shadow}}

\usepackage{environ}
\NewEnviron{alignteo}{
  \begin{empheq}[box=\tcbhighmath]{align}
  \BODY
  \end{empheq}
}

\begin{document}

\begin{equation}
\tcbhighmath{E = mc^2}
\end{equation}

\begin{empheq}[box=\tcbhighmath]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\begin{alignteo}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{alignteo}
\end{document}

enter image description here

Without environ:

\documentclass{article} 
\usepackage[svgnames,hyperref]{xcolor}
\usepackage{empheq}
\usepackage[many]{tcolorbox}

\tcbset{highlight math style={enhanced,
  colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
  drop fuzzy shadow}}

\newenvironment{alignteo}%
  {\empheq[box=\tcbhighmath]{align}}
  {\endempheq}


\begin{document}

\begin{equation}
\tcbhighmath{E = mc^2}
\end{equation}

\begin{empheq}[box=\tcbhighmath]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\begin{alignteo}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{alignteo}
\end{document}
share|improve this answer
    
Requested was without environ... Just turn the answers around :) –  Pygmalion Oct 25 '13 at 11:04
    
@Pygmalion My eyes are too tired. Any way both are there. Does order matter? :-) –  Harish Kumar Oct 25 '13 at 11:06
    
Nope :) accepted +1 –  Pygmalion Oct 25 '13 at 11:09

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.