1

My goal is to reproduce the following math snippet:

enter image description here

As you can see, the equal sign in the second line comes before the first character (from left to right) in the first line. I am not able to reproduce this. I neglected the bold letter style and tried

\documentclass{article}

\usepackage{mathtools}
\usepackage{amsfonts}
\DeclareMathOperator{\ReLU}{ReLU}
\newcommand*{\R}{\mathbb{R}}
\begin{document}

\begin{align*}
\{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\} \\
= \left\{\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \right\}
\end{align*}

\end{document}

to derive

enter image description here

Any suggestions are welcomed!

1
  • 1
    please post source that produces the output shown, not fragments with undefined commnds, but use & at start of line 1 and ={}& on line 2 Aug 20, 2023 at 16:21

2 Answers 2

1

You've forgotten to use &, e.g.

\documentclass{article}

\usepackage{mathtools}
\usepackage{amsfonts}
\DeclareMathOperator{\ReLU}{ReLU}
\newcommand*{\R}{\mathbb{R}}
\begin{document}
\begin{align*}
& \{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\} \\
= & \left\{\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \right\}
\end{align*}

\end{document}

simple or

\documentclass{article}

\usepackage{mathtools}
\usepackage{amsfonts}
\DeclareMathOperator{\ReLU}{ReLU}
\newcommand*{\R}{\mathbb{R}}
\begin{document}
\begin{align*}
& \; \{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\} \\
= & \left\{\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \right\}
\end{align*}

\end{document}

improved spacing

4
  • 1
    ={}& for spacing Aug 20, 2023 at 16:22
  • @DavidCarlisle Tested, but don't see a real difference to the first example. IMHO the second one is better. But this could depend on the used fonts.
    – cabohah
    Aug 20, 2023 at 16:26
  • To more accurately reproduce the OP's target screenshot, you may want to replace \left\{ and \right\} in row 2 with \biggl\{ and \biggr\}.
    – Mico
    Aug 20, 2023 at 16:38
  • I prefer the second answer. Thanks!
    – Pazu
    Aug 20, 2023 at 16:39
1

I'd not do that way, but…

\documentclass{article}

\usepackage{mathtools}
\usepackage{amsfonts}

\DeclareMathOperator{\ReLU}{ReLU}
\newcommand*{\R}{\mathbb{R}}

\begin{document}

With the desired alignment
\begin{align*}
&    \{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\}
\\
={}& \biggl\{\,\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \biggr\}
\end{align*}
but it would be better to use \texttt{multline}
\begin{multline*}
\{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\}
\\
= \biggl\{\,\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \biggr\}
\end{multline*}
or a different version of \texttt{align}
\begin{align*}
& \{(Wv)^T \ReLU(Wv \cdot - b): W \in \R^{p \times d}, b \in \R^p\}
\\
&\qquad\qquad= \biggl\{\,\sum_{i=1}^p  w_i\ReLU(w_i \cdot -b_i): w_i, b_i \in \R \biggr\}
\end{align*}

\end{document}

Note \bigg instead of autosizing braces (they tend to be too big) and \, to avoid the clash with the subscript.

enter image description here

You must log in to answer this question.

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