TransWikia.com

Auto-completion for newcommand in TexStudio

TeX - LaTeX Asked by wernersbacher on December 29, 2020

I created a new command like this:

newcommand{longref}[1]{{ref{#1} (nameref{#1})}}

it works as expected – it prints the chapter number and it’s name. Great.

Now I’m using Texstudio, and it always showed me a list of available labels when I was typing in a ref-command. With my own command, it doesn’t do that anymore.

Is there any way I get auto-completion with my own command?

One Answer

I use TexStudio and it is my favorite editor. I have not particularly tried what you are trying to do here, but here is what I have observed in the latest version of TexStudio. When you load a file in TexStudio, it tries to detect which the parent file is (specially if there are multiple files included in the document, for example, using subfiles package). What TexStudio does is that it also loads the resources within those files which you can access. For example, if you load usepackage{biblatex} and the bibliography file bibliography{ref.bib} in the preamble, you will get autocompletion suggestions of the references which are in the ref.bib file. So, if you start typing textcite{ you will see a list of suggestions (most likely sorted alphabetically) from which you can choose the reference. I am guessing this is the feature you are looking for.

If that is the case, then I do not think custom commands will get the autocompletion feature based on how TexStudio works (at least from what I have seen). I could be wrong since this is just my observation but this is probably it. Hope that helps you understand your situation.

Answered by Masum on December 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP