Last active
November 27, 2016 18:40
-
-
Save lucaswerkmeister/6e482307e943e5d37c37144628987d3e to your computer and use it in GitHub Desktop.
Make ? indicate a single-letter variable in math mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage[utf8]{inputenc} | |
\DeclareUnicodeCharacter{3BB}{\lambda} % λ | |
\newcommand{\var}[1]{\mathtt{#1}} | |
\let\qm=? | |
\catcode`?=13 | |
\def?{% | |
\ifmmode% | |
\expandafter\var% | |
\else% | |
\qm% | |
\fi% | |
} | |
\begin{document} | |
In text mode, the question mark still indicates a question: | |
\begin{quotation} | |
How does this work? | |
\end{quotation} | |
In math mode, however, it indicates a single-letter variable: | |
\[(a,b) \quad\hat=\quad λ?f.~?f~a~b\] | |
\end{document} |
Author
lucaswerkmeister
commented
Nov 27, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment