【发布时间】:2015-04-16 23:50:47
【问题描述】:
我正在尝试使用 makefile 来在 LaTex 中编译我的故事。我正在尝试使用变量来完成我的故事的文件名。如果我简单地运行 make,它就可以工作。但是,我需要能够从 make 运行特定命令。
pdflatex "\\def\\isdraft{1} \\input{FMPGC.tex}"
我将如何从 PROJ + OBJS 创建一个变量,以便我可以做一些类似于我在下面尝试做的事情。如果我为 make draft 运行以下代码,它会失败并且似乎在 FMPGC 和 tex 之间添加了许多空格。
如何将两个变量与“。”结合起来这对之间的符号,所以我可以在下面的命令中编译我的故事。我也尝试过不转义 \ 符号,这似乎没有效果。
# This makefile compiles my story using LaTex
# Author:
#
# VARS - Variables to be changed for reuse of my script
PROJ = "FMPGC" # The name of the project
OBJS = "tex" # The extension for the content
AUXS = "aux" # The aux extensions
CHAP = "chapters/" # The chapters
FOO = $(PROJ) += "."
F002 = $(FOO) += $(OBJS)
# Configuration:
CC = pdflatex # The compiler
# Rules
all:
$(CC) $(PROJ).$(OBJS)
draft:
$(CC) "\\def\\isdraft{1} \\input{$(FOO2)}"
当前的错误来自它没有向变量中输入任何内容 -
pdflatex "\\def\\isdraft{1} \\input{}"
下面似乎是确切的问题。
<*> \def\isdraft{1} F
MPGC.tex
---------------- 更新了 Make 文件
# This makefile compiles my story using LaTex
# Author:
#
# VARS - Variables to be changed for reuse of my script
# The name of the project
PROJ:=FMPGC
# The extension for the content
OBJS:=tex
# The aux extensions
AUXS:=aux
# The chapters
CHAP:=chapters/
# Configuration:
# The compiler
CC=pdflatex
# Rules
all:
$(CC) $(PROJ).$(OBJS);
draft:
$(CC) "\def\isdraft{1} $(PROJ).$(OBJS)";
更新错误----
pdflatex "\def\isdraft{1} FMPGC.tex";
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 21 languages loaded.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
<*> \def\isdraft{1} F
MPGC.tex
?
! Emergency stop.
...
<*> \def\isdraft{1} F
MPGC.tex
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.
【问题讨论】:
-
FOO = $(PROJ) += "."和F002 = $(FOO) += $(OBJS)行是怎么回事?你到底想在那里做什么?还有为什么第二行是F002而不是FOO2? (您似乎在draft目标中使用了$(FOO2)。) -
我删除了该部分。我试图将这两个变量结合起来,使其成为带有 .之间。请查看我的错误以及我在编辑中所做的更改。
-
命令行看起来不错,只是错误似乎有奇怪的间距(这可能是 pdflatex 的事情)。
\def\isdraft{1}和文件名应该是pdflatex的单个参数吗? -
我修好了。我会尽可能添加答案。万分感谢!这是我声明我的变量错误并且没有语法的组合。