latex3 / fontspec

Font selection in LaTeX for XeTeX and LuaTeX
http://latex3.github.io/fontspec/
LaTeX Project Public License v1.3c
277 stars 34 forks source link

Adjust handling of visible space char for \verb* #339

Closed FrankMittelbach closed 5 years ago

FrankMittelbach commented 6 years ago

Please adjust code to fit with 2e kernel changes from https://github.com/latex3/latex2e/issues/70

wspr commented 5 years ago

The fontspec package currently patches \verb as well as the packages verbatim, moreverb, listings, and fancyvrb. Do you know off-hand whether any of these packages have also been updated?

wspr commented 5 years ago

My current plan is to check if \verbvisiblespace has been defined, and if so turn off all patching. This may cause regressions with other packages but might be a good incentive to get updates into those packages...

FrankMittelbach commented 5 years ago

Would need checking, as there have been some updates at least to listings and fancyvrb recently, but I doubt they covered that (verbatim most certainly hasn't (and it is ours so that is a clear oversight and should be fixed in 2e tools)).

eg9 commented 5 years ago

Actually, listings still needs to be patched; it uses \textvisiblespace in general, but when the current font family is the monospaced one.

\def\lst@ttfamily#1#2{\ifx\f@family\ttdefault#1\relax\else#2\fi}
\def\lst@visiblespace{\lst@ttfamily{\char32}\textvisiblespace}

Since patching \lst@visiblespace has been removed, the consequence is that visible spaces are sometimes lost with listings.

I guess that listings should be updated to have

\def\lst@visiblespace{\lst@ttfamily\verbvisiblespace\textvisiblespace}

but I'm not sure that can happen soon.

See https://tex.stackexchange.com/q/514982/4427

FrankMittelbach commented 5 years ago

@eg9 why do you think listings couldn't be patched (any time soon)? It would be a more natural place, but of course, as a temporary measure @wspr could add your suggested patch here.