使用对齐时如何使用页面的两个边距?

使用对齐时如何使用页面的两个边距?

我有:

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{appendix}



\begin{document}

\begin{appendices}

\section{Reactions}

\begin{align}
\texttt{MediumGen} &\xrightarrow{\texttt{Adding}} \texttt{SalMediumStart},\\
\texttt{MediumGen} &\xrightarrow{\texttt{Removing}} \varnothing,\\
\texttt{SalMediumStart} &\xrightarrow{\texttt{FirstLanding}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} &\xrightarrow{\texttt{TakeOff}} \texttt{SalMedium},\\
\texttt{SalMedium} &\xrightarrow{\texttt{Landing}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Initiation}} \texttt{SalRuffle} +  \texttt{NrRuffle} + \texttt{CapCellSurf},\\
\texttt{SalCellSurf} + \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Joining}} \texttt{SalRuffle} + \texttt{NrRuffle} +  \texttt{CapCellSurf},\\
4 \, \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{CapBeingReached}} 4 \, \texttt{NrRuffle}.
\end{align}

\end{appendices}

\end{document}

现在,页面中显示的方程式往往位于页面的右侧,而左侧边距则未使用。我如何才能强制 LaTeX 使用边距和方程式使其位于页面中间。以下是我的问题的屏幕截图:

在此处输入图片描述

答案1

使用的解决方案geometry将页边距更改为 2cm 的包:

在此处输入图片描述

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{appendix}

\usepackage[margin=2cm]{geometry} % <---------- Added


\begin{document}

\begin{appendices}

\section{Reactions}

\begin{align}
\texttt{MediumGen} &\xrightarrow{\texttt{Adding}} \texttt{SalMediumStart},\\
\texttt{MediumGen} &\xrightarrow{\texttt{Removing}} \varnothing,\\
\texttt{SalMediumStart} &\xrightarrow{\texttt{FirstLanding}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} &\xrightarrow{\texttt{TakeOff}} \texttt{SalMedium},\\
\texttt{SalMedium} &\xrightarrow{\texttt{Landing}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Initiation}} \texttt{SalRuffle} +  \texttt{NrRuffle} + \texttt{CapCellSurf},\\
\texttt{SalCellSurf} + \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Joining}} \texttt{SalRuffle} + \texttt{NrRuffle} +  \texttt{CapCellSurf},\\
4 \, \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{CapBeingReached}} 4 \, \texttt{NrRuffle}.
\end{align}

\end{appendices}

\end{document}

您的内容很长,除了更改页面尺寸外,我不确定如何强制内容适合每行,我发布这个答案只是因为它适用于您发布的代码。


要仅更改某个部分的几何形状,请使用\newgeometry,然后\restoregeometry如下所示:

在此处输入图片描述

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{appendix}

\usepackage[pass]{geometry} % <---------- https://tex.stackexchange.com/q/214820/273733
\usepackage{lipsum}

\begin{document}

\chapter{Test page}
\lipsum[1-5]
\newpage



\begin{appendices}
\newgeometry{margin=2cm}
\section{Reactions}

\begin{align}
\texttt{MediumGen} &\xrightarrow{\texttt{Adding}} \texttt{SalMediumStart},\\
\texttt{MediumGen} &\xrightarrow{\texttt{Removing}} \varnothing,\\
\texttt{SalMediumStart} &\xrightarrow{\texttt{FirstLanding}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} &\xrightarrow{\texttt{TakeOff}} \texttt{SalMedium},\\
\texttt{SalMedium} &\xrightarrow{\texttt{Landing}} \texttt{SalCellSurf},\\
\texttt{SalCellSurf} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Initiation}} \texttt{SalRuffle} +  \texttt{NrRuffle} + \texttt{CapCellSurf},\\
\texttt{SalCellSurf} + \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{Joining}} \texttt{SalRuffle} + \texttt{NrRuffle} +  \texttt{CapCellSurf},\\
4 \, \texttt{NrRuffle} + \texttt{CapCellSurf} &\xrightarrow{\texttt{CapBeingReached}} 4 \, \texttt{NrRuffle}.
\end{align}
\restoregeometry
\end{appendices}

\end{document}

答案2

您需要使用标准文本宽度将术语拆分到多行中。

\documentclass[11pt]{article}

%\usepackage[utf8]{inputenc}% not needed
%\usepackage{amsmath}% loaded by mathtools
\usepackage{mathtools}
%\usepackage{amsfonts}% not needed
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{appendix}


\begin{document}

\begin{appendices}

\section{Reactions}

\begin{align}
\mathtt{MediumGen}
  &\xrightarrow{\mathtt{Adding}}
  \mathtt{SalMediumStart},
\\
\mathtt{MediumGen}
   &\xrightarrow{\mathtt{Removing}}
   \varnothing,
\\
\mathtt{SalMediumStart}
  &\xrightarrow{\mathtt{FirstLanding}}
  \mathtt{SalCellSurf},
\\
\mathtt{SalCellSurf}
  &\xrightarrow{\mathtt{TakeOff}}
  \mathtt{SalMedium},
\\
\mathtt{SalMedium}
  &\xrightarrow{\mathtt{Landing}}
  \mathtt{SalCellSurf},
\\
\mathtt{SalCellSurf} + \mathtt{CapCellSurf}
  &\xrightarrow{\mathtt{Initiation}}
  \begin{multlined}
    \mathtt{SalRuffle} +  \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf},
  \end{multlined}
\\
\begin{multlined}
  \mathtt{SalCellSurf} + \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf}
\end{multlined}
  &\xrightarrow{\mathtt{Joining}}
  \begin{multlined}
    \mathtt{SalRuffle} + \mathtt{NrRuffle} \\ +  \mathtt{CapCellSurf},
  \end{multlined}
\\
4 \, \mathtt{NrRuffle} + \mathtt{CapCellSurf}
  &\xrightarrow{\mathtt{CapBeingReached}}
  4 \, \mathtt{NrRuffle}.
\end{align}

\end{appendices}

\end{document}

在此处输入图片描述

不过,我会考虑左对齐。

\documentclass[11pt]{article}

%\usepackage[utf8]{inputenc}% not needed
%\usepackage{amsmath}% loaded by mathtools
\usepackage{mathtools}
%\usepackage{amsfonts}% not needed
\usepackage{amssymb}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{appendix}


\begin{document}

\begin{appendices}

\section{Reactions}

\begin{align}
&\mathtt{MediumGen}
  \xrightarrow{\mathtt{Adding}}
  \mathtt{SalMediumStart},
\\
&\mathtt{MediumGen}
   \xrightarrow{\mathtt{Removing}}
   \varnothing,
\\
&\mathtt{SalMediumStart}
  \xrightarrow{\mathtt{FirstLanding}}
  \mathtt{SalCellSurf},
\\
&\mathtt{SalCellSurf}
  \xrightarrow{\mathtt{TakeOff}}
  \mathtt{SalMedium},
\\
&\mathtt{SalMedium}
  \xrightarrow{\mathtt{Landing}}
  \mathtt{SalCellSurf},
\\
&\mathtt{SalCellSurf} + \mathtt{CapCellSurf}
  \xrightarrow{\mathtt{Initiation}}
  \begin{multlined}
    \mathtt{SalRuffle} +  \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf},
  \end{multlined}
\\
&\begin{multlined}
  \mathtt{SalCellSurf} + \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf}
\end{multlined}
  \xrightarrow{\mathtt{Joining}}
  \begin{multlined}
    \mathtt{SalRuffle} + \mathtt{NrRuffle} \\ +  \mathtt{CapCellSurf},
  \end{multlined}
\\
&4 \, \mathtt{NrRuffle} + \mathtt{CapCellSurf}
  \xrightarrow{\mathtt{CapBeingReached}}
  4 \, \mathtt{NrRuffle}.
\end{align}

\end{appendices}

\end{document}

在此处输入图片描述

答案3

