\linegoal:它在双列文档的第二列中的使用无法正常工作

\linegoal:它在双列文档的第二列中的使用无法正常工作

这是有趣的@Bernard 的后续问题回答出于某种原因,我测试了他的有趣的解决方案,如果我重复相同的等式四次,它是如何工作的:

\documentclass[twocolumn]{article}
\usepackage{amsmath}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\lipsum[1]
    \begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[0.5ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
    \end{equation}
\lipsum[2]
    \begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[0.5ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
    \end{equation}
\lipsum[3]
    \begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[0.5ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
    \end{equation}
\lipsum[4-5]
    \begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[0.5ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
    \end{equation}
\lipsum[6]
\end{document}

編輯:

令我惊讶的是,方程代码(经过两次编译)的结果与预期不一样。页面上第二列中的每个方程都有不同的格式文本:

在此处输入图片描述

我想知道,我是否在测试中忽略了某些内容,或者原因是使用的 LaTeX 安装存在一些差异。我使用 64 位 MikTeX,昨天升级了。

答案1

代码

\documentclass[twocolumn]{article}
\usepackage{linegoal}

\begin{document}

aaaa\the\linegoal

\vfill\pagebreak

aaaa\the\linegoal

\end{document}

aaaa147.27754pt第一列和第二列的输出aaaa-90.55577pt。问题是,这两列的位置计算方式相同。

适合您的情况的补丁(但不可否认它并不完全通用):如果线目标为负,我们添加\columnwidth+\columnsep

在上述情况下,我得到了aaaa147.27754pt两种情况。使用你的例子

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{linegoal}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\makeatletter
\let\Z@E@linegoal\relax % undefine the property
\zref@newprop*{linegoal}[\linewidth]{%
   \the\dimexpr
   \ifdim\dimexpr
     \linewidth -\the\pdflastxpos sp
     +\ifodd\zref@extractdefault{linegoal/posx.\the\LNGL@unique}{page}\c@page
        \oddsidemargin
     \else\evensidemargin
     \fi
     +1in+\hoffset\relax<0pt
   \columnwidth+\columnsep+\fi
   \linewidth -\the\pdflastxpos sp
   +\ifodd\zref@extractdefault{linegoal/posx.\the\LNGL@unique}{page}\c@page
      \oddsidemargin
   \else\evensidemargin
   \fi
   +1in+\hoffset
   \relax
}% linegoal zref-property
\makeatother

\begin{document}
\lipsum[1]
\begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[1ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
\end{equation}
\lipsum[2-3]
\begin{equation}
\begin{aligned}
NUP_S
    & =1- \rlap{\parbox[t]{\linegoal}{probability of successfully finishing an SU service}}\\[1ex]
    & = 1 - \frac{\lambda_S(1-P^{BL}_S)(1-P^{FT}_S)}{\lambda_S}\\
    & = P^{BL}_S + P^{FT}_S + P^{BL}_S  P^{FT}_S\\
NUP_S
    & = P^{BL}_S + P^{FT}_S - P^{BL}_S  P^{FT}_S
\end{aligned}
\end{equation}
\lipsum[4-5]
\end{document}

我们得到

在此处输入图片描述

相关内容