EinarAndreas / TeXcount

TeXcount
9 stars 1 forks source link

URL with % in throws error #5

Open edlongman opened 2 years ago

edlongman commented 2 years ago

Sample:

\begin{itemize}
\raggedright
  \item [] Item point \url{http://google.com/search#%}
\end{itemize}

Errors thrown

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

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

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

!!! Environment ended while waiting for d{itemize}. !!!
EinarAndreas commented 2 years ago

Yes, this is a bug.

What causes the problem is the % in the url which is interpreted as starting a TeX comment, although \url should be processed as ignoring the argument irrespective of the content.

The immediate fix is to explicitly mark the whole url to be ignored using TeXcount instructions marked by %TC:

\begin{itemize}
\raggedright
  \item [] Item point
  %TC:ignore
  \url{http://google.com/search#%}
  %TC:endignore
\end{itemize}

Will see if I can fix this, but until then, you'll have to make use of this quick-fix.

edlongman commented 2 years ago

Thanks for the work around, I hope you're able to fix it well