0

I installed the last version of TexStudio (2.12.6) and Everything was fine since couple of days ago but suddenly bibliography autocompletion has stopped working. My OS is Ubuntu 18.04 and I think I purged some packages or installed something wrong. But I cannot figure it out. It takes 2 days from me and I tried everything in the web and reviewed all related questions and answers in this website (like A and B). So please don't say this is a duplicate or something! Anyway, everything looks fine except bib autocompletion. I have to type everything in the \cite{...} and I cannot select it from the list. It's not a bug deal for me but I like to have it in my TeXStudio. My package manager is Texlive (last version) and I have installed it in full-scheme. You can find all system report below:

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: 
  • The latest version is 2.12.8. Can you try that? – Troy May 12 '18 at 13:01
  • @Troy unfortunately, it doesn't work with this too. – Reza May 12 '18 at 13:29
  • I've uploaded a small version of my report here. I would appreciate it if anyone can help me – Reza May 12 '18 at 13:40
  • I see you're using a custom class that defines its own bibFile command. TeXstudio doesn't understand that. Use \bibliography{MyReferences} instead. Either that, or define a .cwl file that includes \bibFile as a command so that TeXstudio recognizes it. – Troy May 12 '18 at 13:46
  • That works! Thank you very much. Please write it as an answer. BTW, Is there any workaround for this problem? – Reza May 12 '18 at 13:51
1

You're using a custom class svathesis, which among others, defines a \bibFile command to take bibliography files. TeXstudio doesn't recognize this, which should be obvious from the file structure on the left sidebar (the bibliography is missing -- compare to the image later).

n

To work around this, you need to write up your own .cwl file, which is what TeXstudio uses to recognize commands. There are several answers about this here, for example: see here if you are unfamiliar.

These are stored in the settings / config folder. Under the ./config/completion/user folder, create a new .cwl file. (I called mine randomcwl.cwl.

Open it up, paste in

\bibFile{bib file}#b

and save.

Restart TeXstudio, and make sure you activate the .cwl file from within TeXstudio:

Configure TeXstudio -> Completion -> check the box containing your cwl

enter image description here

and if everything is right, you should see that Bibliography is now in your file structure (which means TXS will be able to parse your bib file properly now), and that \bibFile is no longer an unrecognized command. (You may need to run Idefix -> Refresh structure.)

enter image description here


The reason why the autogenerated cwl does not work is that the commands declared in cwl's have a classifier that tells the parser what kind of command they are. Autogenerated ones have classifier #S, which basically means "generic, and don't appear in autocompleter". Which is reasonable, since TXS has no knowledge of these at all.

On the other hand, it should really be #b which stands for bibliography command, and tells the parser that the argument of the command (here \bibFile) will be a bibliography file. See "Classification format" in the user manual for more details.

  • I test it and it works fine. One more question. Why that autogenerated file does not work? Is there a bug in it? – Reza May 12 '18 at 14:20
  • No, the commands declared in cwl's have a classifier that tells the parser what kind of command they are. Autogenerated ones have classifier #S, which basically means "generic, and don't appear in autocompleter". OTOH it should really be #b which stands for bibliography command, and tells the parser that the argument of the command (here \bibFile) will be a bibliography file. – Troy May 12 '18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.