Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Created April 30, 2018 17:09
Show Gist options
  • Select an option

  • Save wtsnjp/26e6e7a764b512d64c5bf777b13b8807 to your computer and use it in GitHub Desktop.

Select an option

Save wtsnjp/26e6e7a764b512d64c5bf777b13b8807 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{textcomp}
\makeatletter
\let\orgtexttt\texttt
\edef\x@store{\the\catcode`\'}
\catcode`\'=\active
\def\texttt{%
\bgroup
\catcode`\'=\active
\x@texttt}
\def\x@texttt#1{%
\def'{\textquotesingle}%
\orgtexttt{#1}\egroup}
\catcode`\'=\x@store
\makeatother
\begin{document}
$a'$ said \texttt{'Hi'}.
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment