-5

I am looking for a way to make a command for left version of \mapsto arrow with (AMS)TeX . This is what I tried to do:

\mathchardef\mapstochar="322F 
\def\leftmapsto{\leftarrow\mapstochar}
\def\longleftmapsto{\longleftarrow\mapstochar}

It "almost" works, if it were not for the 3/4 infinity sign that I get instead of the intended small vertical bar (1/3 of this one: |) that I need to place at the base of the left arrow. So I need the code for that little bar, since "322F gives me a wrong symbol.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Rado
  • 213
  • I have removed the comment thread and edited the question to focus on the technical aspect being asked. – Joseph Wright Mar 28 '22 at 10:14
  • It is of course entirely reasonable to ask for answers focussed on Plain TeX (or OpTeX or ...), not just LaTeX. However, it is a long-standing convention on the site that alternative approaches, for example using ConTeXt or Plain for a LaTeX question, or here using LaTeX for a Plain question, are in-scope. – Joseph Wright Mar 28 '22 at 10:15

3 Answers3

3

How about this? I'm afraid it uses a package, however, since the font still has to be loaded somehow. The font is documented here and the plain TeX version of it here.

\input stmary %
$a \mapsfrom b$

$a \longmapsfrom b$ \bye

output of code

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Alan Munn
  • 218,180
  • That actually worked (after tons of loading of files). Can you get the long version of that, just like \longmapsto ? Is stmary to do with the college, or ...? – Rado Mar 28 '22 at 00:14
  • 1
    The main problem of "pure Plain TeX" solutions (like is done when \input stmary) is that the fonts are loaded for 10pt size documents only. If you want to use such math in footnotes with smaller fonts, you must to reload all complicated font machinery for math again. Moreover, it is more complicated if you do not use Unicode math (where only single font with all math symbols and alphabets is loaded). For example, if the OpTeX solution is used then you can write \typosize[11/13] and all fonts are at 11pt size. And the control sequences \mapsfrom and \longmapsfrom are ready too. – wipet Mar 29 '22 at 06:24
3

The characters are Unicode U+21A4 () and U+27FB () Normally mapped to \mapsto and \longmapsto (which matches the HTML entity names) or you can just enter them directly as here.

enter image description here

Naturally you need a font that has these characters, That is set up in all reasonable tex formats, perhaps you'll prefer optex as being closer to plain syntax.

\fontfam[lm]

$ A ↤ B ⟻ C $

\bye

Or you could of course use plain tex directly with luatex or xetex and set up a suitable font (This is using latin modern math, process with the optex command)

David Carlisle
  • 757,742
0

Logically speaking, since \mapsto and \longmapsto are available, so are their reflections.

Typographically speaking, this can be done via low-level PDF code. Conveniently, the graphics package has already done all the heavy-lifting, wrapping a great many lines of code into one time-saving easy-to-use command: \reflectbox{...}.

So, without requiring a special font, thus:

shoulders of giants

Simple tasks can be done in plain more or less straightforwardly, but wrapper-functions and concomitant complexity start evolving out of the code fairly quickly.

"Shoulders of giants", and all that.

MWE

\documentclass{article}
\usepackage{graphicx}
\begin{document}

uiop $\mapsto$ \reflectbox{uiop}

uiop \reflectbox{$\mapsto$} \reflectbox{uiop}

\bigskip qwerty $\longmapsto$ \reflectbox{qwerty}

qwerty \reflectbox{$\longmapsto$} \reflectbox{qwerty} \end{document}


Addendum

Based on the engine-independent solution at Scale text (\scalebox) in Plain TeX/XeTeX to make it narrower, a plain version (pdftex, xetex, luatex) is:

MWE

\input graphicx.tex

uiop $\mapsto$ \reflectbox{uiop} \par uiop \reflectbox{$\mapsto$} \reflectbox{uiop} \par\bigskip qwerty $\longmapsto$ \reflectbox{qwerty} \par qwerty \reflectbox{$\longmapsto$} \reflectbox{qwerty}

\bye

plain

The linked question also gives a driver-specific version (graphics.sty plus dvipdfmx.def), manually coding up \Gscale@start and \Gscale@end (which insert the PDF literals), so that an input is not required.


For reference, here is a pdftex plain version of reflect, using its \pdf... primitives:

pdftex

MWE

pdftex

\protected\def\rbox#1{% \setbox0\hbox{{#1}}% \setbox2\hbox{% \pdfsave% \pdfsetmatrix{-1 0 0 1}\rlap{\copy0}\pdfrestore}% \hbox to --1\wd0{\kern--1\wd0\box2\hss}% }

\rbox{abc $\mapsto $ xyz}

Text text text, $abc\mathbin{\rbox{$\mapsto$}} xyz$, text text text.

\bye


Xetex/Luatex:

xetex

MWE

xetex

\protected\def\rbox#1{% \setbox0\hbox{{#1}}% \setbox2\hbox{% \special{pdf:literal q}% \special{pdf:literal -1 0 0 1 0 0 cm}\rlap{\copy0} \special{pdf:literal Q}}% \hbox to --1\wd0{\kern--1\wd0\box2\hss}% }

\rbox{abc $\mapsto $ xyz}

Text text text, $abc\mathbin{\rbox{ $\mapsto$}}xyz$, text text text. % note the space: >>\rbox{ $<< \bye

Cicada
  • 10,129
  • Fair enough, but the OP specifically wanted a TeX solution, not LaTeX. – Alan Munn Mar 29 '22 at 12:30
  • @AlanMunn Yes. I started doing a TeX reflect code block, but too much (3-4 days or more; beyond my resources). But the hint may spur others. It's not impossible, just long. – Cicada Mar 29 '22 at 13:22
  • @AlanMunn Found a related question. See addition to answer. – Cicada Mar 30 '22 at 03:45