Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 使用makefile进行Latex编译时的Noob问题_Windows_Makefile_Latex - Fatal编程技术网

Windows 使用makefile进行Latex编译时的Noob问题

Windows 使用makefile进行Latex编译时的Noob问题,windows,makefile,latex,Windows,Makefile,Latex,我完全不懂Unix类型的命令行编译,现在我要处理一个用LaTEX编写的文档,以便使用提供的makefile进行编译 情况已经够糟了,但情况变得更糟:我在Windows下工作,安装了文档中调用的所有latex组件,包括Pygmentize,我甚至安装了Make for Windows,但仍然无法让它工作 首先,调用Make使其使用makefile时,正确的语法是什么:justmake,或Make,后跟预期的目标pdf文件名 我尝试了两种方法,第一种方法的结果是: No rule to make t

我完全不懂Unix类型的命令行编译,现在我要处理一个用LaTEX编写的文档,以便使用提供的makefile进行编译

情况已经够糟了,但情况变得更糟:我在Windows下工作,安装了文档中调用的所有latex组件,包括Pygmentize,我甚至安装了Make for Windows,但仍然无法让它工作

首先,调用Make使其使用makefile时,正确的语法是什么:justmake,或Make,后跟预期的目标pdf文件名

我尝试了两种方法,第一种方法的结果是:

No rule to make target "command" needed by "pdf". Stop.
第二个让我明白:

No rule to make target "User_manual.pdf". Stop.
我四处搜索,但所有的结果要么与我的问题无关,要么假设对整个过程的了解比我多——换句话说,我不理解答案

有人能告诉我我做错了什么吗

以下是makefile的内容(如果有任何用途):

CURRFILE=User_manual
TEXFILES := $(wildcard *.tex) $(wildcard */*.tex) $(wildcard */*/*.tex)
KBFEXAMPLES := $(wildcard KBF/*.kbf)
PYGEXAMPLES := $(wildcard KBF/*.pyg)
KBFCEXAMPLES := $(patsubst %.kbf,%.pyg,$(KBFEXAMPLES))
CHAPTERNUM := 1 2 3 4 5
PDFLATEX := $(shell command -v pdflatex 2>&1)
BIBTEX := $(shell command -v bibtex 2>&1)
MKINDEX := $(shell command -v makeindex 2>&1)
PDFOPTION=-shell-escape
DICOFILES := $(wildcard *.cfg)
# implement automatic PATH check
PYGMZE_PATH := $(shell command -v pygmentize 2>&1)
# $(shell command -v pygmentize >/dev/null 2>&1 || { @echo >&2 "Missing pygmentize in PATH."; })

all : pdf flat dico

pdf: $(PYGMZE_PATH)
ifeq ($(strip $(PYGMZE_PATH)),)
    ${info PYGMZE_PATH = $(PYGMZE_PATH)}
    $(error ERROR missing pygmentize in PATH)
endif
ifeq ($(strip $(PDFLATEX)),)
    ${info PDFLATEX = $(PDFLATEX)}
    $(error ERROR missing pdflatex in PATH)
endif
    $(PDFLATEX) $(PDFOPTION) $(CURRFILE).tex
    $(MKINDEX) $(CURRFILE).nlo -s nomencl.ist -o $(CURRFILE).nls -t $(CURRFILE).nlg
    $(BIBTEX) $(CURRFILE)
    $(PDFLATEX) $(PDFOPTION) $(CURRFILE).tex
    $(PDFLATEX) $(PDFOPTION) $(CURRFILE).tex

fast: $(KBFEXAMPLES)
    $(PDFLATEX) $(PDFOPTION) $(CURRFILE).tex

flat:
    #cleartool ls Flat.tex | grep -q CHECKEDOUT || cleartool co -q -nc Flat.tex
    latexpand $(CURRFILE).tex > Flat.tex

dico: apollo_input_dictionary.cfg

apollo_input_dictionary.cfg: Flat.tex
    echo "Generating dictionary"
    ./dictionarygen.sh

updatepyg: $(KBFEXAMPLES)

KBF/%.pyg: KBF/%.kbf
    rm $@


Tex/%.tex: updatepyg FORCE
    sed -n '1,/begin{document}/ p' $(CURRFILE).tex > _region.tex
    cat $@ >> _region.tex
    echo "\end{document}" >> _region.tex
    $(PDFLATEX) $(PDFOPTION) _region.tex
    $(PDFLATEX) $(PDFOPTION) _region.tex

clean: $(PYGEXAMPLES)
    @for f in $(PYGEXAMPLES); do mv $$f $$f.old; done
    rm -f $(TEXFILES:.tex=.aux)
    rm -f $(CURRFILE).log $(CURRFILE).dvi $(CURRFILE).bbl $(CURRFILE).blg $(CURRFILE).toc $(CURRFILE).lof $(CURRFILE).lot $(CURRFILE).ind $(CURRFILE).out $(CURRFILE).nls $(CURRFILE).nlo $(CURRFILE).nlg $(CURRFILE).kbf $(CURRFILE).dhdf $(CURRFILE).hdf

distclean: clean
    rm -f $(CURRFILE).pdf
    rm -f Flat.tex inputkeyword apollo_input_dictionary.cfg outputkeyword apollo_output_dictionary.cfg

FORCE :

stop:
    $(error ERROR make failed)
我必须按原样使用makefile,因为这是客户期望的,我只需要知道如何使它在Windows中工作


谢谢你能提供的任何帮助

如评论中所述,问题在于makefile中使用的语法,它调用Unix特定的命令,因此无法在纯Windows系统上工作。在Linux上转换包就成功了。

此makefile是为POSIX系统(如GNU/Linux)编写的。您根本无法在Windows上运行它,因为它依赖于许多POSIX外壳特性。例如,command是一个内置的外壳,它显示了相关程序的路径。很抱歉,在Windows上没有直接的方法来实现这一点。您必须为Windows重写它,或者希望安装WSL可能会有帮助,我不知道,或者在您的Windows系统上运行GNU/Linux虚拟机/Docker映像并在那里运行。非常感谢!我担心会这样,但看起来我别无选择…事实上,它在第一次尝试时就起了作用,尽管我仍然对Pygmentize和minted有异议,但那是另一个故事。。。