bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: microtype for texinfo


From: Gavin Smith
Subject: Re: microtype for texinfo
Date: Sat, 24 Sep 2022 15:29:55 +0100

On Sat, Sep 17, 2022 at 02:28:08PM -0600, Karl Berry wrote:
> Hi Gavin. I've found that the microtype package for LaTeX
> (https://ctan.org/pkg/microtype) helps significantly in eliminating
> overfull lines without the need for rewriting text. (It also improves
> the esthetic appearance of the typeset text.)
> 
> Therefore I suggest adding it to Texinfo. Maybe with a way to turn it
> on/off within a document, just in case, although in practice, I have
> found that I always want it.  It's most useful with the fonts used in
> running text, not so much for titles and headings.

Your code worked except I had to change \tenrm to \textrm.

If you haven't tried the output with Texinfo manuals then the following
patch turns uses the microtype feature unconditionally:

diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index cc0f1fa2e2..32ec081f62 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -11400,6 +11400,71 @@ directory should work if nowhere else does.}
 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
 \hfuzz = 1pt
 
+\ifx\luatexversion\thisisundefined
+  \ifpdf % pdfTeX
+    \pdfadjustspacing=2
+     \def\mtplnfontexpand#1{%
+       \pdffontexpand#1 20 20 1 autoexpand\relax}
+  \else
+     \def\mtplnfontexpand#1{}
+  \fi
+\else % LuaTeX
+  \adjustspacing=2
+  \def\mtplnfontexpand#1{%
+    \expandglyphsinfont#1 20 20 1\relax}
+\fi
+\mtplnfontexpand\textrm
+\mtplnfontexpand\textsl
+\mtplnfontexpand\textbf
+
+% protrusion, from Thanh's protcode.tex.
+\def\mtplnsetprotcode#1{%
+    \rpcode#1`\!=200
+    \rpcode#1`\,=700
+    \rpcode#1`\-=700
+    \rpcode#1`\.=700
+    \rpcode#1`\;=500
+    \rpcode#1`\:=500
+    \rpcode#1`\?=200
+    \lpcode#1`\`=700
+    \rpcode#1`\'=700
+    \lpcode#1 92=500  % ``
+    \rpcode#1 34=500  % ''
+    \rpcode#1 123=300 % --
+    \rpcode#1 124=200 % ---
+    \rpcode#1`\)=50
+    \rpcode#1`\A=50
+    \rpcode#1`\F=50
+    \rpcode#1`\K=50
+    \rpcode#1`\L=50
+    \rpcode#1`\T=50
+    \rpcode#1`\V=50
+    \rpcode#1`\W=50
+    \rpcode#1`\X=50
+    \rpcode#1`\Y=50
+    \rpcode#1`\k=50
+    \rpcode#1`\r=50
+    \rpcode#1`\t=50
+    \rpcode#1`\v=50
+    \rpcode#1`\w=50
+    \rpcode#1`\x=50
+    \rpcode#1`\y=50
+    \lpcode#1`\(=50
+    \lpcode#1`\A=50
+    \lpcode#1`\J=50
+    \lpcode#1`\T=50
+    \lpcode#1`\V=50
+    \lpcode#1`\W=50
+    \lpcode#1`\X=50
+    \lpcode#1`\Y=50
+    \lpcode#1`\v=50
+    \lpcode#1`\w=50
+    \lpcode#1`\x=50
+    \lpcode#1`\y=0
+    %\adjustprotcode#1\relax
+}
+\mtplnsetprotcode\textrm
+
 
 \message{and turning on texinfo input format.}
 

 
I am mainly unsure about if/how this should be turned on in Texinfo files.
This would lead to variant output between (dvi)-TeX, pdfTeX and possibly
LuaTeX which might be undesirable.

I find it hard to judge whether the output is an improvement.  The most
notable change is that many less lines appear to be hyphenated.


> The code below does not change the typewriter font (\tentt for plain).
> Although doing so would be extremely helpful for running text that
> includes lots of typewriter, as Texinfo documents often do, it is
> critical to then turn off microtype in typewriter displays like
> @example. Otherwise the fixed-spacing alignment is visibly disturbed. I
> think it would be worth doing this for Texinfo, if you have time and
> energy for it.
> 
> The pdftex manual describes the primitives tersely. The microtype package
> manual goes into tons of detail at every level, and has values for more
> characters, etc., if desired. (Also values for additional fonts, but
> that's not an issue for Texinfo.)
> https://ctan.org/pkg/pdftex
> https://ctan.org/pkg/microtype

I'm not sure if it's worth the trouble.  Maybe in the future or if there
is a lot of enthusiasm for this feature.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]