4

enter image description here

I am trying to use nicematrix to provide good illustration of presented material with good alignment of entries explained. I want the contents of

p1, p2, p3

to remain top aligned as shown. However, the contents of

p_{1} + p_{2} + p_{3} = 1

Must go exactly to the middle

My MWE

\documentclass{article}

\usepackage{calc}

\usepackage{nicematrix} \newlength{\widthWidest}

\begin{document}

\setlength{\widthWidest}{\widthof{weight of constant impedance, constant current,}} \begin{NiceTabularX}{\linewidth}{@{}r p[l]{\widthWidest} X[l, p]@{}}

$p_{1}, \medspace p_{2}, \medspace p_{3}$ & weight of constant impedance, constant current, and constant power components of the real portion of loads & $p_{1} + p_{2} + p_{3} = 1$

\CodeAfter
\SubMatrix{.}{1-1}{1-2}{\rbrace}

\end{NiceTabularX}

\end{document}

3 Answers3

4

I see no reason for using the whole text width; to the contrary, I see reasons not to.

\documentclass{article}

\usepackage{lipsum}

\newlength{\auxlen}

\begin{document}

\lipsum[12][1-4]
[ \settowidth{\auxlen}{% $p_{1}$, $p_{2}$, $p_{3}$\hspace{6em}$p_{1} + p_{2} + p_{3} = 1$% } \left. \begin{tabular}{@{} l p{\dimexpr\displaywidth-\auxlen} l @{}} $p_{1}$, $p_{2}$, $p_{3}$ & weight of constant impedance, constant current, and constant power components of the real portion of loads \end{tabular} \right} p_{1} + p_{2} + p_{3} = 1 ] \lipsum[19][1-3]

\end{document}

enter image description here

A different proposal

\documentclass{article}
\usepackage{amsmath}

\usepackage{lipsum}

\begin{document}

\lipsum[12][1-4]
\begin{gather} \left. \begin{tabular}{@{} l l @{}} $p_{1}$ & weight of constant impedance \ $p_{2}$ & constant current \ $p_{3}$ & constant power components \end{tabular} \right} \text{of the real portion of loads} \ p_{1} + p_{2} + p_{3} = 1 \end{gather} \lipsum[19][1-3]

\end{document}

enter image description here

egreg
  • 1,121,712
3

It's possible to produce what you want using the tabularray package by inserting the curly brace as a vertical line of the table.

enter image description here

\documentclass{article}

\usepackage{calc} \usepackage{tabularray}

\newlength{\widthWidest}

\begin{document}

\setlength{\widthWidest}{\widthof{weight of constant impedance, constant current,}}
\begin{tblr}{
    width=\linewidth,   
    colspec={@{}r h{\widthWidest} X[l, m]@{}},
    column{1}={h, mode=math},
    column{2}={rightsep=0pt},
    column{3}={mode=math},
    vline{3} = {text=$\Bigg\}$}
}
    p_{1}, \medspace p_{2}, \medspace p_{3} & weight of constant impedance, constant current, and constant power components of the real portion of loads & p_{1} + p_{2} + p_{3} = 1
\end{tblr}

\end{document}

Imran
  • 3,096
0

With the latest version of nicematrix (6.14 of 2023/02/18).

\documentclass{article}
\usepackage{calc}
\usepackage{nicematrix}
\newlength{\widthWidest}

\begin{document}

\setlength{\widthWidest}{\widthof{weight of constant impedance, constant current,}} \begin{NiceTabularX}{\linewidth}{@{}r p[l]{\widthWidest} X[l, p]@{}}

$p_{1}, \medspace p_{2}, \medspace p_{3}$ & weight of constant impedance, constant current, and constant power components of the real portion of loads & \Block[v-center]{}{$p_{1} + p_{2} + p_{3} = 1$}
\CodeAfter
\SubMatrix{.}{1-1}{1-2}{\rbrace}

\end{NiceTabularX}

\end{document}

As usual with nicematrix, you need several compilations.

Output of the above code

F. Pantigny
  • 40,250