bug-texinfo
[Top][All Lists]
Advanced

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

Re: Inconsistent size of ASCII graphics as index initials


From: Gavin Smith
Subject: Re: Inconsistent size of ASCII graphics as index initials
Date: Fri, 24 Jul 2015 18:32:09 +0100

On 24 July 2015 at 09:55, Gavin Smith <address@hidden> wrote:
> On 23 July 2015 at 19:24, Karl Berry <address@hidden> wrote:
>> It's not the fonts as such, but the TeX constructs being used.  Getting
>> the ASCII characters to be typeset as ASCII characters at all is enough
>> of a pain that I've never worried much about the formatting in non-text
>> cases.  Some come from math fonts, some are always in typewriter, some
>> are standalone accents and thus look small, etc.
>>
>> The intent is that index initials are typeset at the "section size" (see
>> the \initial macro in texinfo.tex, around line 5029).  I surmise the
>> same results would be seen with @section output; I know I've seen
>> similar strange-size issues with headings.
>
> I've had good results by using more math font glyphs, in place of
> typewriter glyphs, for characters such as vertical bar. It appears
> more stylistically consistent with the regular non-typewriter Roman
> font.

Here's what I've got so far:

Hopefully most of it is self-explanatory. I haven't written a
ChangeLog entry yet but can do so once it's finalized.

I left the backslash as producing a typewriter backslash in cases
other than the index initial, because it's explicitly documented as
doing that. See (texinfo)Inserting a Backslash. Other characters like
^ now output in regular type, or typewriter type if in @t etc. Any
thoughts if that's the best idea? I'm having second thoughts now about
`"': the directed, curly `"' looks good as an index initial but maybe
it's better to keep it undirected elsewhere.

It would have been better if I could have used bold math symbols, but
from what I could tell this needs extra packages.

I think it produces good results with the Texinfo manual (although in
truth, many of its index entries would be better sorted under an
alphabetic character, but we don't have the option to have a separate
sort key yet). For example, the backslash and forward slash mirror
each other.

Index: texinfo.tex
===================================================================
--- texinfo.tex (revision 6455)
+++ texinfo.tex (working copy)
@@ -1884,6 +1884,7 @@
 % Section fonts (14.4pt).
 \def\secnominalsize{14pt}
 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
+\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
@@ -5026,9 +5027,25 @@
 % These macros are used by the sorted index file itself.
 % Change them to control the appearance of the index.

-\def\initial#1{{%
+\let\normalhyphen=-
+{\catcode`\/=13
+\catcode`\-=13
+\catcode`\=13
+\gdef\initial{%
+  \bgroup
+  \catcode`\/13
+  \catcode`\-13
+  % Can't get bold backslash so don't use bold forward slash
+  \def/{{\secrmnotbold \normalslash}}
+  \def-{{\normalhyphen\normalhyphen}}
+  \initialx
+}}
+
+\def\initialx#1{{%
   % Some minor font changes for the special characters.
-  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+  %\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+  \secfonts
+  \usemathbackslash
   %
   % Remove any glue we may have, we'll be inserting our own.
   \removelastskip
@@ -5050,6 +5067,7 @@
   % Do our best not to break after the initial.
   \nobreak
   \vskip .33\baselineskip plus .1\baselineskip
+  \egroup
 }}

 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
@@ -10182,27 +10200,34 @@
 % Most of these we simply print from the \tt font, but for some, we can
 % use math or other variants that look better in normal text.

+\catcode`\$=3\relax
 \catcode`\"=\active
 \def\activedoublequote{{\tt\char34}}
-\let"=\activedoublequote
-\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
-\chardef\hat=`\^
-\catcode`\^=\active \def\activehat{{\tt \hat}} \let^ = \activehat
+%\let"=\activedoublequote
+\let"=\normaldoublequote
+%\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
+\catcode`\~=\active \def\activetilde{\normaltilde} \let~ = \activetilde
+%\chardef\hat=`\^
+%\catcode`\^=\active \def\activehat{{\tt \hat}} \let^ = \activehat
+\catcode`\^=\active \def\activehat{\normalcaret} \let^ = \activehat

 \catcode`\_=\active
 \def_{\ifusingtt\normalunderscore\_}
 \let\realunder=_
 % Subroutine for the previous macro.
-\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
+\def\_{\leavevmode \kern.07em \vbox{\hrule width.33em height.06ex}\kern .07em }

 \catcode`\|=\active
-\def|{{\tt\char124}}
+\def|{\ifusingtt{\tt\char124}{$\vert$}}

 \chardef \less=`\<
-\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
+\catcode`\<=\active \def\activeless{\ifusingtt\less{$\less$}}
+\let< = \activeless
 \chardef \gtr=`\>
-\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
-\catcode`\+=\active \def+{{\tt \char 43}}
+\catcode`\>=\active \def\activegtr{\ifusingtt\gtr{$\gtr$}}
+%\catcode`\>=\active \def\activegtr{{\tt \gtr}}
+\let> = \activegtr
+\catcode`\+=\active \def+{\ifusingtt\normalplus{$\normalplus$}}
 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix

 % used for headline/footline in the output routine, in case the page
@@ -10265,6 +10290,8 @@
 @address@hidden@address@hidden
 @address@hidden@address@hidden

address@hidden@address@hidden@address@hidden@backslash}}}
+
 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
 % the literal character `\'.  Also revert - to its normal character, in
 % case the active - from code has slipped in.



reply via email to

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