帮助根据公式将数字绘制为文本(例如 [ 1-\thepage)*70+\i ] )

帮助根据公式将数字绘制为文本(例如 [ 1-\thepage)*70+\i ] )

通过谷歌搜索我发现模板\lineno无法正常工作是很常见的。displaymathifacconf.cls

我正在尝试改进我找到的用于同行评审参考的解决方法。具体来说这个

我想打印以下操作的数字结果,$(1-\thepage)*70+\i $而不仅仅是\i。有什么线索吗?

请参阅打印字面内容的最小示例"(1-"$\thepage$")*70+"$\i$

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz,everypage}
\AtBeginDocument{%
  \AddEverypageHook{%
    \begin{tikzpicture}[remember picture,overlay]
      \path (current page.north west) --  (current page.south west) \foreach \i in {1,...,\fakelinenos} { node [pos={(\i-.5)/\fakelinenos}, xshift=\fakelinenoshift, line number style] { $(1-\thepage)*70+\i $} }  ;
    \end{tikzpicture}%
  }%
}
\tikzset{%
  line numbers/.store in=\fakelinenos,
  line numbers=70,
  line number shift/.store in=\fakelinenoshift,
  line number shift=5mm,
  line number style/.style={text=gray},
}
\begin{document}
\section{problem (a), page 88}
\[
y^{\prime\prime}=\frac{1}{x^{5}}y
\]
Irregular singular point at $x\rightarrow0^{+}$.
Let $y=e^{S_{0}\left(x\right)}$ and the above becomes%
\begin{align*}
  y\left(  x\right)   &  =e^{S_{0}\left(  x\right)  }\\
  y^{\prime}\left(  x\right)   &  =S_{0}^{\prime}e^{S}\\
  y^{\prime\prime} &  =S_{0}^{\prime\prime}e^{S_{0}}+\left(  S_{0}^{\prime
  }\right)  ^{2}e^{S_{0}}\\
  &  =\left(  S_{0}^{\prime\prime}+\left(S_{0}^{\prime}\right) ^{2}\right)e^{S_{0}}
\end{align*}
Substituting back into $\frac{d^{2}}{dx^{2}}y=x^{-5}y$ gives

Hence
\begin{align*}
  S_{1}  & \thicksim-\int\frac{S_{0}^{\prime\prime}}{S_{0}^{\prime}}dx\\
  & \thicksim-\ln S_{0}^{\prime}+c
\end{align*}
\end{document}

答案1

当你想计算一个值时,你不能只把公式放在代码中,正如你所见。有几个选项可以进行计算。如果没有包,你可以使用\numexpr(例如参见如何在纯 TeX 中进行加、减、乘、除?)或者使用包,你可以使用fp 封装或者xint 束,但鉴于您已经使用,tikz您可以用它\pgfmathparse来执行计算。

此宏在参数中执行计算并将结果存储在宏中\pgfmathresult。您可以使用此宏打印计算值。计算是浮点数,因此结果将带有.0整数后缀。您可以使用\pgfmathprintnumber对值进行舍入。

对于您的计算,我期望您希望每页都有连续的数字,即第 1 页有 1-70,第 2 页有 71-140,等等。为了实现这一点,我已将您的计算修改为 而不是\thepage-11-\thepage我已手动将页码设置为 88 以显示计算结果。

梅威瑟:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz,everypage}
\AtBeginDocument{%
  \AddEverypageHook{%
    \begin{tikzpicture}[remember picture,overlay]
      \path (current page.north west) --  (current page.south west) \foreach \i in {1,...,\fakelinenos} { node [pos={(\i-.5)/\fakelinenos}, xshift=\fakelinenoshift, line number style] { \pgfmathparse{(\thepage-1)*70+\i}\pgfmathprintnumber{\pgfmathresult}} }  ;
    \end{tikzpicture}%
  }%
}
\tikzset{%
  line numbers/.store in=\fakelinenos,
  line numbers=70,
  line number shift/.store in=\fakelinenoshift,
  line number shift=5mm,
  line number style/.style={text=gray},
}
\setcounter{page}{88} % set the page number manually
\begin{document}
\section{problem (a), page 88}
\[
y^{\prime\prime}=\frac{1}{x^{5}}y
\]
Irregular singular point at $x\rightarrow0^{+}$.
Let $y=e^{S_{0}\left(x\right)}$ and the above becomes%
\begin{align*}
  y\left(  x\right)   &  =e^{S_{0}\left(  x\right)  }\\
  y^{\prime}\left(  x\right)   &  =S_{0}^{\prime}e^{S}\\
  y^{\prime\prime} &  =S_{0}^{\prime\prime}e^{S_{0}}+\left(  S_{0}^{\prime
  }\right)  ^{2}e^{S_{0}}\\
  &  =\left(  S_{0}^{\prime\prime}+\left(S_{0}^{\prime}\right) ^{2}\right)e^{S_{0}}
\end{align*}
Substituting back into $\frac{d^{2}}{dx^{2}}y=x^{-5}y$ gives

Hence
\begin{align*}
  S_{1}  & \thicksim-\int\frac{S_{0}^{\prime\prime}}{S_{0}^{\prime}}dx\\
  & \thicksim-\ln S_{0}^{\prime}+c
\end{align*}
\end{document}

结果:

在此处输入图片描述

相关内容