obster-y / XJTU-thesis

西安交通大学学位论文模板(LaTeX)(适用硕士、博士学位)An official LaTeX template for Xi'an Jiaotong University degree thesis (Chinese and English)
LaTeX Project Public License v1.3c
231 stars 52 forks source link

[TeX] txsprofile修改咨询 #119

Closed Atletico1999 closed 8 months ago

Atletico1999 commented 8 months ago

软件信息

问题说明 [latexmk]编译失败,但在命令行中[xelatex+biber]可正常编译 由于命令行操作切换麻烦,现想在版主提供的txsprofile中进行个性化修改定制 网上关于txsprofile的文档较少,想问下如何增加texstudio中新增的按钮数量呢? 已将txsprofile文件作如下修改(更改了user0, user1及Display Names)

[texmaker] Tools\Commands\user0="xelatex %" Tools\Commands\user1="biber % " && "makeglossaries %" Tools\Log%20Paths=Build/ Tools\PDF%20Paths=Build/ Tools\Display%20Names=xelatex, biber Tools\User%20Order=user0, user1 ToolsToolBar=main/tools/quickbuild, main/tools/compile, main/tools/stopcompile, main/tools/view, main/tools/viewlog, main/tools/user/cmd0, main/tools/user/cmd1, main/tools/clean CleanDialog\Extensions="acn,acr,alg,aux,bbl,bcf,blg,brf,fdb_latexmk,fls,glg,glo,gls,hd,idx,ilg,ind,ist,lof,log,lot,nav,out,run.xml,thm,toc,toe,dvi,slg,slo,sls,snm,xdv,xdy,listing" CleanDialog\Scope=3 Spell\Language=\<none>

想通过第二个按钮执行两个命令,但只运行了“biber main”,没有运行“makeglossaries main” 请教一下如何在一段Tools\Commands中执行两端命令(先后运行biber main和makeglossaries main),或者如何再增加一个按钮呢(设置成makeglossaries %)?谢谢! texstudio工具栏按钮

sikouhjw commented 8 months ago

我觉得解决“latexmk 不能编译”的问题比较重要

Atletico1999 commented 8 months ago

使用latexmk的话,命令行和texstudio都报错 我看之前一些人也遇到这样的问题了

命令行latexmk PS C:\Users\10152\Desktop\……> latexmk main Initial Win CP for (console input, console output, system): (CP936, CP936, CP936) I changed them all to CP936 Rc files read: latexmkrc Latexmk: This is Latexmk, John Collins, 7 Jan. 2023. Version 4.79. Latexmk: Nothing to do for 'main.tex'. Latexmk: All targets (Build/main.pdf) are up-to-date Collected error summary (may duplicate other messages): bibtex main: gave an error xelatex: gave an error

Latexmk: If appropriate, the -f option can be used to get latexmk to try to force complete processing. D:\Program Files\texlive\2023\bin\windows\runscript.tlu:921: command failed with exit code 12: perl.exe "d:\Program Files\texlive\2023\texmf-dist\scripts\latexmk\latexmk.pl" main

PS C:\Users\10152\Desktop\……> latexmk main -r latexmkrc Initial Win CP for (console input, console output, system): (CP936, CP936, CP936) I changed them all to CP936 Latexmk: A user -r option asked me to process an rc file an extra time. Name of file = 'latexmkrc' Abs. path = 'C:\Users\10152\Desktop\……\毕业论文latex\latexmkrc' I'll not process it Rc files read: latexmkrc Latexmk: This is Latexmk, John Collins, 7 Jan. 2023. Version 4.79. Latexmk: Nothing to do for 'main.tex'. Latexmk: All targets (Build/main.pdf) are up-to-date Collected error summary (may duplicate other messages): bibtex main: gave an error xelatex: gave an error

Latexmk: If appropriate, the -f option can be used to get latexmk to try to force complete processing. D:\Program Files\texlive\2023\bin\windows\runscript.tlu:921: command failed with exit code 12: perl.exe "d:\Program Files\texlive\2023\texmf-dist\scripts\latexmk\latexmk.pl" main -r latexmkrc

2.texstudio预设(txsprofile)按钮-latexmk 最后几段的报错信息如下

Processing index... [10%] [20%] [30%] [40%] [50%] [60%] [70%] [80%] [90%] [100%] Finished processing index.

Writing markup... [10%] [20%] [30%] [40%] [50%] [60%] [70%] [80%] [90%] [100%] Markup written into file "main.gls".

Latexmk: applying rule 'bibtex main'... Rule 'bibtex main': Reasons for rerun Category 'other': Rerun of 'bibtex main' forced or previously required


