YaLafi icon indicating copy to clipboard operation
YaLafi copied to clipboard

Exclude align, align*, split, split* and circuitikz

Open mfbehrens opened this issue 5 years ago • 6 comments

In my LaTeX file I have the following lines:

\begin{circuitikz}
	\ctikzset{voltage/bump b/.initial=0} % defines arrow's curvature
	\draw (0,3) to[short,o-*] (1,3) -- (1,3.5) to[R,l=$R$] (4,3.5) to[L=$L$] (7,3.5) -- (7,3) to[short,i=$I_{Last}$,*-] (9,3)
	to[R,l=$R_{Last}$] (9,0) to[short,-o] (0,0);
	\draw (1,3) -- (1,2.5) to[C,l_=$C$] (7,2.5) -- (7,3);
	\draw (0,3) to[open,v=$U_e$] (0,0);
\end{circuitikz}

Since this is describing an electronic circuit this should not be checked for grammar and spelling.

The same is true for align and split sections, which are holding mathematical expressions like $$xyz$$

Would be great if sections like these could be excluded from spellchecking.

mfbehrens avatar Jan 21 '21 20:01 mfbehrens

Thank you for spotting this!

I'll add an extension module for LaTeX package circuitikz. It will ignore the environment. Are you aware of other important environments or macros that should be included?

Environment align(*) is handled by extension module amsmath. This should be loaded unless you pass option --packages with a package list not containing amsmath. If this is not the case, could you please provide a minimum LaTeX example together with the arguments passed to yalafi.shell?

And yes, environment split(*) is missing. I'll add it.

matze-dd avatar Jan 22 '21 10:01 matze-dd

Okay thank you, I didn't even know about the packages. However, I tried it again with the amsmath package. python -m yalafi.shell --language=de-DE --server=my --packages=amsmath "C:\Users\mfbeh\aufg1.tex" --output html >> te.html However I'm still getting many error messages: image

mfbehrens avatar Jan 22 '21 18:01 mfbehrens

The first three should be due to missing commas, see here, especially under this point. You can turn this parsing off with option --simple-equations.

The problems around double ampersands && seem to reveal a bug. I did not think of this case. Option --simple-equations will turn this off, too.

A question: Normally, amsmath should be loaded if you do not specify a --packages option; by default, then all modules are activated. Doesn't this work for you?

matze-dd avatar Jan 23 '21 09:01 matze-dd

Package circuitikz has been added with PR #166.

Environment split(*) is only accepted by LaTeX inside of a displayed equation. It is therefore unnecessary to add it to package amsmath.

The problem with double ampersands && in displayed equations seems to be rather hard. I cannot promise to fix it very soon. As a work-around, you can use option --simple-equations or hide the ampersands to the filter with \LTskip{&&}.

matze-dd avatar Jan 28 '21 11:01 matze-dd

Package circuitikz has been added with PR #166.

Thank you. This works for me!

Environment split(*) is only accepted by LaTeX inside of a displayed equation. It is therefore unnecessary to add it to package amsmath.

So do you mean that I have to put $$ around align and split. I looked at some tutorials on the internet and I didn't see many results where people were putting dollar signs around their align. Moreover, Greek letters which usually don't work without $$ are working inside split and align.

The problem with double ampersands && in displayed equations seems to be rather hard. I cannot promise to fix it very soon. As a work-around, you can use option --simple-equations or hide the ampersands to the filter with \LTskip{&&}.

Would be great if you could fix it, but we will see...

mfbehrens avatar Feb 03 '21 14:02 mfbehrens

Thank you. This works for me!

Excellent!

So do you mean that I have to put $$ around align and split.

No. This only concerns split. On my system, I get something like "split doesn't work here", if it is not in a displayed equation. The examples in the amsmath manual also surround split that way.

matze-dd avatar Feb 03 '21 19:02 matze-dd