tecosaur / LaTeX-Utilities

An add-on to LaTeX Workshop that provides some features that go beyond the bare essentials
MIT License
474 stars 28 forks source link

Couting characters works but... #368

Closed dbourrion closed 1 year ago

dbourrion commented 1 year ago

First, many many thanks to @leoleoasd for adding the counting of characters to that extension. It works perfectly on my *.tex (flat text for novels) execpt in one case.

In some manuscripts, I'm using that sequence to have a nice toc

\part*{Name of the part} \addcontentsline{toc}{part}{Name of the part} \addtocontents{toc}{\protect\begin{adjustwidth}{1cm}{0cm}} %% Begin The text of that part \addtocontents{toc}{\protect\end{adjustwidth}}% End

In this case, couting (words or characters) stops working. I'm see only "0 words" in my status bar.

The couting works again wen I'm cutting

\addtocontents{toc}{\protect\begin{adjustwidth}{1cm}{0cm}} %% Begin

and

\addtocontents{toc}{\protect\end{adjustwidth}}% End

leoleoasd commented 1 year ago

can you try manually invoking texcount from your terminal?

texcount -char -brief xxx.tex
dbourrion commented 1 year ago

Hi @leoleoasd Yep, I can. Got this

` !!! Encountered } without corresponding {. !!!

!!! Encountered \end without corresponding \begin !!!

!!! Encountered } without corresponding {. !!!

!!! Encountered \end without corresponding \begin !!!

!!! Encountered } without corresponding {. !!!

!!! Encountered \end without corresponding \begin !!!

!!! Reached end of file while waiting for \end. !!!

!!! Environment ended while waiting for d{adjustwidth}. !!!

!!! Reached end of file while waiting for }. !!!

!!! Reached end of file while waiting for \end. !!!

!!! Environment ended while waiting for d{adjustwidth}. !!!

!!! Reached end of file while waiting for }. !!!

!!! Reached end of file while waiting for \end. !!!

!!! Environment ended while waiting for d{adjustwidth}. !!!

!!! Reached end of file while waiting for }. !!! `

Perhaps something important : the .tex I'm trying is a \include of a master .tex

leoleoasd commented 1 year ago

Since we are just calling texcount, and if it can't correctly parse your document, we can't really do anything about it. Maybe you can take this issue to texcount, or try to edit your document until texcount stops complaining?

dbourrion commented 1 year ago

Yes, that's what I was going to do : edit my document another way.

Many thanks for the characters couting, anyway.

Best regards.