2

When I use \big( or \big[ in math mode I get a message unrecognized command, but I have no error and it gives me the desired result. However, the command \big| works fine. When I use the same commands with space between \big and ( or [ there is no problem. This has happened the last few days, when I upgraded TexStudio to 2.12.8 version.

I would like that TeXStudio recognize \big(, \big[, \bigg(,... without space. Thank you!

enter image description here

Fotis K
  • 195
  • 5
    Not exactly an answer but usually \bigl(...\bigr) is better, i.e. you should include an l or r to indicate an opening or closing fence. Maybe that can help TeXstudio. Anyway this should only be a message by your editor and not a TeX warning or error. So you can safely ignore it. – moewe Jun 16 '18 at 10:03
  • It doesn't work with l or r. Suddenly it recognize \big( but not \big) or \bigg(. Thank you for your answer! – Fotis K Jun 16 '18 at 10:11
  • Have a look at https://tex.stackexchange.com/q/47493/35864, https://tex.stackexchange.com/q/79643/35864, https://tex.stackexchange.com/q/185086/35864 and in particular https://sourceforge.net/p/texstudio/wiki/Frequently%20Asked%20Questions/#how-does-txs-know-about-valid-commands – moewe Jun 16 '18 at 10:16
  • Thank you! I have already read them but I don't know how to create .cwl. Anyway, I will try again. – Fotis K Jun 16 '18 at 10:39
  • 1
    There shouldn't be a need to make your own cwl for this. Go to Configure TeXstudio -> Completion: Is latex-document.cwl checked? If not, try to check it and see if it helps. (It should: the \big commands are defined in it.) – Troy Jun 16 '18 at 12:39
  • latex-document.cwl is checked but not fix it – Fotis K Jun 16 '18 at 13:40
  • @fotis81 Ok, confirmed. Will try to look into it. – Troy Jun 16 '18 at 16:12

1 Answers1

7

Fixed for TXS ≥ 2.12.9 (git b1157fa)

The issue has been fixed in the developmental snapshot, which can be downloaded from

Future released (official) versions from 2.12.10 onwards will not need the below workaround.


Workaround (TXS ≤ version 2.12.8)

Note: As suggested in the comments, \bigl( and \bigr) etc. are recommended instead. These are defined in latex-mathsymbols.cwl, so they may require a similar fix.

There's no elegant way about it now, if the other commands from latex-document.cwl are affected from disabling it, you can copy-paste its entire contents from the source code and proceed similarly with tempfix.cwl for now.

Seems to be a mis-categorization bug in the implementation of the classification format of commands in latex-document.cwl and latex-mathsymbols.cwl. You can't edit this directly because it is compiled into the executable. I'll offer an alternative for now:

  1. Create a new tempfix.cwl file using notepad or some other text editor.

  2. Go to the project page and copy the contents of latex-document.cwl and latex-mathsymbols.cwl into tempfix.cwl.

  3. Then replace the relevant \big(, \bigl( etc. commands with: (Essentially remove the K and M classification from #mK or #mM.)

    \Big(%|\Big)#m
    \Big[%|\Big]#m
    \Big|%|\Big|#m
    \big(%|\big)#m
    \big[%|\big]#m
    \big|%|\big|#m
    \Bigg(%|\Bigg)#m
    \Bigg[%|\Bigg]#m
    \Bigg|%|\Bigg|#m
    \bigg(%|\bigg)#m
    \bigg[%|\bigg]#m
    \bigg|%|\bigg|#m
    
    \Bigl(%|\Bigr)#m
    \Bigl[%|\Bigr]#m
    \Bigl|%|\Bigr|#m
    \bigl(%|\bigr)#m
    \bigl[%|\bigr]#m
    \bigl|%|\bigr|#m
    \Biggl(%|\Biggr)#m
    \Biggl[%|\Biggr]#m
    \Biggl|%|\Biggr|#m
    \biggl(%|\biggr)#m
    \biggl[%|\biggr]#m
    \biggl|%|\biggr|#m
    \Bigr#m
    \bigr#m
    \Biggr#m
    \biggr#m
    
  4. Place tempfix.cwl in the ./config/completion/user/ folder (see here if you're unsure where this is), and restart TeXstudio. Check the testfix.cwl in Configure TeXstudio -> Completion, and uncheck latex-document.cwl, latex-mathsymbols.cwl.

tempfix

Close the options dialog, then from the top bar, Idefix -> Refresh structure if necessary to 'refresh' the commands recognition.

This should be fixed in the next release (> TXS version 2.12.8).

Test file:

\documentclass{article}
\begin{document}
$
\Big(x+y\Big)
\Big[x+y\Big]
\Big|x+y\Big|
\big(x+y\big)
\big[x+y\big]
\big|x+y\big|
\Bigg(x+y\Bigg)
\Bigg[x+y\Bigg]
\Bigg|x+y\Bigg|
\bigg(x+y\bigg)
\bigg[x+y\bigg]
\bigg|x+y\bigg|
\Bigl(x+y\Bigr)
\Bigl[x+y\Bigr]
\Bigl|x+y\Bigr|
\bigl(x+y\bigr)
\bigl[x+y\bigr]
\bigl|x+y\bigr|
\Biggl(x+y\Biggr)
\Biggl[x+y\Biggr]
\Biggl|x+y\Biggr|
\biggl(x+y\biggr)
\biggl[x+y\biggr]
\biggl|x+y\biggr|
$
\end{document}

Troy
  • 13,741
  • 1
    +1, but it should be \bigl( and \bigr) (the same for [ and ]) nontheless. – egreg Jun 16 '18 at 17:42
  • It works, but now other commands have the same problem because latex-document.cwl is un-checked. Anyway, Ι understand how the whole thing works. Thank you very much for your answers! – Fotis K Jun 16 '18 at 17:46
  • @egreg Indeed. Thanks, will include the fix later. No time to do it in detail now, but I'll add a note in my answer for now. – Troy Jun 16 '18 at 17:46
  • I downloaded this file https://sourceforge.net/p/texstudio/hg/ci/default/tree/completion/latex-document.cwl and I changed specific commands with yours e.g. \big(%|\big)#mM --> \big(%|\big)#m. I think it was fixed. The strange is that \big| is fine, but \big( or \big[ had problem. Anyway, which I can find examples for creating files .cwl? – Fotis K Jun 16 '18 at 18:46
  • @fotis81 The user manual describes the cwl syntax. For examples, just browse the source code or search this site for [texstudio] cwl for example. Anyway, I think it's a bug with the M and K formats, so what I have above is a workaround, not a fix. – Troy Jun 16 '18 at 18:59
  • Τhank you for your help! – Fotis K Jun 16 '18 at 19:33
  • @fotis81 If you can, give the developmental snapshot a go (see updated answer). The bug has been fixed. (Also, do take the advice of the other users and use \bigl(...\bigr) instead of \big(..\big).) – Troy Jun 16 '18 at 21:51