I want to use TikZ to create new versions of the standard LaTeX math symbol \to and macro \mapsto to use for math mapping notation and, in the case of \to, to use for math convergence notation.
And I want the arrow tip style and shaft thickness to harmonize with arrows used in tikzcd diagrams.
For the Lucida Bright math font I'm using, I find the arrow tips too small on both — because the arrow tip on \rightarrow is so small — and the bar on \mapsto is also too small.
Questions:
- How do I make the terminal
Stealtharrow tip larger for\newmapsto, so that it is the same size as the terminalStealtharrow tip for\newto? - Does the result of the code shown below create a pleasing and harmonious design of these symbols? Any suggestions for improving either the result or the code?em
Caution: Although the code shows the lucidabr package, I'm actually instead using the proprietary lucimatx package, with its lucidasmallscale option that enables "nonlinear" scaling, with 10pt font sizes scaled by 90%, with < 10pt sizes scaled upwards (up to 0.95% at < 5pt) and with > 10pt sizes scaled downwards (down to 0.85 pt at >= 22.5pt). (This is to compensate for the relatively large x-height of the Lucida fonts.) The image from the pdf output that's shown below uses \lucimatx with that scaling.
\documentclass[10pt]{article}
\usepackage[left=2in,right=0.75in]{geometry}
%% FOLLOWING LINE USED TO PRODUCE IMAGE SHOWN FOR THE OUTPUT
%\usepackage[lucidasmallscale=true]{lucimatx}
\usepackage{lucidabr}
\linespread{1.04}
\usepackage{amsmath}
\newcommand{\N}{\mathbb{N}}
\newcommand{\from}{\protect\colon}
\let\oldto\to
\let\oldmapsto\mapsto
\newcommand*{\oldtendsto}{\mathrel{\rightarrow}}
\usepackage{scalerel}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta}
\tikzcdset{every arrow/.append style = -{Stealth[scale=1]}}
\tikzcdset{arrows={line width=0.4pt}}
\let\oldrightarrow\rightarrow
\newcommand{\newrightarrow}{\mathrel{\tikz[baseline]\draw[arrows=-{Stealth[scale=1]},yshift=0.75ex] (0,0) -- (1.4em,0);}}
\newcommand{\newto}{\mathrel{\scalerel*{\newrightarrow}{\oldrightarrow}}}
\newcommand{\newbarredrightarrow}{\mathrel{\tikz[baseline]\draw[arrows={Bar[line width=1.125pt,scale=1.667]}-{Stealth[scale=1.44]},yshift=0.75ex] (0,0) -- (1.95em,0);}}
\newcommand{\newmapsto}{\mathrel{\scalerel*{\newbarredrightarrow}{\oldrightarrow}}}
% command \test based upon the one used by Ruixi Zhang in answer at
% https://tex.stackexchange.com/questions/443614/what-length-arrow-for-converges-to/443623#443623
\newcommand*{\test}[3]{% params; tendsto, to, mapsto
\makebox[7em][r]{\texttt{\textbackslash#1}, \texttt{\textbackslash#2} and \texttt{\textbackslash#3}}:\\[6pt]
Let $(x_n)_{n \in \N} \csname#1\endcsname x$ in~$X$ where $f \from X \csname#2\endcsname Y$ and $x \csname#3\endcsname y$;
that is, \[\lim_{n \csname#1\endcsname \infty} x_n = x \quad \text{where $\quad f \from X \csname#2\endcsname Y$ and $x \csname#3\endcsname y$}.\]}
\begin{document}
\noindent%
\test{oldtendsto}{oldto}{oldmapsto}% original
\test{newto}{newto}{newmapsto}
\[
\begin{tikzcd}
& Y \arrow{dr}{g} & \\
X \arrow{ur}{f} \arrow{rr}{h} && Z
\end{tikzcd}
\]
\[
\begin{tikzcd}
X \arrow{r}{f} \arrow[swap]{d}{h} & Y \arrow{d}{k}
\\
Z \arrow{r}{g} & W
\end{tikzcd}
\]
\end{document}
The original query
I had been looking for the actual definition of the tikz-cd the \mapsto arrow command (so that I can modify the height and thickness of the bar on its left end).
Thanks to comments from @Phelype Oleinik and @marmot, I did find the definition in texmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex. Unfortunately, with my limited knowledge of TikZ I don't find it informative (yet).


tikz-cdis located attexmf-dist/tex/generic/tikz-cd/tikzlibrarycd.code.tex– Phelype Oleinik Jul 30 '18 at 21:50\Mapstodefined in that file. – murray Jul 30 '18 at 22:18Mapsto/.code={\tikzcdset{double line}\pgfsetarrows{tikzcd implies bar-tikzcd implies}},. The perhaps simplest way to go is to define a new style like\tikzset{MyMapsto/.style={{Tee Barb[0pt]}-{Stealth[]}}}. – Jul 30 '18 at 22:19Mapstothere; I was mistakenly searching for\Mapstoin that file. But the code is not very informative to me, at least not yet. – murray Jul 30 '18 at 22:24tikz-cdis in this question (apart from loadingtikz). According to how I read your question, you are not too happy with howMapstolooks in this library, and you know how to patch arrows with thearrows.metalibrary anyway. So where doestikz-cdcome in? – Jul 30 '18 at 22:47tikz-cdis simply that I thought by looking at the code there formapsto(andMapsto), it would help me see how to design the version of the\mapstosymbol. But it did not. – murray Jul 31 '18 at 00:25\mathrelinstead of\mathbin, as clarified in your follow-up (?) question, what is it that you want to achieve. Is it that\scalerelmakes the line too thin? (Notice that TikZ understandswidth, i.e. you could simply make the arrow as long as the reference arrow without changing the line width.) – Jul 31 '18 at 02:50widthfor the line. Or did you meanline width? – murray Jul 31 '18 at 19:52width. Try e.g.\pgfmathsetmacro{\X}{width("ABC")} \typeout{\X} \pgfmathsetmacro{\X}{height("ABC")} \typeout{\X}. Of course thecalcpackage (not thecalclibrary) also offers\widthofand\heightof. – Jul 31 '18 at 19:55widthis to be used where with the\tikz[baseline]\draw[arrows...command. – murray Jul 31 '18 at 20:21\mapsto, a slightly longer and ever-so-thicker bar on the left end. The overall rescaling I'm attempting with\scalerel*is to properly scale when the arrows are used in\scriptstyle. – murray Jul 31 '18 at 20:46