texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.83k stars 345 forks source link

Spell check of meaningful text inside commands (e.g. moderncv cventry{TEXT}) #260

Closed FranzFelberer closed 6 years ago

FranzFelberer commented 6 years ago

Environment

Expected behavior

Spell check every meaningful text, that is shown in the output file

Actual behavior

ignoring text entries for \cventry arguments that are displayed

How to reproduce

open moderncv example from github https://github.com/xdanaux/moderncv

sunderme commented 6 years ago

txs uses the cwl files to determine the meaning of the arguments. Automatically scanned packages don‘t have that information and hence all arguments are considered to be non-text arguments. To change that you need to change the cwl file, see wiki and manual http://texstudio.sourceforge.net/manual/current/usermanual_en.html#CWLDESCRIPTION

FranzFelberer commented 6 years ago

Thanks, unfortunately I can't figure out how to use it, I have 2 problems: 1. I created a moderncv.cwl file in ~/.config/texstudio/completion/user

it is not used as completion as txs shows the following auto-completion: \cventry{year--year}{degree or job title}{institution or employer}{city}{grade}{description}

even I set \cventry{%<year_start%>--%<year%>}{%<degree or job title%>}{%<institution or employer%>}{%<city%>}{%<grade%>}{%<description%>}#n in my moderncv.cwl file.

  1. I did not understand how use cwl code to set a argument as text. mode=#text ?
sunderme commented 6 years ago

I don‘t understand your first issue. It completes with the command which you want ?

2) the argument needs to be „text“ or „title“

FranzFelberer commented 6 years ago

sorry for the confusion. I didn't make myself very clear:

  1. my moderncv.cwl file is ignored by txs. Any idea why?

  2. so the arguments should like below in order to spellcheck the second argument and use the text between % % for auto-completion?

\cventry{%<year%>--%<year%>}{text%<degree or job title%>}

sunderme commented 6 years ago

it is „degree....%text“ , no need to use %<%> all the time.

you can activate a cwl manually in the options. Apart from that txs uses the documentclass and usepackage to determine whoch cwls to use, see wiki

FranzFelberer commented 6 years ago

Doing what you mentioned solves the problem that the "manuell" spell checker checks this text, I was referring to the on-type spell checker that indicates mistakes while writing by a red unline-ripple. It shows this behavior if in the same argument the text has a property like \testbf. See image: It indicates no error for the first "wrongwriten" but for the second which is in a \textbf environment.

image

sunderme commented 6 years ago

\cventry{year-year}{degree or job title%text}{institution or employer%text}{city}{grade}{description%text}#n works fine here

FranzFelberer commented 6 years ago

Thank you, I got it working, but I experience some other strange behavior.

I defined a command in my tex file:

% switch between languages
\newcommand{\multilang}[3]{#1}  % #1 en, #2 fr, #3 de

In ~/.config/texstudio/completion/usercommands.cwl I add the line: \multilang{en%text}{fr%text}{de%text}#n

But completion results in: \multilang{arg1}{arg2}{arg3}

Strange is, that it was working and now it doesn't anymore.

sunderme commented 6 years ago

define the command in a sty file, and it should work

FranzFelberer commented 6 years ago

thanks for your help. that doesn't solve the problem. the strange thing is:

stefanbschneider commented 5 years ago

The class-moderncv.cwl looks like this issue should be fixed.

But I still have the problem that TeXStudio doesn't do spellchecking in my \cventry commands. What's the problem?

sunderme commented 5 years ago

do you have the latest version of txs ?

stefanbschneider commented 5 years ago

Yes, version 2.12.14

stefanbschneider commented 5 years ago

Here's a screenshot:

image

sunderme commented 5 years ago

Here is mine: test

sunderme commented 5 years ago

you need to use a development build to make use of the fix

stefanbschneider commented 5 years ago

So this is a bug, which is not yet fixed in the current version 2.12.14?

sunderme commented 5 years ago

looks like it