我正在使用tufte-book
,并且我希望我的所有align
环境默认都是全宽的。
最小工作示例;
\documentclass[
a4paper,
nofonts,
justified
]{tufte-book}
\usepackage{amsmath}
\begin{document}
This paragraph is regular-width, and leaves space for a margin notes column to the right.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vel facilisis volutpat est velit egestas dui id. Tempor nec feugiat nisl pretium fusce id. Venenatis tellus in metus vulputate eu. Quam elementum pulvinar etiam non quam lacus. Facilisi cras fermentum odio eu feugiat pretium nibh ipsum consequat. Sed lectus vestibulum mattis ullamcorper velit sed ullamcorper.
\begin{fullwidth}
This paragraph is full-width, and bleeds into the margin notes column.
Magna eget est lorem ipsum dolor sit amet. Enim eu turpis egestas pretium aenean pharetra magna. Massa placerat duis ultricies lacus. Cras ornare arcu dui vivamus arcu. Urna molestie at elementum eu facilisis sed odio morbi. Odio ut sem nulla pharetra diam sit amet nisl. Eu facilisis sed odio morbi quis commodo odio aenean. Mi tempus imperdiet nulla malesuada pellentesque elit. Id aliquet lectus proin nibh. Pulvinar sapien et ligula ullamcorper malesuada proin.
\end{fullwidth}
I want all \texttt{align} environments to be full-width, as in the below example;
\begin{fullwidth}
\begin{align}
Z_\theta &= \sum_{\tau \in T} q(\tau) e^{R(\tau)}
\\
&= \sum_{\tau \in T}
p_0(s_1) \prod_{t=1}^{|\tau|-1} p(s_{t+1} \mid s_t, a_t)
\sum_{t=1}^{\abs{\tau}} \gamma^{t-1} R_s(s_t) + \sum_{t=1}^{\abs{\tau}-1} \gamma^{t-1} \big( R_{sa}(s_t, a_t) + R_{sas'}(s_t, a_t, s_{t+1}) \big)
\end{align}
\end{fullwidth}
But I don't want to manually type \verb+\begin{fullwidth} ... \end{fullwidth}+ every time.
\begin{align}
Z_\theta &= \sum_{\tau \in T} q(\tau) e^{R(\tau)}
\\
&= \sum_{\tau \in T}
p_0(s_1) \prod_{t=1}^{|\tau|-1} p(s_{t+1} \mid s_t, a_t)
\sum_{t=1}^{\abs{\tau}} \gamma^{t-1} R_s(s_t) + \sum_{t=1}^{\abs{\tau}-1} \gamma^{t-1} \big( R_{sa}(s_t, a_t) + R_{sas'}(s_t, a_t, s_{t+1}) \big)
\end{align}
\end{document}
我相信etoolbox
在这里可能有用,但我似乎找不到正确的命令。
答案1
在写这道题的过程中,我找到了答案!
% Make all \align blocks full-width
\usepackage{etoolbox}
\BeforeBeginEnvironment{align}{\begin{fullwidth}}
\AfterEndEnvironment{align}{\end{fullwidth}}