2

I tried aligning the "=" symbol in first two lines with rest of the lines but it is not aligning? Am I doing something wrong here?

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{xcolor}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart,shapes,shadows,arrows,decorations.markings,trees,positioning,decorations.markings,calc,fit,chains,intersections,decorations.pathreplacing}
\usepackage[underline=true]{pgf-umlsd}
\usepackage{flexisym}
\usepackage{siunitx}
\usepackage{float}
\usepackage{supertabular,booktabs}
\usepackage{enumitem,kantlipsum}
\usepackage{tcolorbox}
\usepackage{longtable}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning, shapes.geometric}
\usepackage{arydshln}
\usepackage{upgreek}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{float}

\DeclareMathSymbol{\al}  {\mathord}{letters}{"0B}
\DeclareMathSymbol{\be}   {\mathord}{letters}{"0C}
\DeclareMathSymbol{\ga}  {\mathord}{letters}{"0D}
\DeclareMathSymbol{\de}  {\mathord}{letters}{"0E}
\DeclareMathSymbol{\ep}{\mathord}{letters}{"0F}
\DeclareMathSymbol{\ze}   {\mathord}{letters}{"10}
\DeclareMathSymbol{\et}    {\mathord}{letters}{"11}
\DeclareMathSymbol{\thet}  {\mathord}{letters}{"12}
\DeclareMathSymbol{\io}   {\mathord}{letters}{"13}
\DeclareMathSymbol{\ka}  {\mathord}{letters}{"14}
\DeclareMathSymbol{\la} {\mathord}{letters}{"15}
\DeclareMathSymbol{\m}     {\mathord}{letters}{"16}
\DeclareMathSymbol{\n}     {\mathord}{letters}{"17}
\DeclareMathSymbol{\x}     {\mathord}{letters}{"18}
\DeclareMathSymbol{\p}     {\mathord}{letters}{"19}
\DeclareMathSymbol{\rh}    {\mathord}{letters}{"1A}
\DeclareMathSymbol{\sig}  {\mathord}{letters}{"1B}
\DeclareMathSymbol{\ta}    {\mathord}{letters}{"1C}
\DeclareMathSymbol{\up}{\mathord}{letters}{"1D}
\DeclareMathSymbol{\ph}    {\mathord}{letters}{"1E}
\DeclareMathSymbol{\ch}    {\mathord}{letters}{"1F}
\DeclareMathSymbol{\ps}    {\mathord}{letters}{"20}
\DeclareMathSymbol{\om}  {\mathord}{letters}{"21}
\DeclareMathSymbol{\va}{\mathord}{letters}{"22}
\DeclareMathSymbol{\va}{\mathord}{letters}{"23}
\DeclareMathSymbol{\va}  {\mathord}{letters}{"24}
\DeclareMathSymbol{\va} {\mathord}{letters}{"27}

\begin{document}

    \begin{align*}
    \sig_{ij} &=
    \begin{cases}
    A           &= g^{r_4}\\
    C           &= g^{\frac{1}{r_4 + H(m)}}\\
    \begin{rcases}
    D           &= \{K^{a}\}^{r_4}.\{K^{b}\}^{r_4}.\{K^{c}\}^{r_4}. ...\\
    &= g^{r_4{(\prod_{\forall k}^{}r_k)}(\Sigma_{\forall k}^{}AASK_k)}\\
    E_i         &= {D_{k}}^{r_4} = g^{r_4{(\prod_{\forall k}^{}r_k)}(\frac{q_x(0)}{t_i})}\\
    \end{rcases} {\scriptstyle \mid AA_k \in GetAA(\mathcal{T})}
    \end{cases}
    \end{align*}


\end{document}

enter image description here

4
  • 2
    Could you please make your example compilable? Currently the definitions of \sig, \al, \be, and \ga are missing. Also could you please add \documentclass, the required packages, \begin{document} and \end{document}, this saves everybody who wants to help you from adding this information.
    – Skillmon
    Feb 12, 2020 at 10:53
  • 1
    Off-topic: Where and why did you learn to program macros such as \DeclareMathSymbol{\al} {\mathord}{letters}{"0B}, etc? Why not just \newcommand\al{\alpha}, etc?
    – Mico
    Feb 12, 2020 at 11:56
  • 2
    Incidentally, you define \va four [4!] times as a math symbol. That's not intentional, is it?
    – Mico
    Feb 12, 2020 at 11:59

5 Answers 5

5

A pretty manual approach using array:

\documentclass[]{article}

\usepackage[]{mathtools}

\begin{document}
\begin{equation*}
  \sigma_{ij} = \left\{
    \begin{array}{@{}r@{{}={}}l@{}l}
      A   & g^{r_4}\\
      C   & g^{\frac{1}{r_4 + H(m)}}\\
      D   & \{K^\alpha\}^{r_4}\cdot\{K^\beta\}^{r_4}\cdot\{K^\gamma\}^{r_4} \ldots\\
          & g^{r_4{(\prod_{\forall k}^{}r_k)}(\sum_{\forall k}^{}AASK_k)}
          &
        \smash
          {%
            \left.\begin{array}{@{}c@{}}
              \vphantom{\{K^\alpha\}^{r_4}\{K^\beta\}^{r_4}\{K^\gamma\}^{r_4}}\\
              \vphantom{g^{r_4{(\prod_{\forall k}^{}r_k)}(\sum_{\forall
              k}^{}AASK_k)}}\\
              \vphantom{{D_{k}}^{r_4}=g^{r_4{(\prod_{\forall
              k}^{}r_k)}(\frac{q_x(0)}{t_i})}}\\
            \end{array}\right\} \scriptstyle \mid AA_k \in GetAA(\mathcal{T})
          }
      \\
      E_i & {D_{k}}^{r_4}
           = g^{r_4{(\prod_{\forall k}^{}r_k)}(\frac{q_x(0)}{t_i})}\\
    \end{array}\right.
\end{equation*}
\end{document}

enter image description here

6
  • +. In the third row, though, please replace ... with \dots and the 3 instances of . with \cdot.
    – Mico
    Feb 12, 2020 at 11:49
  • Incidentally, I believe it should be \newcommand\al{\alpha}, \newcommand\be{beta}, etc...
    – Mico
    Feb 12, 2020 at 11:55
  • @Mico yes, I added the definitions of \al, etc. before the MWE was posted... And you're right, I forgot to change the dots.
    – Skillmon
    Feb 12, 2020 at 12:06
  • @Mico but I think \ldots like in my answers is ok, instead of ... or \dots.
    – Skillmon
    Feb 12, 2020 at 12:07
  • Both \dots and \ldots are fine here. :-)
    – Mico
    Feb 12, 2020 at 14:23
5

Using nicematrix:

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{nicematrix}  % <---
\usetikzlibrary{decorations.pathreplacing,
                calligraphy}
\tikzset{
B/.style = {decorate,  % style for braces
            decoration={calligraphic brace, amplitude=4pt,
            raise=1pt, mirror},% for mirroring of brace
            thick,
            pen colour=black}
        }

\usepackage{lipsum} % for dummy text
\begin{document}
\lipsum[1]
    \[\setlength\arraycolsep{1pt}
\hspace*{-4em}\begin{NiceArray}{RCL}%
    [code-after={\tikz{\draw[B] (1-1.north -| 5-1.west) -- 
            node[left=2mm] {$\sigma_{ij}^{\vphantom{h}} =$}    (5-1.south west);
                       \draw[B] (3-3.east |- 5-3.south) -- 
            node[right=2mm,font=\scriptsize] {$\mid AA_k \in GetAA(\mathcal{T})$} 
                                            (3-3.north east) ;
                        }
                }
    ]
      A   &=& g^{r_4}\\
      C   &=& g^{\frac{1}{r_4 + H(m)}}\\
      D   &=& \{K^\alpha\}^{r_4}\cdot\{K^\beta\}^{r_4}\cdot\{K^\gamma\}^{r_4} \cdot\ldots  \\
          &=& g^{r_4{(\prod_{\forall k}^{}r_k)}(\sum_{\forall k}^{}AASK_k)}           \\
      E_i &=& {D_{k}}^{r_4}
           = g^{r_4{(\prod_{\forall k}^{}r_k)}(\frac{q_x(0)}{t_i})}                 \\
\end{NiceArray}
    \]
\lipsum[2-7]
\end{document}

After two compilation the result of MWE is:

enter image description here

2
  • +1. You're missing a \cdot before \ldots, though. :-( Incidentally, what happens if you replace \documentclass{article} with \documentclass[conference]{IEEEtran} \IEEEoverridecommandlockouts?
    – Mico
    Feb 12, 2020 at 14:47
  • 1
    @Mico, thank you very much for pointing me on \cdot, I overlooked that it is missed. Regarding documentclass I didn't notice any difference (now˙is used IEEEtran`).
    – Zarko
    Feb 12, 2020 at 15:01
4
\[
  \sig_{ij} =\left\{\!
  \begin{aligned}
    A   &= g^{r_4}\\
    C   &= g^{\frac{1}{r_4 + H(m)}}\\
    D   &= \{K^\al\}^{r_4}.\{K^\be\}^{r_4}.\{K^\ga\}^{r_4}. ...\\
        &= g^{r_4{(\prod_{\forall k}^{}r_k)}(\Sigma_{\forall k}^{}AASK_k)}
             \qquad\smash{\left.\rule{0pt}{2\normalbaselineskip}\right\} {\scriptstyle \mid AA_k \in GetAA(\mathcal{T})} } \\
    E_i &= {D_{k}}^{r_4} = g^{r_4{(\prod_{\forall k}^{}r_k)}(\frac{q_x(0)}{t_i})}
  \end{aligned}\right.
\]

enter image description here

4
  • 1
    This gives me some over-printing for the second brace.
    – Skillmon
    Feb 12, 2020 at 11:42
  • 1
    +1. Please replace \Sigma with \sum, though. Optionally, in the third row, replace ... with \dots and 3 instances of . with \cdot.
    – Mico
    Feb 12, 2020 at 11:44
  • The \! before aligned hasn't been necessary since the 04/2018 update.
    – campa
    Feb 12, 2020 at 12:00
  • Yes, I was on an old PC that hasn't been updated for long now!
    – AboAmmar
    Feb 12, 2020 at 12:02
4

First off, avoid flexisym, so you don't have to litter your document with all those definitions of already available symbols. And you gain little by typing \sig instead of \sigma.

I changed \Sigma into \sum, because you used \prod in the same formula; if \Sigma is right (which I don't think), then \prod should be \Pi.

The trick is to equalize the boxes at the left of =, which can be done with eqparbox. The macros of this package require an arbitrary label, I find it convenient to use a counter that's stepped by \neweqbox any time a new set of equalized boxes is needed.

Another trick is to remove the kern inserted by rcases at the left.

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{eqparbox}

\usepackage{lipsum}

\newcounter{eqparboxcount}
\newcommand{\neweqboxes}{\stepcounter{eqparboxcount}}
\newcommand{\eqbox}[2][c]{\eqmakebox[\theeqparboxcount][#1]{$\displaystyle#2$}}

\begin{document}

\lipsum[1]
\begin{equation*}
\neweqboxes
\sigma_{ij} =
\begin{cases}
  \eqbox[r]{A}     = g^{r_4}\\
  \eqbox[r]{C}     = g^{\frac{1}{r_4 + H(m)}}\\[1ex]
  \kern-\nulldelimiterspace % because rcases adds it
  \begin{rcases}
    \eqbox[r]{D}   = \{K^{a}\}^{r_4}\{K^{b}\}^{r_4}\{K^{c}\}^{r_4}\dotsm \\
    \eqbox[r]{}    = g^{r_4{(\prod_{\forall k}^{}r_k)}(\sum_{\forall k}\mathit{AASK}_k)}\\
    \eqbox[r]{E_i} = {D_{k}}^{r_4} = g^{r_4{(\prod_{\forall k}^{}r_k)}(\frac{q_x(0)}{t_i})}\\
  \end{rcases} {\scriptstyle \mid \mathit{AA}_k \in \mathit{GetAA}(\mathcal{T})}
\end{cases}
\end{equation*}
\lipsum[2-10]

\end{document}

enter image description here

3

The following solution employs 1 cases environment and 2 aligned environments. It also makes sure that the material fits into the narrow column of the two-column IEEEtran document setup by reducing the values of the parameters \medmuskip and thickmuskip, which govern the amount of whitespace padding that's placed around \cdot and =, respectively.

enter image description here

\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\newcommand\vn[1]{\mathit{#1}} % for "variable name"
\usepackage{mathtools,amssymb,lipsum}

\begin{document}
\[
\medmuskip=1mu    % default: 4mu
\thickmuskip=2mu  % default: 5mu
    \sigma_{ij} =
    \begin{cases}\!
    \begin{aligned}
    A &= g^{r_4}\\
    C &= g^{1/(r_4 + H(m))}
    \end{aligned}\\
    \mkern-8mu\begin{rcases}
    \begin{aligned}
    D
    &=\{K^{\alpha}\}^{r_4}\cdot\{K^{\beta}\}^{r_4}\cdot\{K^{\gamma}\}^{r_4}\cdot \dots \\[0.5ex]
    &= g^{r_4{(\prod_{\forall k}r_k)}(\sum_{\forall k} \vn{AASK}_k)}\\[1ex]
    E_i
    &= {D_{k}}^{r_4}
     = g^{r_4{(\prod_{\forall k}r_k)}(q_x(0)/t_i)}
    \end{aligned}
    \end{rcases} \scriptstyle \bigm\vert \vn{AA}_k \in \vn{GetAA}(\mathcal{T})
    \end{cases}
\]

\lipsum % generate several paragraphs of filler text
\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .