Square bracket indicating "A or B or C"
Here is a solution that allows any number of choices for the bracket:
The call for this output is \orbrace[.5]{A=0,B=0,C=0,D=0}
The command \orbrace
takes 2 arguments, one optional. The optional .5
is the spacing in cm between each option (default is 1). The required comma-separated list gives the options to be typeset in math mode.
Here is the code:
\documentclass{article}
\usepackage{tikz}
\newcommand{\orbrace}[2][1]{\begin{tikzpicture}[line cap=round, semithick, baseline={([yshift=-.88mm]current bounding box.center)}]
\foreach[var=\x, count=\m] in {#2}{
\ifnum \m>1 \draw(0,-\m*#1) -- ++(0,#1); \fi
\draw (0,-\m*#1) -- ++(.1,0) node[right] {$\x$};
}
\end{tikzpicture}}
\begin{document}
\[
A.B.C.D=0 \Leftrightarrow \orbrace[.5]{A=0,B=0,C=0,D=0}
\]
\end{document}
Second attempt. Thanks go to Steven B. Segelets for communicating to me that the first attempt was not what the author wanted.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\[A\cdot B\cdot C=0\quad\Longleftrightarrow\quad\hspace{1ex}
\begin{aligned}
\tikzmarknode{A}{A}&=0\\ \tikzmarknode{B}{B}&=0\\ \tikzmarknode{C}{C}&=0
\end{aligned}
\begin{tikzpicture}[overlay,remember picture]
\draw[semithick] ([xshift=-2pt]A.west) -- ++ (-1ex,0) |- ([xshift=-2pt]C.west)
([xshift=-2pt]A.west|-B) -- ++ (-1ex,0);
\end{tikzpicture}
\]
\end{document}
I decided to put this in a second post for clarity. It is an attempt to combine the virtues of the existing answers, namely the convenience of Sandy G's post and the alignment of the baseline and the equality signs of my own. Now you can add a complete set of options, but for internal reasons and the ability to use this also in beamer
you need to use \&
instead of &
. And, unlike in ordinary aligned
environments where this is sort of optional you cannot swallow the final \\
. Other than that you can use the aligned
syntax.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,tikzmark}
\tikzset{aligned/.cd,h/.initial=1ex,
lines/.code={\tikzset{aligned/linestyle/.append style={#1}}},
linestyle/.style={line cap=round,line join=round,semithick}}
\newcommand{\AlignedTikZ}[2][]{\begin{tikzpicture}[baseline={(tmpbase.base)},
aligned/.cd,#1]
\matrix[matrix of math nodes,cells={nodes={inner xsep=.1111em}},
column 1/.style={nodes={anchor=base east}},
ampersand replacement=\&] (tmpmat) {#2};
\pgfmathtruncatemacro{\mybaserow}{(\pgfmatrixcurrentrow+1)/2}
\ifodd\pgfmatrixcurrentrow
\path (tmpmat-\mybaserow-1.base) node[anchor=base] (tmpbase){};
\else
\path (tmpmat-\the\numexpr\mybaserow+1\relax-1.base) --
node[anchor=base] (tmpbase){}
(tmpmat-\mybaserow-1.base);
\fi
\draw[aligned/linestyle] foreach \X in {1,...,\pgfmatrixcurrentrow}
{(tmpmat.west|-tmpmat-\X-1) -- ++ (-\pgfkeysvalueof{/tikz/aligned/h},0)}
([xshift=-\pgfkeysvalueof{/tikz/aligned/h}]tmpmat.west|-tmpmat-1-1) --
([xshift=-\pgfkeysvalueof{/tikz/aligned/h}]tmpmat.west|-tmpmat-\the\numexpr\pgfmatrixcurrentrow\relax-1);
\end{tikzpicture}}
\begin{document}
\[
A\cdot B\cdot C=0 \quad\Longleftrightarrow\quad
\AlignedTikZ{A\&=0\\ B\&=0\\ C\&=0\\}
\]
\[
A\cdot B\cdot C=0 \quad\Longleftrightarrow\quad
\AlignedTikZ[lines={thick,blue}]{A\&=0\\ B\&=0\\ C\&=0\\}
\]
\[
A\cdot B_1\cdot C_{12}=0 \quad\Longleftrightarrow\quad
\AlignedTikZ{A\&=0\\ B_1\&=0\\ C_{12}\&=0\\}
\]
\[
A\cdot B_1\cdot C_{12}\cdot D=0 \quad\Longleftrightarrow\quad
\AlignedTikZ{A\&=0\\ B_1\&=0\\ C_{12}\&=0\\ D\&=0\\}
\]
\end{document}
The appearance can be controlled by pgf keys. If you want to change the lengths of the horizontal bars, just add h=1em
, say to the options. If you want to add features this can be done, too, without losing backwards compatibility.