-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally use KaTeX for csug and release_notes #761
base: main
Are you sure you want to change the base?
Conversation
8e8f4c2
to
0651eca
Compare
I've pushed some updates in response to @owaddell's dybvig/stex#7 (comment) In the process, I found that this repository contains the files:
which are slightly different both from each other and from the versions in Details (see follow-up comments for conclusions):In the case of diff --git a/stex/inputs/scheme.sty b/csug/scheme.sty
index 8e27c24c..db437b66 100644
--- a/stex/inputs/scheme.sty
+++ b/csug/scheme.sty
@@ -16,8 +16,41 @@
\def\startinteraction{\begin{minipage}[t]{2.2in}\vrule\begin{minipage}[t]{2.2in}\hrule\schemeindent=2pt}
\def\endinteraction{\hrule\end{minipage}\vrule\end{minipage}}
+\font\ninefivett=cmtt9 at 9.5pt
\newskip\ttglue
\ttglue=.5em plus .25em minus .15em
+\font\tinyvar=cmti7
+\font\smallvar=cmti9
+\font\summarysizevar=cmti9
+\font\indexsizevar=cmti8
+\font\normalvar=cmti10 at 11pt
+\def\schemelarge{%
+ \def\schemelarger{\fontsize{14}{16}}%
+ \def\schemesmaller{\fontsize{10}{12}}%
+ \def\tt{\fontsize{12}{14}\ttfamily}%
+ \def\var##1{{\normalvar##1\/}}}
+\def\schemenormal{%
+ \def\schemelarger{\fontsize{12}{14}}%
+ \def\schemesmaller{\fontsize{8}{9}}%
+ \def\tt{\fontsize{10pt}{11pt}\ttfamily\ninefivett}%
+ \def\var##1{{\smallvar##1\/}}}
+\def\schemesmall{%
+ \def\schemelarger{\fontsize{10}{12}}%
+ \def\schemesmaller{\fontsize{6}{7}}%
+ \def\tt{\fontsize{8}{9}\ttfamily}%
+ \def\var##1{{\smallvar##1\/}}}
+\def\schemesummarysize{%
+ \def\schemelarger{\fontsize{10}{12}}%
+ \def\schemesmaller{\fontsize{6}{7}}%
+ \def\tt{\fontsize{8}{9}\ttfamily}%
+ \def\var##1{{\summarysizevar##1\/}}}
+\def\schemeindexsize{%
+ \def\schemelarger{\fontsize{10}{12}}%
+ \def\schemesmaller{\fontsize{6}{7}}%
+ \def\tt{\fontsize{7}{8}\ttfamily}%
+ \def\var##1{{\indexsizevar##1\/}}}
+\schemenormal
+
\newskip\schemeindent
\schemeindent=0pt
{\obeyspaces\global\let =\ }
@@ -29,7 +62,7 @@
\def\schunderscore{\char`\_}
\def\schlbrace{\char`\{}
\def\schrbrace{\char`\}}
-\def\scheme#1{\mbox{\ttfamily\frenchspacing\spaceskip=\ttglue#1}}
+\def\scheme#1{\mbox{\tt\frenchspacing\spaceskip=\ttglue#1}}
\def\schemeblankline{\par\penalty-100\vskip .7\baselineskip}
\def\schemelinestart{{\leavevmode\hbox{\hskip \schemeindent\relax}}}
@@ -54,13 +87,3 @@
\def\beforeschemedisplay{\penalty-100\vskip\parskip\vskip5pt}
\def\afterschemedisplay{\penalty-200\vskip5pt}
-% From test/screenshotter/test.tex in the KaTeX source code, which says:
-% > Based on LaTeX's definition of \LaTeX, with L changed to K and kerns
-% > changed as in src/macros.js
-\DeclareRobustCommand{\KaTeX}{\mbox{%
-K\kern-.17em%
-{\sbox0 T\vbox to\ht0{\hbox%
- {\fontsize{.75em}{1em}\selectfont A}%
-\vss}}%
-\kern-.15em%
-\TeX}} diff --git a/stex/inputs/scheme.sty b/release_notes/scheme.sty
index 8e27c24c..72e85ee8 100644
--- a/stex/inputs/scheme.sty
+++ b/release_notes/scheme.sty
@@ -2,21 +2,12 @@
\def\transerr#1{\begingroup\slshape}
\def\transin#1{\begingroup\color{red}}
\def\transout#1{\begingroup\color{blue}}
-\def\traceout#1{\begingroup\color{blue}}
\def\endtranserr#1{\endgroup}
\def\endtransin#1{\endgroup}
\def\endtransout#1{\endgroup}
-\def\endtraceout#1{\endgroup}
-
-% this didn't work --- screwed up indentation:
-\long\def\showinteraction#1#2{\begin{minipage}[t]{4.375in}#1\end{minipage}\hfill\fbox{\begin{minipage}[t]{2in}#2\end{minipage}}}
-% so I resorted to this:
-\def\startrepl{\begin{minipage}[t]{4.3in}} % was 4.375 and 2 when interactionwindow = 28
-\def\endrepl{\end{minipage}}
-\def\startinteraction{\begin{minipage}[t]{2.2in}\vrule\begin{minipage}[t]{2.2in}\hrule\schemeindent=2pt}
-\def\endinteraction{\hrule\end{minipage}\vrule\end{minipage}}
\newskip\ttglue
+\let\ninefivett=\tt % \font\ninefivett=cmtt9 at 9.5pt
\ttglue=.5em plus .25em minus .15em
\newskip\schemeindent
\schemeindent=0pt
@@ -29,9 +20,9 @@
\def\schunderscore{\char`\_}
\def\schlbrace{\char`\{}
\def\schrbrace{\char`\}}
-\def\scheme#1{\mbox{\ttfamily\frenchspacing\spaceskip=\ttglue#1}}
+\def\scheme#1{\mbox{\ttfamily\ninefivett\frenchspacing\spaceskip=\ttglue#1}}
-\def\schemeblankline{\par\penalty-100\vskip .7\baselineskip}
+\def\schemeblankline{\par\beforeschemedisplay}
\def\schemelinestart{{\leavevmode\hbox{\hskip \schemeindent\relax}}}
%%% handle numbered lines in scheme.sty and scheme.hsty
%%% ---have scheme-prep produce only \schemelinestart
@@ -44,7 +35,7 @@
\def\is{\hbox to 2em{\hfil$\Rightarrow$\hfil}}%
\def\si{\hbox to 2em{\hfil}}%
\interlinepenalty=2000%
- \tt\obeyspaces\frenchspacing}
+ \baselineskip=11pt plus 1pt\ninefivett\obeyspaces\frenchspacing}
\def\schemedisplay{\beforeschemedisplay\noskip\schemedisplay}
\def\longcode\schemedisplay{\penalty-200\vskip 8pt plus 4pt%
\kern3pt\hrule\kern5pt\nobreak\noskip\schemedisplay}
@@ -54,13 +45,3 @@
\def\beforeschemedisplay{\penalty-100\vskip\parskip\vskip5pt}
\def\afterschemedisplay{\penalty-200\vskip5pt}
-% From test/screenshotter/test.tex in the KaTeX source code, which says:
-% > Based on LaTeX's definition of \LaTeX, with L changed to K and kerns
-% > changed as in src/macros.js
-\DeclareRobustCommand{\KaTeX}{\mbox{%
-K\kern-.17em%
-{\sbox0 T\vbox to\ht0{\hbox%
- {\fontsize{.75em}{1em}\selectfont A}%
-\vss}}%
-\kern-.15em%
-\TeX}} |
Well, at least |
9497a61
to
0e72026
Compare
I've force-pushed a rebased commit that more completely addresses @owaddell's dybvig/stex#7 (comment) and the follow-up issues I described in #761 (comment). I've also pushed an un-squashed version of these changes to https://github.com/LiberalArtist/ChezScheme/tree/hist/katex-2. It worked out to just remove I inlined the non-dead code from After these fixes, the following overfull
I have not managed to find the offending At this point, I think this PR is ready to merge as soon as dybvig/stex#7 is merged (so the stex submodule can point to the merged, and ideally tagged, version). |
KaTeX renders LaTeX math ahead-of-time to MathML and/or HTML. Its output is accessible to screen readers and other tools (instead of appearing as "<graphic>"), and it also does not suffer from the pixelation of math rendered to GIFs. Also, use scheme.sty and scheme.hsty from stex instead of stale copies with ad-hoc changes. Depends on dybvig/stex#7
0e72026
to
2aa6ce5
Compare
I've rebased this on the latest |
KaTeX renders LaTeX math ahead-of-time to MathML and/or HTML, as an alternative to rendering to GIF images. The most important benefit of using KaTeX is that its output is accessible to screenreaders and other assistive technologies, rather than appearing as
<graphic>
. The output also integrates with CSS, can be copied and pasted as text, can reflow across line breaks as needed, and doesn't suffer from pixelation.Depends on dybvig/stex#7
As an example, here is a comparison of the rendering of:
ChezScheme/csug/smgmt.stex
Lines 167 to 171 in 0654a2d