为什么 TeXstudio 不建议引用任何 bib 项目(无法读取多行参数)?

为什么 TeXstudio 不建议引用任何 bib 项目(无法读取多行参数)?

当我使用该\cite{}命令时,TeXstudio 找不到任何 bib 项。通常,我期望在输入后\cite{TeXstudio 会向我推荐所有可用的 bib 项,但它没有向我推荐任何项。即使我输入现有的 bib 项 ( \cite{Anderson.2012}),TeXstudio 也会告诉我 (鼠标悬停) 它不知道该 bib 项 (带下划线的绿色)。

我的书目确实包含以下内容:

@book{Anderson.2012,
 author = {Anderson, David J. and Roock, Arne and Wolf, Henning},
 year = {2012},
 title = {Kanban: Evolution{\"a}res Change Management f{\"u}r IT-Organisationen},
 price = {EUR 34.90 (DE), EUR 35.90 (AT), sfr 49.90 (freier Pr.)},
 keywords = {Kanban;Kanban-System},
 address = {Heidelberg},
 edition = {Dt. Ausg. der 1. amerikan. Aufl., 1. korr. Nachdr},
 publisher = {dpunkt-Verl.},
 isbn = {9783898647304},
 series = {it-agile}
}

我使用以下 LaTeX 模板: DHBW Horb LaTex 模板

编辑: 需要澄清的是:TeXstudio 确实可以正确使用 cite 命令。因此它确实找到了它们。但是智能感知找不到(没有建议)bib 项,因此没有帮助(这就是问题所在)。我必须从 -file 中复制 bib 键,.bib而不是 TeXstudio 建议所有可能的 bib 项。

梅威瑟: 问题似乎出在选项biblatex写在多行中的时候。例如:

\usepackage[
    backend=biber
    ]{biblatex}

在我使用的模板中,选项的写法如下:

\usepackage[
    backend=biber, 
    bibwarn=true, 
    bibencoding=utf8, 
    sortlocale=de_DE, 
    style=alphabetic
    ]{biblatex}

如果我删除所有换行符,TeXstudio 就会识别 bib 文件。

正如 MWE 所说:

\documentclass{article}
\usepackage[
    backend=biber
    ]{biblatex}
\addbibresource{bibliographie.bib}
\begin{document}
\cite{Anderson.2012}
\end{document}

答案1

为了结束这个话题,我总结一下:

现在,你必须要做

\usepackage[backend=biber,bibwarn=true,bibencoding=utf8,sortlocale=de_DE,style=alphabetic]{biblatex}

在一行中或者勾选相应的.cwl-file,如下所示:

在此处输入图片描述


关于该问题的讨论已经结束:https://sourceforge.net/p/texstudio/bugs/1648/


您可能需要创建一个biblatexTemp.cwl包含以下内容的文件:

# biblatex package, available from ctan
# commands for biblatex users
# tbraun, 19.08.2009
# dbitouze, 14.02.2012

\ExecuteBibliographyOptions{%<options%>}
#keyvals:\ExecuteBibliographyOptions
sorting=#nty,nyt,nyvt,anyt,anyvt,ynt,ydnt,none,debug,%<name%>
sortcase=#true,false
sortupper=#true,false
sortlocale=#auto,%<locale%>,de_DE,en_US,de_DE_phonebook,es_ES
sortlos=#bib,los
related=#true,false
sortcites=#true,false
maxnames=%<integer%>
minnames=%<integer%>
maxbibnames=%<integer%>
minbibnames=%<integer%>
maxcitenames=%<integer%>
mincitenames=%<integer%>
maxitems=%<integer%>
minitems=%<integer%>
autocite=#plain,inline,footnote,superscript,%<other%>
autopunct=#true,false
language=#autobib,autocite,auto,%<language%>
clearlang=#true,false
autolang=#none,hyphen,other,other*,langname
block=#none,space,par,nbpar,ragged
notetype=#goot+end,footonly,endonly
hyperref=#true,false,auto
backref=#true,false
backrefstyle=#none,three,two,tow+,three+,all+
backrefsetstyle=#setonly,memonly,setormem,setandmem,memandset,setplusmem
indexing=#true,false,cite,bib
loadfiles=#true,false
refsection=#none,part,chapter,section,subsection
refsegment=#none,part,chapter,section,subsection
citereset=#none,part,chapter,section,subsection
abbreviate=#true,false
date=#year,short,long,terse,comp,iso8601
datelabel=#year,short,long,terse,comp,iso8601
origdate=#year,short,long,terse,comp,iso8601
eventdate=#year,short,long,terse,comp,iso8601
urldate=#year,short,long,terse,comp,iso8601
alldates=#year,short,long,terse,comp,iso8601
datezeros=#true,false
dateabbrev=#true,false
defernumbers=#true,false
punctfont=#true,false
arxiv=#abs,ps,pdf,format
texencoding=#%<encoding%>,auto
bibencoding=#utf8,auto,%<encoding%>
safeinputenc=#true,false
bibwarn=#true,false
mincrossrefs=%<integer%>
#endkeyvals
\bibliography{bib files}

\addbibresource{bibliographic resource}#b
\addbibresource[options]{bibliographic resource}
\addglobalbib{resource}
\addglobalbib[options]{resource}
\addsectionbib{resource}
\addsectionbib[options]{resource}

\printbibliography
\printbibliography[key=value, ...]
\bibbysection
\bibbysection[key=value, ...]
\bibbysegment
\bibbysegment[key=value, ...]
\bibbycategory
\bibbycategory[key=value, ...]
\printshorthands
\printshorthands[key=value, ...]
\begin{refsection}
\begin{refsection}[bib files]
\end{refsection}
\newrefsection[bib files]
\begin{refsegment}
\end{refsegment}
\newrefsegment
\DeclareBibliographyCategory{category}
\addtocategory{category}{bibid}
\defbibheading{name}{code}
\defbibnote{name}{text}
\defbibfilter{name}{code}
\segment{integer}
\type{type}
\keyword{keyword}
\category{category}

\cite[prenote][postnote]{bibid}#c
\cite[postnote]{bibid}#c
\cite{bibid}#c
\Cite[prenote][postnote]{bibid}#c
\Cite[postnote]{bibid}#c
\Cite{bibid}#c

\parencite[prenote][postnote]{bibid}#c
\parencite[postnote]{bibid}#c
\parencite{bibid}#c
\Parencite[prenote][postnote]{bibid}#c
\Parencite[postnote]{bibid}#c
\Parencite{bibid}#c

\footcite[prenote][postnote]{bibid}#c
\footcite[postnote]{bibid}#c
\footcite{bibid}#c
\Footcite[prenote][postnote]{bibid}#c
\Footcite[postnote]{bibid}#c
\Footcite{bibid}#c

\textcite[prenote][postnote]{bibid}#c
\textcite[postnote]{bibid}#c
\textcite{bibid}#c
\Textcite[prenote][postnote]{bibid}#c
\Textcite[postnote]{bibid}#c
\Textcite{bibid}#c

\cite*[prenote][postnote]{bibid}#c
\cite*[postnote]{bibid}#c
\cite*{bibid}#c

\parencite*[prenote][postnote]{bibid}#c
\parencite*[postnote]{bibid}#c
\parencite*{bibid}#c

\supercite{bibid}#c

\cites{bibid}{bibid}#c
\cites(post){bibid}{bibid}#c
\cites(pre)(post){bibid}{bibid}#c
\cites(pre)(post)[post]{bibid}[post]{bibid}#c
\cites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\cites[post]{bibid}[post]{bibid}#c
\cites[pre][post]{bibid}[pre][post]{bibid}#c
\cites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Cites{bibid}{bibid}#c
\Cites(post){bibid}{bibid}#c
\Cites(pre)(post){bibid}{bibid}#c
\Cites(pre)(post)[post]{bibid}[post]{bibid}#c
\Cites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Cites[post]{bibid}[post]{bibid}#c
\Cites[pre][post]{bibid}[pre][post]{bibid}#c
\Cites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\parencites{bibid}{bibid}#c
\parencites(post){bibid}{bibid}#c
\parencites(pre)(post){bibid}{bibid}#c
\parencites(pre)(post)[post]{bibid}[post]{bibid}#c
\parencites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\parencites[post]{bibid}[post]{bibid}#c
\parencites[pre][post]{bibid}[pre][post]{bibid}#c
\parencites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Parencites{bibid}{bibid}#c
\Parencites(post){bibid}{bibid}#c
\Parencites(pre)(post){bibid}{bibid}#c
\Parencites(pre)(post)[post]{bibid}[post]{bibid}#c
\Parencites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Parencites[post]{bibid}[post]{bibid}#c
\Parencites[pre][post]{bibid}[pre][post]{bibid}#c
\Parencites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\textcites{bibid}{bibid}#c
\textcites(post){bibid}{bibid}#c
\textcites(pre)(post){bibid}{bibid}#c
\textcites(pre)(post)[post]{bibid}[post]{bibid}#c
\textcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\textcites[post]{bibid}[post]{bibid}#c
\textcites[pre][post]{bibid}[pre][post]{bibid}#c
\textcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Textcites{bibid}{bibid}#c
\Textcites(post){bibid}{bibid}#c
\Textcites(pre)(post){bibid}{bibid}#c
\Textcites(pre)(post)[post]{bibid}[post]{bibid}#c
\Textcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Textcites[post]{bibid}[post]{bibid}#c
\Textcites[pre][post]{bibid}[pre][post]{bibid}#c
\Textcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\footcites{bibid}{bibid}#c
\footcites(post){bibid}{bibid}#c
\footcites(pre)(post){bibid}{bibid}#c
\footcites(pre)(post)[post]{bibid}[post]{bibid}#c
\footcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\footcites[post]{bibid}[post]{bibid}#c
\footcites[pre][post]{bibid}[pre][post]{bibid}#c
\footcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Footcites{bibid}{bibid}#c
\Footcites(post){bibid}{bibid}#c
\Footcites(pre)(post){bibid}{bibid}#c
\Footcites(pre)(post)[post]{bibid}[post]{bibid}#c
\Footcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Footcites[post]{bibid}[post]{bibid}#c
\Footcites[pre][post]{bibid}[pre][post]{bibid}#c
\Footcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\supercites{bibid}{bibid}#c
\supercites(post){bibid}{bibid}#c
\supercites(pre)(post){bibid}{bibid}#c
\supercites(pre)(post)[post]{bibid}[post]{bibid}#c
\supercites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\supercites[post]{bibid}[post]{bibid}#c
\supercites[pre][post]{bibid}[pre][post]{bibid}#c
\supercites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\autocite[prenote][postnote]{bibid}#c
\autocite[postnote]{bibid}#c
\autocite{bibid}#c

\Autocite[prenote][postnote]{bibid}#c
\Autocite[postnote]{bibid}#c
\Autocite{bibid}#c

\autocite*[prenote][postnote]{bibid}#c
\autocite*[postnote]{bibid}#c
\autocite*{bibid}#c

\Autocite*[prenote][postnote]{bibid}#c
\Autocite*[postnote]{bibid}#c
\Autocite*{bibid}#c

\autocites{bibid}{bibid}#c
\autocites(post){bibid}{bibid}#c
\autocites(pre)(post){bibid}{bibid}#c
\autocites(pre)(post)[post]{bibid}[post]{bibid}#c
\autocites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\autocites[post]{bibid}[post]{bibid}#c
\autocites[pre][post]{bibid}[pre][post]{bibid}#c
\autocites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Autocites{bibid}{bibid}#c
\Autocites(post){bibid}{bibid}#c
\Autocites(pre)(post){bibid}{bibid}#c
\Autocites(pre)(post)[post]{bibid}[post]{bibid}#c
\Autocites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Autocites[post]{bibid}[post]{bibid}#c
\Autocites[pre][post]{bibid}[pre][post]{bibid}#c
\Autocites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\smartcite[prenote][postnote]{bibid}#c
\smartcite[postnote]{bibid}#c
\smartcite{bibid}#c

\Smartcite[prenote][postnote]{bibid}#c
\Smartcite[postnote]{bibid}#c
\Smartcite{bibid}#c

\smartcites{bibid}{bibid}#c
\smartcites(post){bibid}{bibid}#c
\smartcites(pre)(post){bibid}{bibid}#c
\smartcites(pre)(post)[post]{bibid}[post]{bibid}#c
\smartcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\smartcites[post]{bibid}[post]{bibid}#c
\smartcites[pre][post]{bibid}[pre][post]{bibid}#c
\smartcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\Smartcites{bibid}{bibid}#c
\Smartcites(post){bibid}{bibid}#c
\Smartcites(pre)(post){bibid}{bibid}#c
\Smartcites(pre)(post)[post]{bibid}[post]{bibid}#c
\Smartcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c
\Smartcites[post]{bibid}[post]{bibid}#c
\Smartcites[pre][post]{bibid}[pre][post]{bibid}#c
\Smartcites(pre)(post)[pre][post]{bibid}[pre][post]{bibid}#c

\svolcite{volume}{bibid}#c
\svolcite[prenote]{volume}{bibid}#c
\svolcite{volume}[page]{bibid}#c
\svolcite[prenote]{volume}[page]{bibid}#c

\Svolcite{volume}{bibid}#c
\Svolcite[prenote]{volume}{bibid}#c
\Svolcite{volume}[page]{bibid}#c
\Svolcite[prenote]{volume}[page]{bibid}#c

\tvolcite{volume}{bibid}#c
\tvolcite[prenote]{volume}{bibid}#c
\tvolcite{volume}[page]{bibid}#c
\tvolcite[prenote]{volume}[page]{bibid}#c

\Tvolcite{volume}{bibid}#c
\Tvolcite[prenote]{volume}{bibid}#c
\Tvolcite{volume}[page]{bibid}#c
\Tvolcite[prenote]{volume}[page]{bibid}#c

\avolcite{volume}{bibid}#c
\avolcite[prenote]{volume}{bibid}#c
\avolcite{volume}[page]{bibid}#c
\avolcite[prenote]{volume}[page]{bibid}#c

\Avolcite{volume}{bibid}#c
\Avolcite[prenote]{volume}{bibid}#c
\Avolcite{volume}[page]{bibid}#c
\Avolcite[prenote]{volume}[page]{bibid}#c

\notecite{volume}{bibid}#c
\notecite[prenote]{volume}{bibid}#c
\notecite{volume}[postnote]{bibid}#c
\notecite[prenote]{volume}[postnote]{bibid}#c

\Notecite{volume}{bibid}#c
\Notecite[prenote]{volume}{bibid}#c
\Notecite{volume}[postnote]{bibid}#c
\Notecite[prenote]{volume}[postnote]{bibid}#c

\pnotecite{volume}{bibid}#c
\pnotecite[prenote]{volume}{bibid}#c
\pnotecite{volume}[postnote]{bibid}#c
\pnotecite[prenote]{volume}[postnote]{bibid}#c

\Pnotecite{volume}{bibid}#c
\Pnotecite[prenote]{volume}{bibid}#c
\Pnotecite{volume}[postnote]{bibid}#c
\Pnotecite[prenote]{volume}[postnote]{bibid}#c

\fnotecite{volume}{bibid}#c
\fnotecite[prenote]{volume}{bibid}#c
\fnotecite{volume}[postnote]{bibid}#c
\fnotecite[prenote]{volume}[postnote]{bibid}#c

\citeauthor[prenote][postnote]{bibid}#c
\citeauthor[postnote]{bibid}#c
\citeauthor{bibid}#c

\citedate[prenote][postnote]{bibid}#c
\citedate[postnote]{bibid}#c
\citedate{bibid}#c

\Citeauthor[prenote][postnote]{bibid}#c
\Citeauthor[postnote]{bibid}#c
\Citeauthor{bibid}#c

\citetitle[prenote][postnote]{bibid}#c
\citetitle[postnote]{bibid}#c
\citetitle{bibid}#c

\citetitle*[prenote][postnote]{bibid}#c
\citetitle*[postnote]{bibid}#c
\citetitle*{bibid}#c

\citeyear[prenote][postnote]{bibid}#c
\citeyear[postnote]{bibid}#c
\citeyear{bibid}#c

\citeurl[prenote][postnote]{bibid}#c
\citeurl[postnote]{bibid}#c
\citeurl{bibid}#c

\nocite{bibid}#c

\fullcite[prenote][postnote]{bibid}#c
\fullcite[postnote]{bibid}#c
\fullcite{bibid}#c

\footfullcite[prenote][postnote]{bibid}#c
\footfullcite[postnote]{bibid}#c
\footfullcite{bibid}#c

\citename[prenote][postnote]{bibid}[format]{name list}
\citename[postnote]{bibid}[format]{name list}
\citename[postnote]{bibid}{name list}
\citename{bibid}[format]{name list}
\citename{bibid}{name list}#c

\citelist[prenote][postnote]{bibid}[format]{literallist}
\citelist[postnote]{bibid}[format]{literal list}
\citelist[postnote]{bibid}{literal list}
\citelist{bibid}[format]{literal list}
\citelist{bibid}{literal list}#c

\citefield[prenote][postnote]{bibid}[format]{field}
\citefield[postnote]{bibid}[format]{field}
\citefield[postnote]{bibid}{field}
\citefield{bibid}[format]{field}
\citefield{bibid}{field}#c

\citereset
\citereset*
\mancite

\pno
\ppno
\nopp
\psq
\psqq
\RN{integer}
\Rn{integer}

\DefineBibliographyStrings{language}{definitions}
\DefineBibliographyExtras{language}{code}
\UndefineBibliographyExtras{language}{code}
\DefineHyphenationExceptions{language}{text}
\NewBibliographyString{bibid}#c

\bibsetup
\bibfont
\citesetup
\newblockpunct
\newunitpunct
\finentrypunct
\bibleftparen
\bibrightparen
\bibleftbracket
\bibrightbracket
\bibnamedash
\labelnamepunct
\subtitlepunct
\bibpagespunct
\multinamedelim
\finalnamedelim
\revsdnamedelim
\andothersdelim
\multilistdelim
\finallistdelim
\andmoredelim
\multicitedelim
\supercitedelim
\compcitedelim
\nameyeardelim
\labelalphaothers
\prenotedelim
\postnotedelim
\mkbibnamelast{text}
\mkbibnamefirst{text}
\mkbibnameprefix{text}
\mkbibnameaffix{text}

\bibrangedash
\bibdatelong
\bibdateshort
\biburldatelong
\biburldateshort
\finalandcomma
\mkbibordinal{integer}
\mkbibmascord{integer}
\mkbibfemord{integer}
\bibhang
\biblabelsep
\bibitemsep
\bibitemextrasep
\bibparsep
abbrvpenalty # counter
lownamepenalty
highnamepenalty

\bibellipsis
\hyphenate
\hyphen
\nbhyphen
\noligature
\mknumalph{integer}
\mkbibacro{text}
\autocap{character}

# spanish
smartand # counter
\forceE
\forceY

# koma-script classes
\ifkomabibtotoc{true}{false}
\ifkomabibtotocnumbered{true}{false}

# memoir class
\ifmemoirbibintoc{true}{false}

#ifOption:natbib
#include:natbib
#endif

将其保存为biblatexTemp.cwl并将~/.config/texstudio/ or %APPDATA%\texstudio\其加载为“永久活动完成文件”,如上所示。

这个新文件为您提供了@samcarter 提到的解决方案。

答案2

此外LaRiFaRi 的回答:

usepackage命令保持在一行内为了保持其可读性和可注释性(既可以轻松删除一个或另一个选项,也可以为各个选项添加注释),您可以将几乎所有选项移动到

\ExecuteBibliographyOptions{⟨key=value, ...⟩}

有一些例外情况只能在加载时设置,例如后端,但由于您使用默认值,因此根本不需要backend=biber指定它。其他例外情况包括style、、和。bibstylecitestylenatbibmcite


另一个选择是在加载包之前设置选项,即

\PassOptionsToPackage[⟨key=value, ...⟩]{biblatex}
\usepackage{biblatex}

相关内容