方程参数对齐

方程参数对齐

这个问题与许多其他问题类似(实际上我使用的代码来自上一个问题的答案:如何写出完美的方程参数描述?

评论区变得太长了,我觉得开一个不同的帖子会更容易(给您带来不便,敬请谅解)

我当前的代码如下:

\usepackage{array,tabularx,calc}

\newlength{\conditionwd}
\newenvironment{conditions}[1][where:]
  {%
   #1\tabularx{\textwidth-\widthof{#1}}[t]{
     >{$}l<{$} @{${}={}$} X@{}
   }%
  }
  {\endtabularx\\[\belowdisplayskip]}

\begin{document}
\citet{hernandez1992probabilistic} further refines the PROLAM model and uses a virtual work calculation (see equation \ref{eqn:PROLAM deflection} to calculate the deflection ($\Delta$) which can be used in standard elastic deflection MOE calculations \ref{eqn:MOE4pt}.

\begin{equation}
    \Delta = \displaystyle\sum_{i=1}^{n} \left[\left(\frac{M_x m_x}{E_c I_i}+\frac{kV_xv_x}{A_iG_i}\right) \times \Delta_x \right]
    \label{eqn:PROLAM deflection}
\end{equation}

\begin{conditions}
    $\Delta$        & The total glulam beam deflection at $x$,\\
    $M_x$           & The bending moment at $x$ caused by actual loading,\\
    $m_x$           & The bending moment at $x$ caused by a unit load at the midspan of the beam,\\
    $V_x$           & The shear at $x$ caused by actual loading,\\
    $v_x$           & The shear at $x$ caused by a unit load at the midspan of the beam,\\
    $k$             & A form factor (1.2 for rectangular section),\\
    $E_c$           & A constant MOE value used in the transformed cross section,\\
    $I_i$           & The moment of inertia of the ith transformed cross section at x,\\
    $A_i$           & The transformed area at the ith transformed cross section at x,\\
    $G_i$           & The shear modulus of the ith transformed cross section at x,\\
    $\Delta_x$      & The increment at which calculations are performed,\\
    $n$             & The total number of increments along the beam length.\\
\end{conditions}

\end{document}

生成结果:

在此处输入图片描述

如您所见,参数描述产生了一个溢出框。有人知道这是为什么吗?这可能与我的其他一个有关吗\packages

答案1

你应该不是\end{equation}在和之间留一个空行\begin{conditions},否则描述可能会与等式分离。

\begin{equation}在任何情况下,前面都不应该有空行。

另一方面,如此长的变量描述很可能会产生糟糕的分页符,无论它是否脱离方程式。

对于这种情况,简单的列表环境可能更好:等号不是必需的,可以用动词代替

这是您的代码的修复版本;我做了几个小修复,您可以将它们与您的版本进行比较。在=没有大写字母之后:它们很重,与逗号不相配;ith应该是$i$that x应该总是at $x$(甚至更好,at~$x$)。以 结尾\endtabularx\\[\baselineskip]会产生警告。

\usepackage{array,tabularx,calc}

\newlength{\conditionwd}
\newenvironment{conditions}[1][where:]
  {%
   #1\tabularx{\textwidth-\widthof{#1}}[t]{
     >{$}l<{$} @{${}={}$} X@{}
   }%
  }
  {\endtabularx\\[\belowdisplayskip]}

