sj latex 示例文件无法使用 miktex 23.10.12 进行编译

sj latex 示例文件无法使用 miktex 23.10.12 进行编译

我正在尝试使用 Stata do 文件编写一个 latex 文件,以便包含我的 Stata 工作。

我使用的是 texdoc 和 sjlatex 包。为了理解这个过程,我遵循了文章。

但是,加载的示例文件没有被编译。我正在使用 Miktex 23.10.12。

具体来说,以下是示例tex文件的代码。

\documentclass[a4paper]{article}
\usepackage{stata}
\begin{document}

\section*{Exercise 1}
Open the 1978 Automobile Data and summarize the variables.

\begin{stlog}\input{example1_1.log.tex}\end{stlog}

\section*{Exercise 2}
Run a regression of price on milage and weight.

\begin{stlog}\input{example1_2.log.tex}\end{stlog}

\end{document}

我在工作目录中获得了上述两个 tex 格式的日志文件。

我在安装了 sjlatex 文件的工作目录中。

编译时出现以下错误:

! Undefined control sequence.
l.51 \ifluatex

这里的 l.51 是 stata.sty 文件中的行。

我已经尝试更新我的 MikTex 发行版。

提前致谢。

答案1

最好的解决方案是在安装 sjlatex 时,在安装到工作目录中的文件的\RequirePackage{iftex} 第 51 行之前添加: stata.sty

\usepackage{iftex}否则,在 stata do 文件中的每个 tex 代码中,必须在 之前添加一行\usepackage{stata}。(来源:David Carlisle)

相关内容