0

I've build a flalign environment and I'm happy with the result, but now I want to put it in a tcolorbox like in my example. I can't figure out how I can make that possible.

This is my MWE

\documentclass[preview]{standalone}
\usepackage{array,tabularx,calc}
\usepackage[dutch]{babel}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}

\pagestyle{empty}

\definecolor{yourcolor}{RGB}{128, 0, 0}

\newlength{\conditionwd}
\newenvironment{conditions}[1][\\ \textbf{Waarin} \\\\]
  {%
   #1\tabularx{11cm}[t]{@{}
     >{$}l<{$} @{${}={}$} X@{} >{[}>{$}r<{$}<{]}
                        }%
  }
  {\endtabularx\\[\belowdisplayskip]}

\begin{document}
    \begin{tcolorbox}[ams align,colback=yellow!10!white,colframe=yourcolor]
    f(x) & = {} g(x)
    \end{tcolorbox}
    \begin{flalign}
    q_{as} = \frac{(m_{as} \cdot g)}{L_{ac}} &&
    \end{flalign}
    \begin{conditions}
    q_{as}  &   Verdeelde belasting door de as  &   N \cdot mm\\
    m_{as}  &   Massa van de aandrijfas         & kg \\
    g       &   gravitatieconstante             & m/s^2 
    \end{conditions}
\end{document}

which gives me this result;

tcolorbox_MWE

The tcolorbox(not overruling textwidth) is the one I want, but with the flalign and conditions in it.

Is there someone who can help me out?

Thank you in advance!

2

Why not a single flalign for both equations?

\documentclass[preview, border = 12pt]{standalone}
\usepackage{array,tabularx,calc}
\usepackage[dutch]{babel}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}

\pagestyle{empty}

\definecolor{yourcolor}{RGB}{128, 0, 0}

\newlength{\conditionwd}
\newenvironment{conditions}[1][\\ \textbf{Waarin} \\\\]
  {%
   #1\tabularx{11cm}[t]{@{}
     >{$}l<{$} @{${}={}$} X@{} >{[}>{$}r<{$}<{]}
                        }%
  }
  {\endtabularx\\[\belowdisplayskip]}

\begin{document}
    \begin{tcolorbox}[colback=yellow!10!white,colframe=yourcolor]%
 \begin{flalign}
   & & f(x) & = {} g(x) & & \\
    q_{as} = \frac{(m_{as} \cdot g)}{L_{ac}} &&
 \end{flalign}
    \begin{conditions}
    q_{as} & Verdeelde belasting door de as & N \cdot mm\\
    m_{as} & Massa van de aandrijfas & kg \\
    g & gravitatieconstante & m/s^2
    \end{conditions}
    \end{tcolorbox}

\end{document} 

enter image description here

0

Nice, thank you!

The first equation was only to show you a working tcolorbox example. When I built something like this:

\begin{tcolorbox}[ams align, colback=yellow!10!white,colframe=yourcolor]%
    \begin{flalign}
    q_{as} = \frac{(m_{as} \cdot g)}{L_{ac}} &&
    \end{flalign}
    \begin{conditions}
    q_{as}  &   Verdeelde belasting door de as  &   N \cdot mm\\
    m_{as}  &   Massa van de aandrijfas         & kg \\
    g       &   gravitatieconstante             & m/s^2 
    \end{conditions}
\end{tcolorbox}

I get the error; !Argument of \flalign has an extra }.<inserted text>\par\end{tcolorbox}

But I see from your example that the problem was in the ams align of my tcolorbox. I don't know why that's forming a problem, but problem solved by removing it.

Thanks.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Alessandro Cuttin Jul 19 at 9:40
  • @AlessandroCuttin It seems to be an answer: Removing ams align. Though I agree, it looks like a response to the other answer. – Stefan Kottwitz Jul 19 at 10:34
  • @StefanKottwitz then it can be kept as a self-answer (sort of) – Alessandro Cuttin Jul 19 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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