[texhax] Change the definition of LaTeX \oval?

Hironobu YAMASHITA h.y.acetaminophen at gmail.com
Wed Feb 24 14:13:39 CET 2016


I attach patches for ltpictur.dtx and slides.dtx, to suppress
warnings from dvipdfmx: "Too thin line." Without the patches, too
short lines (the length is almost zero) are drawn by LaTeX \@oval,
resulting in a lot of warnings from dvipdfmx such as
   dvipdfmx:warning: Too thin line: height=1 (1.52018e-05 bp)
   dvipdfmx:warning: Too thin line: width=1 (1.52018e-05 bp)
or unexpected bad output from dvips. These results come from
bad implementation of LaTeX \@oval macro, rather than bugs of
dvipdfmx or dvips. My patches fix these problems, so you will get
no warnings from dvipdfmx, and output from dvips + ps2pdf also
becomes better. Some test cases are also available from:
- [test-20160221.zip] http://bit.ly/1VE3yDb

And I'd like to ask list members whether my patches would cause
some bad effects on existing LaTeX packages and sources.

Several days ago I wrote these patches and sent to LaTeX team,
however, neither the members of the team nor I could answer the
question. Actually the code discussed now is very very old (it's
there since the start of LaTeX), so it's natural most people hesitate
to change the code permanently. However, I think the device-
independent codes in LaTeX picture environment is still useful in
some cases. And I believe non-critical warnings arising from bad
implementation should go away.

Any suggestions are appreciated. I hope someone in the list find
my patches worth considering...

Thank you,
Hironobu Yamashita
-------------- next part --------------
--- ltpictur.dtx.orig	Sat Jan 30 14:37:04 2016
+++ ltpictur.dtx	Tue Feb 16 23:28:32 2016
@@ -1051,6 +1051,18 @@
 % \end{macro}
 %
 %
+% \begin{macro}{\if at ovvline}
+% \begin{macro}{\if at ovhline}
+% If vertical/horizontal leaders for filling are required.
+%    \begin{macrocode}
+\newif\if at ovvline
+\newif\if at ovhline
+\@ovvlinetrue \@ovhlinetrue
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
 % \begin{macro}{\@ovxx}
 % \begin{macro}{\@ovyy}
 % \begin{macro}{\@ovdx}
@@ -1129,15 +1141,18 @@
 %    \begin{macrocode}
 \gdef\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen
   \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
+  \@ovvlinefalse \@ovhlinefalse
   \@tfor\reserved at a :=#3\do{\csname @ov\reserved at a false\endcsname}%
-  \@ovxx
-  #1\unitlength \@ovyy #2\unitlength
-  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
+  \@ovxx #1\unitlength \@ovyy #2\unitlength
+  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx \@ovvlinetrue
+  \else \@ovyy \ifdim \@ovyy =\@ovxx \else \@ovhlinetrue \fi\fi
   \advance \@tempdimb -2\p@
   \@getcirc \@tempdimb
   \@ovro \ht\@tempboxa \@ovri \dp\@tempboxa
   \@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@
   \@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@
+  \ifdim \@ovdx >\z@ \@ovhlinetrue \fi
+  \ifdim \@ovdy >\z@ \@ovvlinetrue \fi
   \@circlefnt \setbox\@tempboxa
   \hbox{\if at ovr \@ovvert32\kern -\@tempdima \fi
   \if at ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi
@@ -1155,7 +1170,8 @@
     \if at ovb \@tempcntb \@tempcnta \advance \@tempcntb #1\relax
       \kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip
     \else \kern \@ovri \kern \@ovdy \fi
-    \leaders\vrule \@width \@wholewidth\vfil \nointerlineskip
+    \if at ovvline \leaders\vrule \@width \@wholewidth \fi
+    \vfil \nointerlineskip
     \if at ovt \@tempcntb \@tempcnta \advance \@tempcntb #2\relax
       \hbox{\char \@tempcntb}%
     \else \kern \@ovdy \kern \@ovro \fi}}
@@ -1166,7 +1182,7 @@
 %    \begin{macrocode}
 \gdef\@ovhorz{\hb at xt@\@ovxx{\kern \@ovro
     \if at ovr \else \kern \@ovdx \fi
-    \leaders \hrule \@height \@wholewidth \hfil
+    \if at ovhline \leaders \hrule \@height \@wholewidth \fi \hfil
     \if at ovl \else \kern \@ovdx \fi
     \kern \@ovri}}
 %    \end{macrocode}
-------------- next part --------------
--- slides.dtx.orig	Thu Aug 06 18:04:58 2015
+++ slides.dtx	Sun Feb 21 21:50:46 2016
@@ -2420,17 +2420,20 @@
 \relax\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }%
 \vskip\@dashdim}}}\fi\@makepicbox(#2,#3)}
 
-\def\@oval(#1,#2)[#3]{\if at visible\begingroup \boxmaxdepth \maxdimen
+\def\@oval(#1,#2)[#3]{\if at visible\begingroup\boxmaxdepth \maxdimen
   \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
-  \@tfor\reserved at a :=#3\do
-     {\csname @ov\reserved at a false\endcsname}\@ovxx
-  #1\unitlength \@ovyy #2\unitlength
-  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
+  \@ovvlinefalse \@ovhlinefalse
+  \@tfor\reserved at a :=#3\do{\csname @ov\reserved at a false\endcsname}%
+  \@ovxx #1\unitlength \@ovyy #2\unitlength
+  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx \@ovvlinetrue
+  \else \@ovyy \ifdim \@ovyy =\@ovxx \else \@ovhlinetrue \fi\fi
   \advance \@tempdimb -2\p@
   \@getcirc \@tempdimb
   \@ovro \ht\@tempboxa \@ovri \dp\@tempboxa
   \@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@
   \@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@
+  \ifdim \@ovdx >\z@ \@ovhlinetrue \fi
+  \ifdim \@ovdy >\z@ \@ovvlinetrue \fi
   \@circlefnt \setbox\@tempboxa
   \hbox{\if at ovr \@ovvert32\kern -\@tempdima \fi
   \if at ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi


More information about the texhax mailing list