Closed matthias314 closed 8 months ago
Thanks for your work. I'm unable to apply this patch cleanly on 0.60.8 Is there something I'm missing?
@dkwo: There have been several (more or less) recent commits fixing typos in the documentation, the latest being #624. They can be ignored. Are there any conflicts regarding the code?
Applying the file obtained by appending .patch to this PR on top of the 0.60.8 tarball, besides the manual
1 out of 1 hunk FAILED -- saving rejects to file manual/aspell.1.rej 1 out of 5 hunks FAILED -- saving rejects to file manual/aspell.texi.rej
I get this failure:
3 out of 6 hunks FAILED -- saving rejects to file modules/filter/tex.cpp.rej
@dkwo: That's strange. I've downloaded the patch and the 0.60.8 tar ball. Then
/tmp/aspell-0.60.8$ patch --dry-run --verbose -p1 </tmp/625.patch
gives (among other things)
checking file modules/filter/tex.cpp
Using Plan A...
Hunk #1 succeeded at 32.
Hunk #2 succeeded at 53.
Hunk #3 succeeded at 71.
Hunk #4 succeeded at 99.
Hunk #5 succeeded at 267.
Hunk #6 succeeded at 294.
My bad, sorry about that. I downloaded the patch again, and now it applies cleanly, if I remove the manuals part.
It seems to work fine here, but I have one question.
Suppose I want to ignore the \cref
command (similar to \eqref
and \ref
): what is the correct synax to pass aspell?
To ignore \cref{label}
, you put
add-tex-command cref p
into your .aspell.conf
file. One could also add a corresponding definition to modules/filter/tex-filter.info
, and for many other macros as well.
Thank you.
I've been using this for almost a year, can confirm it works well. @kevina any chance it can be merged?
@dkwo @matthias314 my main concern with this is causing a regression. I would be more willing to accept this if it has some test cases. There is now a primitive framework for this is the tests/ directory (see the filter-test target in the Makefile). Ideally I would like to first accept a pull request with some tests for the existing TeX filter to make sure this new filter doesn't break anything.
@matthias314, I am leaning towards accepting this once the above issues are resolved.
To be clear by above issues I mean the two comments in the code review, tests would be nice, but not really required.
I'm very sorry for my belated reply.
Regarding a potential regression: That's a valid point. I've been using the new TeX mode for many years now, but only on a very limited variety of LaTeX documents. By the same token, I think that if I got around to add test documents, then they would only cover a tiny fraction of the kinds of documents other users have. Would be a possible alternative to add the new TeX mode besides the existing one so that users could fall back to the old version in case the new one causes problems?
Would be a possible alternative to add the new TeX mode besides the existing one so that users could fall back to the old version in case the new one causes problems?
I thought about that, but rejected the idea as being too complicated, but that was many years ago. I'll have another look sometime soonish. Hopefully by the end of the weekend.
Closing in favor of #644
This patch (hopefully) improves Aspell's TeX mode. It is practically identical to the one posted to the Aspell mailing list in 2011.
New features implemented by this patch
Aspell skips over math content inside
$...$
,$$..$$
,\(...\)
,\[...\]
and common LaTeX and AMS-LaTeX environments likeequation
andgather
. Additional environments to be skipped over can be defined via the newtex-ignore-env
list. Otherwise math formulas trigger a huge number of false alarms.Forced spell-checking of macro arguments while skipping over arguments or environments. This is achieved with the new
T
option toadd-tex-command
. Remarks added in 2022 about theT
option:T
was supposed to mean "toggle". MaybeF
for "force" would be a better choice.P
option? Asked differently: What LaTeX macros are there usingP
where we don’t want the corresponding argument to be spell checked in math mode? Such a macro should also have arguments without spell checking because otherwise there is no need to define it in Aspell. I can only think of\textcolor{color}{text}
fromcolor.sty
(wheretext
can also be in math mode!).Discretionary hyphens and italic corrections are ignored. For example,
hy\-phen
andshelf\/ful
are recognized as single words.Spell-checking can be manually switched on and off by putting the text
aspell:on
andaspell:off
into the file. This allows to skip over macro definitions and other parts of text that confuse Aspell.See the Info file for more details.
Comments about the changes
./modules/filter/context.cpp It seems that the order of the context filter was undefined. Whether one wants to have this filter before or after other filters depends on the application in mind. I need it before the tex filter so that one can place the
aspell:off
andaspell:on
flags inside TeX comments../modules/filter/tex.cpp The new code for the tex filter.
./modules/filter/tex-filter.info The new default settings for the filter variables.
tex-ignore-env
is new. Most changes totex-command
are related to the newT
option. The newbegin
line is used internally. The rest are additions and corrections to existing definitions../modules/filter/modes/tex.amf Note that we enable the context filter by default.
./manual/aspell.1 ./manual/aspell.texi Updated documentation.