Baffled

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Baffled

MacOSX-TeX mailing list
I wanted to create a “double arrow overline” in plain TeX; I created the macro \overleftrightarrow by imitating what is done in the TeXbook in creating “overleftarrow” and “overrightarrow” After some tweaking, I got it to work. But here is the strange thing: by coincidence, I had the command “\input\miniltx.tex” at the beginning of the file, which I use to be able to draw pictures using the “graphicx” package. The problem is, if I remove this command, then the definition doesn’t work, the typesetter complains about the command “\m@th”
I was blindly following the definitions in the TeXbook, my knowledge of the fine points in TeX is very (very!) limited. Still, I am baffled, since Knuth’s book deals with plain TeX, not with LaTeX.

Can anyone illuminate me and let me know why is “miniltx” required for this definition to work?

Thanks
Juan

Below is a sample file

%
\input miniltx.tex  
% \RequirePackage{graphicx}

%
%%%%%%%%%%%%%%%%%%
%
% DEFINE "over left right arrow". INSPIRATION:
%. TeX book, definition of \overleftarrow on p. 359
%.        plus definitions of \leftarrowfill and \rightarrowfill on p. 357
% First need "left right arrow fill" defined
\def\leftrightarrowfill{$\m@th \mathord\leftarrow \mkern-6mu
    \cleaders\hbox{$\mkern-2mu \mathord- \mkern-2mu$}\hfill
    \mkern -6mu \mathord \rightarrow$}
%
\def\overleftrightarrow#1{\vbox{\ialign{##\crcr
      \leftrightarrowfill\crcr\noalign{\kern-1pt\nointerlineskip}
      $\hfil\displaystyle{#1}\hfil$\crcr}}}
%
%________________________________________________________________

Any two distinct points $A$ and $B$ determine a unique line $\overleftrightarrow{AB}$.    

\bye
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Baffled

Ross Moore-3
Hello Juan,

On 31 Jan 2020, at 2:53 pm, juan tolosa via MacOSX-TeX <[hidden email]> wrote:

I wanted to create a “double arrow overline” in plain TeX; I created the macro \overleftrightarrow by imitating what is done in the TeXbook in creating “overleftarrow” and “overrightarrow” After some tweaking, I got it to work. But here is the strange thing: by coincidence, I had the command “\input\miniltx.tex” at the beginning of the file, which I use to be able to draw pictures using the “graphicx” package. The problem is, if I remove this command, then the definition doesn’t work, the typesetter complains about the command “\m@th”
I was blindly following the definitions in the TeXbook, my knowledge of the fine points in TeX is very (very!) limited. Still, I am baffled, since Knuth’s book deals with plain TeX, not with LaTeX.

Can anyone illuminate me and let me know why is “miniltx” required for this definition to work?

It isn’t.

You just need to change the \catcode of @ while definitions using it are being made:


Thanks
Juan

Below is a sample file

%
\input miniltx.tex
% \RequirePackage{graphicx}

%
%%%%%%%%%%%%%%%%%%
%
% DEFINE "over left right arrow". INSPIRATION:
%. TeX book, definition of \overleftarrow on p. 359
%. plus definitions of \leftarrowfill and \rightarrowfill on p. 357
% First need "left right arrow fill” defined

\catcode`\@ 11  %%% <<<<   make @ into a letter

\def\leftrightarrowfill{$\m@th \mathord\leftarrow \mkern-6mu
\cleaders\hbox{$\mkern-2mu \mathord- \mkern-2mu$}\hfill
\mkern -6mu \mathord \rightarrow$}
%

\catcode`\@ 12  %%% <<<<  revert @ to being a punctuation character


\def\overleftrightarrow#1{\vbox{\ialign{##\crcr
\leftrightarrowfill\crcr\noalign{\kern-1pt\nointerlineskip}
$\hfil\displaystyle{#1}\hfil$\crcr}}}
%
%________________________________________________________________

Any two distinct points $A$ and $B$ determine a unique line $\overleftrightarrow{AB}$.

\bye



Hope this helps.

Ross



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Baffled

G. M.-S.
In reply to this post by MacOSX-TeX mailing list

Try replacing
\m@th 
with
\mathsurround=0pt 
(which is the definition of \m@th).

Regards,

Guillermo

On Fri, 31 Jan 2020 at 04:54, juan tolosa via MacOSX-TeX <[hidden email]> wrote:
I wanted to create a “double arrow overline” in plain TeX; I created the macro \overleftrightarrow by imitating what is done in the TeXbook in creating “overleftarrow” and “overrightarrow” After some tweaking, I got it to work. But here is the strange thing: by coincidence, I had the command “\input\miniltx.tex” at the beginning of the file, which I use to be able to draw pictures using the “graphicx” package. The problem is, if I remove this command, then the definition doesn’t work, the typesetter complains about the command “\m@th”
I was blindly following the definitions in the TeXbook, my knowledge of the fine points in TeX is very (very!) limited. Still, I am baffled, since Knuth’s book deals with plain TeX, not with LaTeX.

Can anyone illuminate me and let me know why is “miniltx” required for this definition to work?

Thanks
Juan

Below is a sample file

%
\input miniltx.tex 
% \RequirePackage{graphicx}

%
%%%%%%%%%%%%%%%%%%
%
% DEFINE "over left right arrow". INSPIRATION:
%. TeX book, definition of \overleftarrow on p. 359
%.        plus definitions of \leftarrowfill and \rightarrowfill on p. 357
% First need "left right arrow fill" defined
\def\leftrightarrowfill{$\m@th \mathord\leftarrow \mkern-6mu
    \cleaders\hbox{$\mkern-2mu \mathord- \mkern-2mu$}\hfill
    \mkern -6mu \mathord \rightarrow$}
%
\def\overleftrightarrow#1{\vbox{\ialign{##\crcr
      \leftrightarrowfill\crcr\noalign{\kern-1pt\nointerlineskip}
      $\hfil\displaystyle{#1}\hfil$\crcr}}}
%
%________________________________________________________________

Any two distinct points $A$ and $B$ determine a unique line $\overleftrightarrow{AB}$.     

\bye
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex