我安装了最新版本的 TexStudio (2.12.6),几天前一切都很好,但突然书目自动完成功能停止工作了。我的操作系统是 Ubuntu 18.04,我想我清除了一些软件包或安装了错误的东西。但我搞不清原因。我花了两天时间,尝试了网上的所有方法,并查看了本网站上所有相关的问题和答案(如A和乙)。所以请不要说这是重复的或什么的!无论如何,除了 bib 自动完成之外,一切看起来都很好。我必须在中输入所有内容,\cite{...}
并且无法从列表中选择它。这对我来说不是一个错误问题,但我喜欢在我的 TeXStudio 中使用它。我的包管理器是 Texlive(最新版本),我已经在完整方案中安装了它。您可以在下面找到所有系统报告:
which pdflatex: /home/reza/Bank/texlive/2018/bin/x86_64-linux/pdflatex
PDFLATEX: pdflatex -version
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.00
Environment variables:
CLUTTER_IM_MODULE=xim
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
DESKTOP_SESSION=ubuntu
DISPLAY=:0
GDMSESSION=ubuntu
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/texstudio.desktop
GIO_LAUNCHED_DESKTOP_FILE_PID=6062
GJS_DEBUG_OUTPUT=stderr
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_SHELL_SESSION_MODE=ubuntu
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GTK2_MODULES=overlay-scrollbar
GTK_IM_MODULE=ibus
GTK_MODULES=gail:atk-bridge
HOME=/home/reza
IM_CONFIG_PHASE=2
LANG=en_US.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LOGNAME=reza
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
PATH=/home/reza/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/reza/Bank/omnetpp-5.3/bin:/home/reza/Bank/MATLAB/R2018a/bin:/home/reza/Bank/texlive/2018/bin/x86_64-linux:/snap/bin
PWD=/home/reza
QT4_IM_MODULE=xim
QT_ACCESSIBILITY=1
QT_IM_MODULE=ibus
SESSION_MANAGER=local/rezaLaptop:@/tmp/.ICE-unix/1380,unix/rezaLaptop:/tmp/.ICE-unix/1380
SHELL=/bin/bash
SHLVL=0
SSH_AGENT_PID=1464
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
TEXTDOMAIN=im-config
TEXTDOMAINDIR=/usr/share/locale/
USER=reza
USERNAME=reza
WINDOWPATH=2
XAUTHORITY=/run/user/1000/gdm/Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
XDG_CURRENT_DESKTOP=ubuntu:GNOME
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop
XDG_MENU_PREFIX=gnome-
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_DESKTOP=ubuntu
XDG_SESSION_ID=2
XDG_SESSION_TYPE=x11
XDG_VTNR=2
XMODIFIERS=@im=ibus
TeXstudio:
Path : /usr/bin/texstudio
Program call: texstudio
Setting file: /home/reza/.config/texstudio/texstudio.ini
Command configuration in TeXstudio:
Default Viewer (view): txs:///view-pdf
Default Compiler (compile): txs:///pdflatex
Asymptote (asy): asy ?m*.asy
Asymptote PDF Chain (asy-pdf-chain): txs:///pdflatex | txs:///asy | txs:///pdflatex | txs:///view-pdf
Makeindex (makeindex): makeindex %.idx
PS Chain (ps-chain): txs:///latex | txs:///dvips | txs:///view-ps
DVI->PDF Chain (dvi-pdf-chain): txs:///latex | txs:///dvipdf | txs:///view-pdf
Default Bibliography Tool (bibliography): txs:///bibtex
PS Viewer (view-ps): xdg-open %.ps > /dev/null
Texindy (texindy): texindy %.idx
DVI Chain (dvi-chain): txs:///latex | txs:///view-dvi
PdfLaTeX (pdflatex) (r): pdflatex -synctex=1 -interaction=nonstopmode %.tex
Metapost (metapost): mpost -interaction=nonstopmode ?me)
BibTeX 8-Bit (bibtex8): bibtex8 %.aux
Internal Precompile (internal-pre-compile): txs:///pre-compile | txs:///conditionally-recompile-bibliography
Ps2Pdf (ps2pdf): ps2pdf %.ps
SVN (svn): svn
Biber (biber): biber %
PDF Viewer (view-pdf): txs:///view-pdf-internal --embedded
DVI Viewer (view-dvi): xdg-open %.dvi > /dev/null
Default Glossary Tool (glossary): txs:///makeglossaries
DviPng (dvipng): dvipng -T tight -D 120 %.dvi
DVI->PS->PDF Chain (dvi-ps-pdf-chain): txs:///latex | txs:///dvips | txs:///ps2pdf | txs:///view-pdf
PDF Chain (pdf-chain): txs:///pdflatex | txs:///view-pdf
Ghostscript (gs): gs "?am.ps"
Default Index Tool (index): txs:///makeindex
Precompile (pre-compile):
XeLaTeX (xelatex) (r): xelatex -synctex=1 -interaction=nonstopmode %.tex
Asymptote DVI Chain (asy-dvi-chain): txs:///latex | txs:///asy | txs:///latex | txs:///view-dvi
Makeglossaries (makeglossaries): makeglossaries %
Latexmk (latexmk): latexmk -pdf -silent -synctex=1 %
BibTeX (bibtex): bibtex %.aux
Recompile Bibliography (recompile-bibliography): txs:///compile | txs:///bibliography | txs:///compile
DviPdf (dvipdf): dvipdf %.dvi
Build & View (quick): txs:///pdflatex | txs:///bibtex | txs:///pdflatex | txs:///pdflatex | txs:///view-pdf
LuaLaTeX (lualatex) (r): lualatex -synctex=1 -interaction=nonstopmode %.tex
SVNADMIN (svnadmin): svnadmin
LaTeX (latex) (r): latex -src -interaction=nonstopmode %.tex
External PDF Viewer (view-pdf-external): xdg-open %.pdf > /dev/null
DviPs (dvips): dvips -o %.ps %.dvi
Additional Search Paths:
Command:
Log:
Pdf:
答案1
您正在使用自定义类svathesis
,其中定义了\bibFile
获取参考书目文件的命令。TeXstudio 无法识别这一点,这从左侧边栏的文件结构中可以看出(缺少参考书目——稍后与图像进行比较)。
要解决这个问题,你需要编写自己的.cwl
文件,TeXstudio 会用它识别命令。这里有几个关于这个问题的答案,例如:参见这里如果你不熟悉。
这些存储在设置/配置文件夹。在./config/completion/user
文件夹下,创建一个新.cwl
文件。(我将其命名为randomcwl.cwl
。
打开,粘贴
\bibFile{bib file}#b
并保存。
重新启动 TeXstudio,并确保.cwl
从 TeXstudio 内部激活该文件:
Configure TeXstudio -> Completion -> check the box containing your cwl
如果一切正常,您应该会看到 Bibliography 现在位于您的文件结构中(这意味着 TXS 现在将能够正确解析您的 bib 文件),并且它\bibFile
不再是一个无法识别的命令。(您可能需要运行Idefix -> Refresh structure
。)
自动生成的 cwl 不起作用的原因是,cwl 中声明的命令有一个分类器,它告诉解析器哪一种它们是命令。自动生成的命令有分类器#S
,这基本上意味着“通用的,不会出现在自动完成器中”。这是合理的,因为 TXS 根本不知道这些。
另一方面,它实际上应该是#b
which 代表书目命令,并告诉解析器该命令(此处\bibFile
)的参数将是一个书目文件。请参阅“分类格式”用户手册更多细节。