Texstudio: Is it possible to have TeXstudio list available labels for a custom command which is based on \ref?

Created on 12 Jul 2020  路  3Comments  路  Source: texstudio-org/texstudio

I defined a custom command:

\newcommand{\fullref}[1]{\autoref{#1}, \autopageref{#1}}

Is it possible to have TeXstudio list available labels from my document, so that I can use that custom command like I am using \ref or \autoref and similar commands?

Note: the option to load included files is checked/activated (in the options in the Editor tab).

Environment

  • TeXstudio: TeXstudio 2.12.22 (git n/a)
  • Qt: Nutze Qt-Version 5.15.0, kompiliert mit Qt 5.14.0
  • OS: Linux (Arch)
  • TeX distribution: Tex Live

Expected behavior

I'd like TeXstudio to show available labels when I enter the brackets for \fullref{#1}.

Actual behavior

  • TeXstudio does not show the labels when the cursor is within the brackets

How to reproduce

Create a custom command, e. g. \newcommand{\fullref}[1]{\autoref{#1}, \autopageref{#1}} and start typing it.

question

All 3 comments

You need to record \fullref in cwl file.

For example,

  • In directory ~/.config/texstudio/completion/user, create a file my-macros.cwl containing line \fullref{label}#r.
  • Reopen texstudio, in "Configure TeXstudio -> Completion -> Permanently active completion files", check my-macros.cwl.
  • Done.

Related documentation:

this is answered

Thank you. It was super easy. I just had to put \fullref{key}#r in my custom completion file. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Krzmbrzl picture Krzmbrzl  路  4Comments

erich666 picture erich666  路  7Comments

muzimuzhi picture muzimuzhi  路  10Comments

OsbertWang picture OsbertWang  路  6Comments

kendonB picture kendonB  路  10Comments