使用 Windows+miktex 和 macOS+mactex 之间(在兼容性方面)有什么区别吗?

使用 Windows+miktex 和 macOS+mactex 之间(在兼容性方面)有什么区别吗?

我在 macOS 上使用以下方式编译文档时遇到问题Texpad + mactex该文件最初写于视窗虽然作者使用米克泰克斯分配。

这些不兼容是一个常见问题吗?错误可能出在文档的模板上,但我不能百分之百确定。

谢谢。

这是我的错误(我之前在这里发布过,但被要求提供导致问题的类的定义/示例),这是 \X@artonum 类的错误。


我在构建同事发来的项目时遇到此错误。文档结构在模板中定义。能否从此错误中读出一些信息:

    \@begindocumenthook ...ter \X@rtonum \r@FirstPage 
                                                  } \setcounter {numpages}{-...
l.3 \begin{document}

./m_2019.tex:3: Argument of \X@rtonum has an extra }.
<inserted text> 
                \par 
l.3 \begin{document}

Runaway argument?
./m_2019.tex:3: Paragraph ended before \X@rtonum was complete.
<to be read again> 
                   \par 
l.3 \begin{document}

./m_2019.tex:3: Missing number, treated as zero.
<to be read again> 
                   \par 
l.3 \begin{document}

Runaway argument?
./m_2019.tex:3: Paragraph ended before \calc@post@scan was complete.
<to be read again> 
                   \par 
l.3 \begin{document}

这是的定义\X@rtonum\r@FirstPage以防万一它可能有助于解决这个问题(我仍然无法编译该.tex文档):

% counter that will store the total number of pages
\newcounter{numpages}
% this all has to be done after .aux is read
\AtBeginDocument{
  % make sure these two cross-referencing commands are defined, at least to \relax
  \@ifundefined{r@FirstPage}{\relax}{\relax}
  \@ifundefined{r@LastPage}{\relax}{\relax}
  % \X@rtonum gets the page number from an \r@... command
  \@ifpackageloaded{hyperref}{\def\X@rtonum#1#2#3#4#5{#2}}{\def\X@rtonum#1#2{#2}}
  % start with zero
  \setcounter{numpages}{0}
  % define \X@FirstPage to store the first page number
  \ifx\r@FirstPage\relax
    % we store 0 if nothing better is availible
    \gdef\X@FirstPage{0}
  \else
    % we store the real value of \pageref{FirstPage}, just the problem is that \pageref itself is unexpandable
    \xdef\X@FirstPage{\expandafter\X@rtonum\r@FirstPage}
    % the larger FirstPage, the smaller number of pages
    \setcounter{numpages}{-\X@FirstPage}
    % correction by 1
    \stepcounter{numpages}
  \fi
  % the same again for LastPage
  \ifx\r@LastPage\relax
    \gdef\X@LastPage{0}
  \else
    \xdef\X@LastPage{\expandafter\X@rtonum\r@LastPage}
    % the larger LastPage, the larger number of pages
    \addtocounter{numpages}{\X@LastPage}
  \fi
  % \AP@page stores the correct first page number
  \ifdefined\AP@page
    \setcounter{page}{\AP@page}
  \fi
}
% \AP@{<article>}{<key>}{<value>} is stored in the file <issue>.ap and is loaded at the end of the class-file
\def\AP@#1#2#3{
  \begingroup
    % store the <article> key
    \edef\reserved@a{#1}%
    % define \AP@<key> = <value> but only if <article> is correct
    \ifx\reserved@a\X@articlename\relax
      \expandafter\xdef\csname AP@#2\endcsname{#3}%
    \fi
  \endgroup
}

这是 m_paper.tex

\documentclass[eprint]{publisher}

\begin{document}

\title[Evaluation of Hopkinson Bar Experiments using multiple DIC tools]{Evaluation of Hopkinson Bar Experiments using multiple Digital
Image Correlation Software Tools}
\correspondingauthor[Joe Doe]{Joe Doe}{my}{[email protected]}
\author[J. Doe]{John Doe}{their}
\author[J. Doe_2]{Joh Doe_2}{my}
\author[J. D\'{a}mal]{John D\'{a}mal }{my}
\author[J. D\'{a}mal]{J. D\'{a}mal}{my}
\institution{my}{University Czech}
\institution{their}{University Germany} 

\begin{abstract}
This is abstract
\end{abstract}

\keywords{keyword_1, keyword_2, keyword_3, keyword_4}

\maketitle
\section{Introduction}

First section


\begin{acknowledgements}
\mbox{The research was supported by ...}
\end{acknowledgements}


\bibliographystyle{publisher}
\bibliography{biblio}

\end{document}

答案1

该类无法在当前的 texsystem 中工作,可能是 miktex 或 texlive,它包含\@ifundefined{r@FirstPage}{\relax}{\relax}依赖于不再存在的副作用的代码()。

作为一种解决方法,您可以尝试将以下内容添加到序言中:

\makeatletter
\let\r@FirstPage\relax
\let\r@LastPage\relax
\makeatother

答案2

shell-escape除非文档使用(\write18)并运行 Windows 命令, 否则 miktex 和 texlive/mactex 在文档级别基本上没有区别。

更有可能的是,两个系统安装了不同版本的 latex 和软件包,即使两个系统都运行 miktex 或 texlive,也会发生这种情况。

添加\listfiles并比较您的日志文件。

相关内容