Run number 1 of rule 'bibtex main'



Running 'bibtex "main.aux"'


This is BibTeX, Version 0.99d (TeX Live 2023) The top-level auxiliary file: main.aux I found no \citation commands---while reading file main.aux I found no \bibdata command---while reading file main.aux I found no \bibstyle command---while reading file main.aux (There were 3 error messages)

Latexmk: Errors, so I did not complete making targets Collected error summary (may duplicate other messages): bibtex main: Bibtex errors: See file 'main.blg' xelatex: Command for 'xelatex' gave return code 1 Refer to 'Build/main.log' and/or above output for details

Latexmk: If appropriate, the -f option can be used to get latexmk to try to force complete processing. D:\Program Files\texlive\2023\bin\windows\runscript.tlu:921: command failed with exit code 12: perl.exe "d:\Program Files\texlive\2023\texmf-dist\scripts\latexmk\latexmk.pl" -r latexmkrc main 出现错误

Atletico1999 commented 8 months ago

我觉得解决“latexmk 不能编译”的问题比较重要

txsprofile那儿怎么调整呢,这个应该好弄一点

sikouhjw commented 8 months ago

从报错中可以看出,latexmk 调用了 bibtex,而本模板需要的是 biber https://github.com/obster-y/XJTU-thesis/blob/6d815a8458cb94e8c3c997ebdb5ba53736ec34cc/latexmkrc#L12 应该解决这个问题

Atletico1999 commented 8 months ago

我把latexmk.pl中调用修改为biber($bib_program = 'biber'),会有其他错误 stackexchange - Using Biber with latexmk copyprogramming - Using Biber with latexmk

有时候在texstudio用预设的 latexmk -r latexmkrc "main" 报错不一样 .bcf、.bbl、chap1.aux相关的地方会出错 不太好弄 下面是另一种报错


Transcript written on Build/main.log.

Latexmk: Missing input file 'Chapter/chap1.aux' (or dependence on it) from following: No file Chapter/chap1.aux. Latexmk: Missing bbl file 'Build/main.bbl' in following: No file main.bbl. Latexmk: Getting log file 'Build/main.log' Latexmk: Examining 'Build/main.fls' Latexmk: Examining 'Build/main.log' Latexmk: Log file says output to 'Build/main.xdv'

Latexmk: If appropriate, the -f option can be used to get latexmk to try to force complete processing. Latexmk: Bibliography file(s) form .bcf file: ./References/achievement.bib ./References/reference.bib Latexmk: Errors, so I did not complete making targets Collected error summary (may duplicate other messages): xelatex: Command for 'xelatex' gave return code 1 Refer to 'Build/main.log' and/or above output for details

D:\Program Files\texlive\2023\bin\windows\runscript.tlu:921: command failed with exit code 12: perl.exe "d:\Program Files\texlive\2023\texmf-dist\scripts\latexmk\latexmk.pl" -r latexmkrc main 出现错误


sikouhjw commented 8 months ago

先清除辅助文件(aux、log、bbl 等),再用命令行编译

xelatex main
biber main
xelatex main
xelatex main

注意,需要使用命令行编译而不是 texstudio,因为命令行编译的报错是最直接的。

Atletico1999 commented 8 months ago

先清除辅助文件(aux、log、bbl 等),再用命令行编译

xelatex main
biber main
xelatex main
xelatex main

注意,需要使用命令行编译而不是 texstudio,因为命令行编译的报错是最直接的。

这种方法没问题,前面也描述过这个情况了 问下txsprofile这个设置的问题方便进行调整嘛

obster-y commented 8 months ago

很久没用过 TeXStudio 了,我都忘记我还上传过这个文件。刚回去看了一眼,我觉得可以考虑不要用我传的 txprofile,直接 reset 软件后重新配置,缩小一下问题范围。我隐约觉得是通过 TeXStudio 调用的 latexmk 没有读到 latexmkrc 文件。建议: 清除所有临时文件后重新用 latexmk 在命令行编译,带上 -c latexmkrc 相关的参数。如果能正常,那重置 txprofile,直接按照网上教程配置参数吧。

Atletico1999 commented 8 months ago

很久没用过 TeXStudio 了,我都忘记我还上传过这个文件。刚回去看了一眼,我觉得可以考虑不要用我传的 txprofile,直接 reset 软件后重新配置,缩小一下问题范围。我隐约觉得是通过 TeXStudio 调用的 latexmk 没有读到 latexmkrc 文件。建议: 清除所有临时文件后重新用 latexmk 在命令行编译,带上 -c latexmkrc 相关的参数。如果能正常,那重置 txprofile,直接按照网上教程配置参数吧。

好的谢谢!