Hot answers tagged

10

Honestly I find empheq quite the overkill here. \documentclass{article} \usepackage[margin=.2in, paperwidth=8.5in, paperheight=11in]{geometry} \usepackage{amsmath}% or empheq, which loads mathtools, which loads amsmath \begin{document} Lorem ipsum dolor sit et amet. \[ \boxed{ \begin{aligned} \sin(A+B)&=\sin A\cos B+\cos A\sin B\\ \sin(A-B)&=\sin ...


6

Horizontal alignment in this case relies on the fact that the aligned symbols have the same width. \documentclass{article} \usepackage{amsmath} \newcommand{\qrel}{\mathrel{\mathpalette\doqrel\relax}} \makeatletter \newcommand{\doqrel}[2]{% \ooalign{\hidewidth$\m@th#1?$\hidewidth\cr\hphantom{$\m@th#1=$}\cr}% } \makeatother \begin{document} \begin{...


6

This doesn't solve the error in your code, but it answers the question you mentioned in the title. You can use Tcolorbox package that as its title suggests, creates color boxes. It is very well documented and it has many features. You can also use it in your Beamer presentation easily. \documentclass[a4paper,10pt]{article} \usepackage{tcolorbox} \...


6

(works for non numbered only) You can apply the color to the whole environment simply using \color{} before it. But, make sure that the color changes apply only to the environment, so embrace everything with braces, that is, {\color{<color>}...} Off topic: I would not use those \left \right. MWE \documentclass{article} \usepackage[svgnames,...


6

A small variation of Sigur's answer: I define an environment instead of a macro (my idiosyncrasy: I find it better to read) and declare a new tag form which guarantees that the equation number is still printed in black. \documentclass{article} \usepackage[svgnames, x11names]{xcolor} \usepackage{empheq} % provided by mathtools, which is loaded by empheq \...


6

It seems to me that this is a case where the long line could usefully be broken. \documentclass{article} \usepackage{empheq} \begin{document} \begin{subequations} \begin{empheq}[left=\empheqlbrace]{align} x & = y + z\\ a^{2} & = \begin{aligned}[t] & b^{2} + c^{2} + c^{2} + c^{2} + c^{2} + c^{2} + c^{2} \\ ...


5

You need to give the ? the same spacing as the < by typing \mathrel{?}. Also you might want to leave out the extra \; on both sides, as TeX keeps track of correct spacing for relations. \documentclass{article} \usepackage{empheq} \begin{document} \begin{align} \left(\frac{4}{2 \cdot 2 \cdot 10 ^{-6}}\right)^2 &\mathrel{?} \left(\frac{1}{2 \cdot 10 ^{-...


5

Not really automatic, but the result seems near to what you want. But I'd do this in my document for no amount of money. \documentclass[12pt,notitlepage]{article} \usepackage[pass,showframe]{geometry} \usepackage{amsmath,empheq} \usepackage{siunitx} \usepackage{tikz} \usetikzlibrary{tikzmark} \begin{document} \begin{empheq}[box=\mbox]{align*} \tikzmark{A} \...


5

The problem is that amsart loads amsmath in a way that it is not compatible with empheq, at least with respect to the reqno option. You can work round this by loading the package first, before the document class: \RequirePackage[reqno]{amsmath} \documentclass[a4paper,12pt]{amsart} \usepackage{empheq} \numberwithin{equation}{section} \newcommand{\pderiv}[...


5

How about \begin{empheq}[left=(P)\empheqlbrace]{alignat=2} bigvariable &=b &\qquad&\text{big info}\notag\\ c &=d &&\text{info2}\label{eq:1}\\ e &=f &&\text{info3}\label{eq:2} \end{empheq} Use alignat to give columns with adjustable spaces inbetween.


5

You could omit the subequations environment specifiers, change align to equation (in the supplemental argument to empheq), and use a split environment inside empheq to achieve the alignment objectives. \documentclass{article} \usepackage{empheq} \newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}} \begin{document} \begin{empheq}[box=\widefbox]{...


5

You have several unprotected end-of-lines in the definition of \Yellowbox; you have also an overfull box, because you're not taking into account \fboxsep and \fboxrule. \documentclass{article} \usepackage{mathtools} \usepackage[amsmath]{empheq} \usepackage{calc} \usepackage{xcolor} \definecolor{shadecolor}{cmyk}{0,0,0.45,0} \definecolor{light-blue}{cmyk}{...


5

Use a double array; empheq is not the right tool. \documentclass{article} \usepackage{amsmath,lipsum} \begin{document} \lipsum*[2] \begin{equation*} \begin{array}{c} \\[-.3\normalbaselineskip] \left. \begin{array}{@{}c@{}} \\[-1.7\normalbaselineskip] \dfrac{\dfrac{\dfrac{\dfrac{ \frac{1}{a} % <-- start with this a }{a}}{a}}{\vdots}}{a} \end{array} \...


5

Yes, it's possible, and you have several options depending on the desired result. Below I show six different possibilities. The code: \documentclass{article} \usepackage[vmargin=1cm]{geometry} \usepackage{amsmath} \usepackage[many]{tcolorbox} \usepackage{empheq} \begin{document} \begin{empheq}[box=\fbox]{gather} Eq1 \\ Eq2 \\ Eq3 \\ \notag\text{where ...


5

You can split up \footnote into \footnotemark and \footnotetext{...}. Use \footnotemark in the equation where it should appear and \footnotetext{...} outside of the empheq environment. \documentclass{article} \usepackage{amsmath, amssymb, amsfonts, empheq} \begin{document} hello world\footnote{a test before} \begin{empheq}[left=\empheqlbrace]{align} \...


5

I can't see why the introductory text should be in the scope of the brace. \documentclass{article} \usepackage{amssymb} \usepackage{amsmath} \usepackage{empheq} \usepackage{eqparbox} \newcommand{\matheqbox}[2]{\eqmakebox[#1][l]{$\displaystyle#2$}} \begin{document} \begin{subequations}\label{pb:init} Find $u_1\colon \Omega_1 \to \mathbb{R}$ and $u_2\...


5

Hack above hack. ;-) \documentclass{article} \usepackage{amssymb, amsthm, amsmath} \usepackage{mathtools, empheq,eqparbox} \newcommand{\eqmath}[3][l]{\eqmakebox[#2][#1]{$\displaystyle\if#1l{}\fi#3$}} \newcommand{\ftext}[2]{\makebox[#1][l]{\textup{#2}}} \begin{document} \begin{empheq}[ right=\empheqrbrace \ftext{10em}{Primal Feasibility} ]{align} \...


5

I propose this coloured version: \documentclass[11pt]{article} \usepackage[svgnames]{xcolor} \usepackage[margin=.2in, paperwidth=8.5in, paperheight=11in]{geometry} \usepackage{empheq} \makeatletter \newcommand{\colorboxed}[3][white]{\fcolorbox{#2}{#1}{\m@th$\displaystyle#3$}} \makeatother \begin{document} \[ \setlength{\fboxsep}{0.5em}\setlength{\...


5

You don't really need empheq for that. Use the \Aboxed command, defined by mathtools. To have a correcr spacing in the r.h.s. of the second equation, I suggest defining a \openintvl command with \DeclarePairedDelimiter; \documentclass[english]{beamer} \usepackage{empheq} \usetheme{madrid} \DeclarePairedDelimiter{\openintvl}{]}{[} \begin{...


4

The main problem is that empheq redefines \maketag@@@ because it need to separate the display from the eqn numbers. But \eqref also make use of this macro to typeset the reference to an eqn numbers. The fix below seem to do the trick and will be build into the next empheq release \makeatletter \MHInternalSyntaxOn \renewenvironment{empheq}[2][]{% \let\...


4

You can \addstackgap in the definition. The optional argument (here 20pt) can be changed to suit. This gap is an addition to the existing equation height/depth (rather than a replacement to it, which a \rule would be). \documentclass{minimal} \usepackage{empheq} \usepackage{stackengine} \begin{document} \newcommand*\widefbox[1]{\fbox{\hspace{1em}\...


4

\documentclass{minimal} \usepackage{empheq} \begin{document} \newcommand*\widefbox[1]{\fbox{\rule[-1.8cm]{0pt}{4cm}\hspace{1em}#1\hspace{1em}}} \begin{empheq}[box=\widefbox]{align*} a&=b \tag{*}\\ E&=mc^2 + \int_a^a x\, dx \end{empheq} \end{document}


4

Not Recommended: One solution would be to change the margins before and _after the empheq. Below I have applied the solution from How can I change the margins for only part of the text? to adjust the margins: However, I would recommend the alignat* solution below. Notes: The showframe package was used just to show the page margins. It is not needed in your ...


4

Add some positive vertical spacing before empheq (e.g. \vspace*{\baselineskip}) and add the same amount of negative spacing (e.g. \\[-\baselineskip]) inside empheq. \documentclass{article} \usepackage{empheq} \begin{document} \vspace*{\baselineskip} \begin{empheq}[right=\empheqrbrace]{align*} \\[-\baselineskip] \dfrac{\dfrac{\dfrac{\dfrac{ \frac{1}{a} ...


4

Here's a TABstack approach. \documentclass{article} \usepackage{tabstackengine,amsmath,calc} \stackMath \begin{document} \begin{equation} \setstackgap{S}{6pt} \alignShortunderstack{ \left(\dfrac{4}{2 \cdot 2 \cdot 10 ^{-6}}\right)^2 \mathrel{\protect\makebox[\widthof{$<$}]{$?$}}& \left(\dfrac{1}{2 \cdot 10 ^{-6} \cdot 450 \cdot 10 ^{-12}}\right) \\ ...


4

The following example defines \dotarabic, which similar to \arabic prints the arabic form of a counter with the zeros exchanged by \pmzerodot. \theequation is redefined to use \dotarabic instead of \arabic (or \arabic can be redefined, if the zero with dot should be used by all counter outputs). Furthermore \pmzerodot is made robust, because \the<counter&...


Only top voted, non community-wiki answers of a minimum length are eligible