Skip to main content
added 88 characters in body
Source Link
user108682
user108682

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \noindent \verb!\(\binding{a}{b}\)! should produce \(a{\mapsto}b\).\\ \verb!\(\binding{aa}{bb}\)! should produce \(aa\!\mapsto\!bb\).\\ \verb!\(\binding{f(a+b)}{g(c+d)}\)! should produce \(f(a+b)\mapsto g(c+d)\).\\ \verb!\(\binding{f\,a}{g\,b}\)! should produce \(f\,a\,\mapsto\,g\,b\). \verb!\(\binding{i}{(\binding{a}{b})}\)! should produce \(i\mapsto(a{\mapsto}b)\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \noindent \verb!\(\binding{a}{b}\)! should produce \(a{\mapsto}b\).\\ \verb!\(\binding{aa}{bb}\)! should produce \(aa\!\mapsto\!bb\).\\ \verb!\(\binding{f(a+b)}{g(c+d)}\)! should produce \(f(a+b)\mapsto g(c+d)\).\\ \verb!\(\binding{f\,a}{g\,b}\)! should produce \(f\,a\,\mapsto\,g\,b\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \noindent \verb!\(\binding{a}{b}\)! should produce \(a{\mapsto}b\).\\ \verb!\(\binding{aa}{bb}\)! should produce \(aa\!\mapsto\!bb\).\\ \verb!\(\binding{f(a+b)}{g(c+d)}\)! should produce \(f(a+b)\mapsto g(c+d)\).\\ \verb!\(\binding{f\,a}{g\,b}\)! should produce \(f\,a\,\mapsto\,g\,b\). \verb!\(\binding{i}{(\binding{a}{b})}\)! should produce \(i\mapsto(a{\mapsto}b)\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

edited tags
Link
cfr
  • 248.3k
  • 17
  • 313
  • 634
edited title; edited body
Source Link
user108682
user108682

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \noindent \verb!\(\binding{a}{b}\)! should produce \(a{\mapsto}b\).\\ \verb!\(\binding{aa}{bb}\)! should produce \(aa\!\mapsto\!bb\).\\ \verb!\(\binding{f(a+b)}{g(c+d)}\)! should produce \(f(a+b)\mapsto g(c+d)\).\\ \verb!\(\binding{a\f\,a}{b\g\,b}\)! should produce \(a\f\,a\,\mapsto\,b\g\,b\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \(\binding{a}{b}\) should produce \(a{\mapsto}b\).\\ \(\binding{aa}{bb}\) should produce \(aa\!\mapsto\!bb\).\\ \(\binding{f(a+b)}{g(c+d)}\) should produce \(f(a+b)\mapsto g(c+d)\).\\ \(\binding{a\,a}{b\,b}\) should produce \(a\,a\,\mapsto\,b\,b\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

I'd like to automatically determine the whitespace inside the arguments of a binary operator and provide appropriate spacing around the operator automatically. Example:

\documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\binding}{mm}{#1\!\mapsto\!#2} \ExplSyntaxOff \begin{document} \noindent \verb!\(\binding{a}{b}\)! should produce \(a{\mapsto}b\).\\ \verb!\(\binding{aa}{bb}\)! should produce \(aa\!\mapsto\!bb\).\\ \verb!\(\binding{f(a+b)}{g(c+d)}\)! should produce \(f(a+b)\mapsto g(c+d)\).\\ \verb!\(\binding{f\,a}{g\,b}\)! should produce \(f\,a\,\mapsto\,g\,b\). \end{document} 

How to do that in latex3? As a start, I would be happy just to distinguish between the first two kinds of inputs, i.e., to test whether the two arguments are at most one symbol long. As a maximum capability, I'd like to ensure that the whitespace before/after \mapsto is slightly larger than the largest whitespace in any of the two arguments.

edited title
Link
user108682
user108682
Loading
added 25 characters in body
Source Link
user108682
user108682
Loading
Source Link
user108682
user108682
Loading