bash - 内联 LaTeX\input 命令

标签 bash latex shell tex text-processing

我正在寻找一个程序来递归内联 LaTeX 文件中的所有 \input{} 命令。我所说的“递归”是指迭代地进行内联,直到最终的 LaTeX 文件中不再存在 \input{} 命令为止。

我已经遇到过 flatten包裹。但是,由于某种原因,我的 TeXLive 发行版没有安装它。当我执行命令 sudo tlmgr show flatten 时,收到错误消息:tlmgr: 找不到 flatten。因此,我正在寻找更标准且更易于安装的替代工具。

最佳答案

为什么不从 CTAN(您在问题中提供的链接)下载flatten并手动安装?

编辑:应用以下补丁来修复构建错误。

commit 4d62b79c5145d2b5556487b483d92df797564a18
Author: Ken Bloom <<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0368616f6c6c6e43646e626a6f2d606c6e" rel="noreferrer noopener nofollow">[email protected]</a>>
Date:   Thu May 27 12:45:49 2010 -0500

    fix build errors

diff --git a/flatten.l b/flatten.l
index 85ffee5..da12d2d 100644
--- a/flatten.l
+++ b/flatten.l
@@ -62,6 +62,7 @@ char FILE_DATE[] = "October 1995";
  */


+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -641,7 +642,7 @@ FILE *f3;
 char *strsave(s)
 char *s;                           /* string to be saved */
 {
-  char *p, *malloc();
+  char *p;

   if ((p = malloc(strlen(s)+1)) != NULL) {
      strcpy(p, s);
@@ -834,4 +835,4 @@ void initialise_senv()
   strcpy(path_sep," :;");                /* path seperators */
   dir_cat = '/';                         /* directory catenation char */
   senv_debug = 0;                        /* debugging off */
-}                                      /* end INITIALISE_SENV */
\ No newline at end of file
+}                                      /* end INITIALISE_SENV */
diff --git a/getopt.c b/getopt.c
index 5131cfa..b35cf51 100644
--- a/getopt.c
+++ b/getopt.c
@@ -6,6 +6,7 @@
 /* getopt()  from Don Libes "Obfuscated C" */


+#include <string.h>
 #include <stdio.h>

 /* getopt()  -- parse command line arguments */
@@ -21,10 +22,6 @@
      fprintf(stderr, s, (unsigned)strlen(s));\
      fprintf(stderr, errbuf, 2);}

-extern int strcmp();
-extern char *strchr();
-extern int strlen();
-
 int opterr = 1;    /* getopt prints errors if this is one */
 int optind = 1;    /* token pointer */
 int optopt;        /* option character passed back to user */
diff --git a/srchenv.c b/srchenv.c
index fa3e8d8..f8acd48 100644
--- a/srchenv.c
+++ b/srchenv.c
@@ -4,6 +4,7 @@
 /* strtol() from C standard library (not all compilers find this)  */


+#include <string.h>
 #include <stdio.h>

关于bash - 内联 LaTeX\input 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2918449/

相关文章:

用于检查进程是否正在运行并在没有运行时重新启动的 Linux 脚本

linux - Bash 脚本为不同的用户返回不同的结果

latex - 如何在 .tex 或 latex 文档中插入实际或当前文件名(我在文件夹中保存的文件名)?

python - 在 fabric 脚本的 psql 命令中转义引号

bash - Bash 中的位掩码

macos - bash:ps grep用于Umlaut(OS X)处理

linux - 导出在另一个文件中定义的变量

emacs - 导出到 LaTeX 时,使组织模式表格标题显示在表格下方

r - 用于可重复研究的自动化文本

linux - 只提取 url 段而不是 shell 脚本中的以下正则表达式?