AnswerBun.com

Auto-completion for newcommand in TexStudio

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?

TeX - LaTeX Asked by wernersbacher on December 29, 2020

1 Answers

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!

Related Questions

On the proper use of `tl_rescan`

1  Asked on July 11, 2021

   

How to get vdash with number in Latex

1  Asked on July 11, 2021 by angel-gonzlez

 

Apply command to this area only

1  Asked on July 11, 2021

   

Problem with APA formating

0  Asked on July 11, 2021 by david-wagle

       

Using LaTeX3’s xtemplate

4  Asked on July 10, 2021

   

How to get a bibliography to work in subfiles?

1  Asked on July 10, 2021 by shan-kasal

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.