我想知道在这种情况下是否也可以使用包Reactions的模块chemmacros。该模块基于align环境,并与chemformula提供大量调整排版等功能。不幸的是,使用会导致很多错误。可能是由于使用宏解析环境multlined内容的方式。reactions\ch{}chemformula

尽管如此,我还是想提供这个 MWE 作为替代选择。

\documentclass[11pt]{article}

\usepackage[a4paper,margin=2cm]{geometry}

\usepackage[modules={reactions}]{chemmacros}
\chemsetup{formula=chemformula}
\chemsetup[chemformula]{format=\ttfamily}
\chemsetup[reactions]{before-tag = \textbf, tag-open = [ , tag-close = ]}

\usepackage[charter]{mathdesign} % can be used to set greek mapping in chemmacros

%\usepackage[utf8]{inputenc}% not needed
%\usepackage{amsmath}% loaded by mathtools
%\usepackage{mathtools} % loaded by chemmacros
%\usepackage{amsfonts}% not needed
%\usepackage{amssymb} % using mathdesign as alternative
%\usepackage{adjustbox} % not needed in this example
%\usepackage{multirow}  & ibid
\usepackage{appendix}


\begin{document}
    
    \begin{appendices}

        \section{Reactions}
        
        This section contains the original answer by egreg to the posed question:
        
        \begin{align}
            \mathtt{MediumGen}
            &\xrightarrow{\mathtt{Adding}}
            \mathtt{SalMediumStart},
            \\
            \mathtt{MediumGen}
            &\xrightarrow{\mathtt{Removing}}
            \varnothing,
            \\
            \mathtt{SalMediumStart}
            &\xrightarrow{\mathtt{FirstLanding}}
            \mathtt{SalCellSurf},
            \\
            \mathtt{SalCellSurf}
            &\xrightarrow{\mathtt{TakeOff}}
            \mathtt{SalMedium},
            \\
            \mathtt{SalMedium}
            &\xrightarrow{\mathtt{Landing}}
            \mathtt{SalCellSurf},
            \\
            \mathtt{SalCellSurf} + \mathtt{CapCellSurf}
            &\xrightarrow{\mathtt{Initiation}}
            \begin{multlined}
                \mathtt{SalRuffle} +  \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf},
            \end{multlined}
            \\
            \begin{multlined}
                \mathtt{SalCellSurf} + \mathtt{NrRuffle} \\ + \mathtt{CapCellSurf}
            \end{multlined}
            &\xrightarrow{\mathtt{Joining}}
            \begin{multlined}
                \mathtt{SalRuffle} + \mathtt{NrRuffle} \\ +  \mathtt{CapCellSurf},
            \end{multlined}
            \\
            4 \, \mathtt{NrRuffle} + \mathtt{CapCellSurf}
            &\xrightarrow{\mathtt{CapBeingReached}}
            4 \, \mathtt{NrRuffle}.
        \end{align}
    
    \section{Alternative reactions}
    
    This section uses the Reactions module of the chemmacros package. Unfortunately that module doesn't allow the use of the multlined environment.
    
    \begin{reactions}
        MediumGen   &->[Adding] SalMediumStart, 
        \\
        MediumGen   &->[Removing]   \varnothing, 
        \\
        SalMediumStart  &->[FirstLanding]   SalCellSurf,
        \\
        SalCellSurf &->[TakeOff]    SalMedium,
        \\
        SalMedium   &->[Landing]    SalCellSurf,
        \\
        SalCellSurf + CapCellSurf &->[Initiation]   
%       \begin{multlined}
            SalRuffle +  NrRuffle  + CapCellSurf,
%       \end{multlined}
        \\
%       \begin{multlined}
        SalCellSurf + NrRuffle  + CapCellSurf
%       \end{multlined}
        &->[Joining]
%       \begin{multlined}
            SalRuffle + NrRuffle  +  CapCellSurf,
%       \end{multlined}
        \\
        4 \, NrRuffle + CapCellSurf &->[CapBeingReached]    4 \, NrRuffle.
    \end{reactions}
        
    \end{appendices}
    
\end{document}

反应_ttfamily

相关内容