# 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

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

## Related Questions

### Writing on Images

0  Asked on July 11, 2021

### Trying to view citations in Bibtex as an import file from Mendely isn’t working

1  Asked on July 11, 2021 by vani

### Expanding a macro into index for sorting using expl3

2  Asked on July 11, 2021

### How do I change numbering from arabic letters to roman letters after ToC and set countering to 1?

1  Asked on July 11, 2021 by fendi

### On the proper use of tl_rescan

1  Asked on July 11, 2021

### How to format calculated number in siunitx within tikz?

1  Asked on July 11, 2021

### pgfplots use full textwidth in subfigure environment

2  Asked on July 11, 2021 by whiterock

### Autoscale tikzpicture to maximum size possible on a page

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

### Can tikz plot a recurrence relation using foreach and no global definitions?

2  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

### Pseudocode: Function vs. Procedure?

2  Asked on July 10, 2021

### Format reference and subref of subcaption

2  Asked on July 10, 2021

### Rules for space when using mathrm{}

2  Asked on July 10, 2021

### How to install Bickham font or similar font

3  Asked on July 10, 2021

### Creating a long table with large cells that wrap effectively

0  Asked on July 10, 2021 by tophodin

### How to get a bibliography to work in subfiles?

1  Asked on July 10, 2021 by shan-kasal

### Can I daemonize LaTeX or ConTeXt for performance boost?

0  Asked on July 10, 2021