menu

silverghost

世界可以想象,世界可以创造

Avatar

关于Ubuntu 用latex写论文

刚刚结束Studienarbeit,论文用latex在Windows下proTeXt编写,总体来说还很方便,但是安装和配置过程有点费劲。 在Ubuntu下总体来说比较方便,但是可能对刚刚初用Latex的人有点难度,首先做下Ubuntu的安装更新,基本的安装过程很简单

sudo apt-get install texlive


建议安装

sudo apt-get install texlive-latex-extra


如果支持不同的语言(比如德语)

sudo apt-get install texlive-lang-german 

之后为了方便起见在这里贴一段Makefile, 作者是Richard Membarth

#
# Makefile for pdfs
#

TEXINPUTS:=.//:$(TEXINPUTS)

ifeq ($(shell echo -e x), -e x)
    ECHO = echo
else
    ECHO = echo -e
endif

TEX = thesis.tex
BIB = #literature.bib
BLG = $(BIB:%.aux=%.blg)
PDF = $(TEX:%.tex=%.pdf)

all: $(PDF)

$(PDF): *.tex $(BIB)
        @$(ECHO) " *\n * pdflatex: $(TEX) > $@ \n *"; \
        ( \
    TEXINPUTS=$(TEXINPUTS) pdflatex -shell-escape $(TEX); \
    if grep -q "There were undefined references." $(TEX:.tex=.log); \
        then \
          bibtex $(TEX:.tex=); \
          TEXINPUTS=$(TEXINPUTS) pdflatex -shell-escape $(TEX); \
        fi ; \
    if grep -q "There were undefined references." $(TEX:.tex=.log); \
        then \
          TEXINPUTS=$(TEXINPUTS) pdflatex -shell-escape $(TEX); \
        fi ; \
    while grep -q "Rerun to get cross-references right." $(TEX:.tex=.log); \
        do \
          TEXINPUTS=$(TEXINPUTS) pdflatex -shell-escape $(TEX); \
        done; \
        $(ECHO) "\n\n *******************************************************************************"; \
        $(ECHO) " *                                                                             *"; \
        $(ECHO) " *   WARNING SUMMARY                                                           *"; \
        $(ECHO) " *                                                                             *"; \
    grep -i "Warning" $(TEX:.tex=.log); \
        $(ECHO) " *                                                                             *"; \
        $(ECHO) " *******************************************************************************\n"; \
        )

.PHONY: clean
clean:
        @$(ECHO) " ** Remove automatically generated files " ;\
        rm -f *.out *.bbl *.blg *.tpt *.toc *.log *.aux *.idx *.nav *.snm *.vrb *.backup *~ *.table *.gnuplot;

distclean: clean
        @rm -f $(PDF);


文件名 Makefile
生成PDF 用 make
删除临时文件 make clean
删除PDF文件 make distclean (make之前要运行一遍)