Labelled mapsto with two vertical bars

Labelled mapsto with two vertical bars



I would like to use a labeled mapsto (specifically, xmapsto from usepackagemathtools), but with two vertical bars (as in Vdash from usepackageamsmath,amssymb).


xmapsto


usepackagemathtools


Vdash


usepackageamsmath,amssymb



I tried to adapt the answer from here, but I cannot seem to align the additional vertical line correctly (see below).



What is the correct way to do this? My goal is to have something like the last command in the figures, but with both vertical lines at the same height, and of the same length.



enter image description here


documentclass[a4paper]article

usepackage[english]babel

usepackagemathtools
usepackageamsmath
usepackageamssymb
usepackagetrimclip,adjustbox

newcommandXmapstoA[1]%
mathreltextclipbox0pt 0.40height .8width 0pt$Vdash$mkern.9muxmapsto#1


newcommandXmapstoB[1]%
mathrel
textclipbox0pt 0pt .8width 0pt$Vdash$
mkern.9mu
textadjustboxwidth=.87width,height=height$xmapsto#1$



newcommandVDashA%
mathreltextclipbox0pt 0pt .8width 0pt$Vdash$mkern.9muvDash


newcommandVDashB%
mathrel
textclipbox0pt 0pt .8width 0pt$Vdash$
mkern.9mu
textadjustboxwidth=.87width,height=height$vDash$



begindocument

beginalign*
vDash && texttextbackslash vDash\
Vdash && texttextbackslash VDash \
xmapstoabcdef && texttextbackslash xmapstoabcdef \
XmapstoAabcdef && texttextbackslash XmapstoAabcdef \
XmapstoAABCDEFG_2^2 && texttextbackslash XmapstoAABCDEFG_2textasciicircum2 \
XmapstoBabcdef && texttextbackslash XmapstoBabcdef \
XmapstoBabcdef^2 && texttextbackslash XmapstoBabcdeftextasciicircum2
endalign*



enddocument




2 Answers
2



mapsto is composed with mapstochar and rightarrow.


mapsto


mapstochar


rightarrow



Here I use mapstochar together with relbar (the middle part of extendable arrows) with some backing up.


mapstochar


relbar


documentclassarticle
usepackageamsmath,mathtools

newcommandmmapstomapstocharrelbarmathrelmkern-12mumapsto
newcommandxmmapstomapstocharrelbarmathrelmkern-12muxmapsto

begindocument

$ammapsto b$

$axmmapstobcdefg h$

enddocument



enter image description here



With the arrow bar only from the rightmost vertical line:


documentclassarticle
usepackageamsmath,mathtools,amssymb
usepackagepict2e

makeatletter
DeclareRobustCommandmmapstochar%
mathrelmkern1mumathpalettemmaps@to@charrelaxmkern0.5mu%

newcommandmmaps@to@char[2]%
vcenterhbox%
setlengthunitlengthmmaps@fd#1%
linethicknessvariable@rule#1%
beginpicture(0,1)
roundcap
Line(0,-0.175)(0,1.17)
endpicture%
%

newcommandmmaps@fd[1]%
fontdimen22
ifx#1displaystyletextfontelse
ifx#1textstyletextfontelse
ifx#1scriptstylescriptfontelse
scriptscriptfontfififi2

newcommandvariable@rule[1]%
fontdimen8
ifx#1displaystyletextfont3else
ifx#1textstyletextfont3else
ifx#1scriptstylescriptfont3else
scriptscriptfont3relax
fififi

makeatother

newcommandmmapstommapstocharmapsto
newcommandxmmapstommapstocharxmapsto

begindocument

$amapsto b$

$ammapsto b$

$axmmapstobcdefg h$

$scriptstyle ammapsto b$

enddocument



enter image description here





Awesome, this is almost exactly what I was looking for. It would be slightly better if the horizontal line would only go up to the right vertical line, instead of up to the left one (like for VDash). Is there an easy fix for this? If not, I can make due...
– Peter
Aug 21 at 16:18



VDash





@Peter Not really easy, I'm afraid: mapstochar has a small outdent but also has zero width, so some guess work is needed. Do you plan to use such symbol also in subscripts or superscripts?
– egreg
Aug 21 at 16:29



mapstochar





I don't expect to use the symbol itself in subscripts/superscripts (I will have superscripts/subscripts in the labels though). But if there is no simple solution, that is fine. Your current solution is quite nice.
– Peter
Aug 21 at 16:34





@Peter Added the required variant
– egreg
Aug 21 at 17:17



Here is a solution adapted from a code found in Mathmode (§ 38 Extensible arrows):


Mathmode


documentclassarticle
usepackagemathtools, amssymb

makeatletter
newcommandxVdasharrow[2]%
ext@arrow 0099xVdasharrowfill@#1#2
defxVdasharrowfill@%
arrowfill@vcenterhbox$Vdash$relbarrightarrow
makeatother

begindocument

[ AxVdasharrow[ textvery long sentence]textThis is a very veryB ]%

enddocument



enter image description here





This is very nice an clean. However, it does not seem to work for short texts (e.g., t), or empty texts.
– Peter
Aug 22 at 7:40


t





@Peter: I didn't think of testing this, and I have no idea why it doesn't work. However, in the case of empty texts, just add a quad as one of the arguments. If both arguments exists and are too short, you can put one of them in a makebox[1em].... I suppose this could be coded, but it would make the code much longer, and I'm not sure it's worth the effort.
– Bernard
Aug 22 at 9:00


quad


makebox[1em]...






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?