2010-05-27 58 views
2

我正在寻找一个程序递归内联LaTeX文件中的所有\input{}命令。通过“递归”,我的意思是迭代地进行内联,直到没有\input{}命令保留在最终的LaTeX文件中。内联LaTeX 输入命令

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

+0

我不明白。你想创建一个新文件,其中'\ input {FILE}'的每个实例已经被FILE的内容替换了吗?这个问题可能会更好地概括并标记'bash'或'shell-scripting'等等(但是,如果你这样做了,那么最终可能会有人粘贴“flatten”的内容!) – Geoff 2010-05-27 15:21:14

+0

@Geoff:谢谢为您的建议。我添加了更多标签以获得更多关注。 – reprogrammer 2010-05-27 16:08:07

+1

@Geoff:小心shell脚本建议。 “有些人在遇到问题时想'我知道,我会用正则表达式'。”现在他们有两个问题。“ - 杰米Zawinski – 2010-05-27 17:51:39

回答

6

为什么不直接从CTAN下载平板(您在问题中给出的链接)并手动安装?

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

commit 4d62b79c5145d2b5556487b483d92df797564a18 
Author: Ken Bloom <[email protected]> 
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> 
+0

如果没有人知道任何替代方案,我可能会这样做。 – reprogrammer 2010-05-27 04:29:35

+2

@reprogrammer:如果您不等待替代品,您可以在5分钟内完成此任务。 – 2010-05-27 04:33:01

+0

@ Ken Bloom:正如我预料的那样,拼合包装的质量并不高。我想这就是为什么它没有被包含在TeXLive发行版中。当我尝试制作软件包时,出现编译错误(请参阅http://drop.io/bcwnlwl上的错误) – reprogrammer 2010-05-27 16:07:16

0

或者,您可以使用FLaP。它内联\input\include指令,并支持使用\includeonly。此外,它还会移动图形文件,以便将生成的“合并”LaTeX项目包含在一个平面目录中。它支持\graphicspath,\includesvg并处理SVG,EPS和PDF图像。