\begin{document}
\citet{hernandez1992probabilistic} further refines the PROLAM model and uses a virtual work calculation (see equation \ref{eqn:PROLAM deflection} to calculate the deflection ($\Delta$) which can be used in standard elastic deflection MOE calculations \ref{eqn:MOE4pt}.

\begin{equation}
    \Delta = \displaystyle\sum_{i=1}^{n} \left[\left(\frac{M_x m_x}{E_c I_i}+\frac{kV_xv_x}{A_iG_i}\right) \times \Delta_x \right]
    \label{eqn:PROLAM deflection}
\end{equation}

\begin{conditions}
    $\Delta$        & The total glulam beam deflection at $x$,\\
    $M_x$           & The bending moment at $x$ caused by actual loading,\\
    $m_x$           & The bending moment at $x$ caused by a unit load at the midspan of the beam,\\
    $V_x$           & The shear at $x$ caused by actual loading,\\
    $v_x$           & The shear at $x$ caused by a unit load at the midspan of the beam,\\
    $k$             & A form factor (1.2 for rectangular section),\\
    $E_c$           & A constant MOE value used in the transformed cross section,\\
    $I_i$           & The moment of inertia of the ith transformed cross section at x,\\
    $A_i$           & The transformed area at the ith transformed cross section at x,\\
    $G_i$           & The shear modulus of the ith transformed cross section at x,\\
    $\Delta_x$      & The increment at which calculations are performed,\\
    $n$             & The total number of increments along the beam length.\\
\end{conditions}

\end{document}

某物

这里有一份清单。

\documentclass{article}
\usepackage{array,tabularx,calc}
\usepackage{natbib}
\usepackage{enumitem}

\newlength{\conditionwd}
\newenvironment{conditions}[1][where:]
  {%
   #1\tabularx{\textwidth-\widthof{#1}}[t]{
     >{$}l<{$} @{${}={}$} X@{}%>{\raggedright\arraybackslash}X@{}
   }%
  }
  {\endtabularx\par\addvspace{\belowdisplayskip}}

\begin{document}
\citet{hernandez1992probabilistic} further refines the PROLAM model and uses 
a virtual work calculation (see equation~\ref{eqn:PROLAM deflection}) to calculate 
the deflection ($\Delta$) which can be used in standard elastic deflection MOE 
calculations~\ref{eqn:MOE4pt}
\begin{equation}
    \Delta = \sum_{i=1}^{n} \left[
      \left(\frac{M_x m_x}{E_c I_i}+\frac{kV_xv_x}{A_iG_i}\right) \times \Delta_x
    \right]
    \label{eqn:PROLAM deflection}
\end{equation}
where
\begin{itemize}[labelindent=0pt,leftmargin=*,widest=$M_x$,align=left,itemsep=0pt]
\item[$\Delta$]   is the total glulam beam deflection at $x$,
\item[$M_x$]      is the bending moment at $x$ caused by actual loading,
\item[$m_x$]      is the bending moment at $x$ caused by a unit load at the midspan of the beam,
\item[$V_x$]      is the shear at $x$ caused by actual loading,
\item[$v_x$]      is the shear at $x$ caused by a unit load at the midspan of the beam,
\item[$k$]        is a form factor ($1.2$ for rectangular section),
\item[$E_c$]      is a constant MOE value used in the transformed cross section,
\item[$I_i$]      is the moment of inertia of the $i$th transformed cross section at $x$,
\item[$A_i$]      is the transformed area at the $i$th transformed cross section at $x$,
\item[$G_i$]      is the shear modulus of the $i$th transformed cross section at $x$,
\item[$\Delta_x$] is the increment at which calculations are performed,
\item[$n$]        is the total number of increments along the beam length.
\end{itemize}

\end{document}

在此处输入图片描述

答案2

环境开始的那一行有一个缩进conditions。在您的示例中,conditions环境定义为

\newenvironment{conditions}[1][where:]
  {%
   #1\tabularx{\textwidth-\widthof{#1}}[t]{
     >{$}l<{$} @{${}={}$} X@{}
   }%
  }
  {\endtabularx\\[\belowdisplayskip]}

因此,当conditions使用其可选参数的默认值调用环境时where:,将写入“where:”,并tabularx开始一个环境。它的宽度tabularx定义为\textwidth减去“where:”的宽度。因此,行首的缩进不计入 : 的宽度,正如您在图片上看到的那样,参数描述中的额外宽度与缩进的长度相匹配。因此,只需在环境之前tabularx添加即可解决间距问题。\noindentconditions

此外,tabularx调用的环境conditions已经将第一列置于数学模式,因此您不应手动放置中间每个单元格的内容$

相关内容