Last active
May 11, 2017 03:39
-
-
Save cawka/f6b40ef10b3d9e7af6d1b7216d00a5a6 to your computer and use it in GitHub Desktop.
LaTeX: \name (for NDN name)
This file contains 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
%% \name command | |
%% - allows break before / | |
\usepackage{etoolbox} | |
\usepackage{xstring} | |
\DeclareListParser{\doslashlist}{/} | |
\newcounter{ndnNameComponentCounter}% | |
\newcommand{\name}[1]{{% | |
\setcounter{ndnNameComponentCounter}{0}% | |
\renewcommand{\do}[1]{{% | |
\ifnumgreater{\value{ndnNameComponentCounter}}{0}{\allowbreak/}{}% | |
\ifnumodd{\value{ndnNameComponentCounter}}{}{}% | |
\detokenize{##1}}% | |
\stepcounter{ndnNameComponentCounter}}% | |
``{\fontfamily{cmtt}\small\selectfont\IfBeginWith{#1}{/}{/}{}\doslashlist{#1}}''% | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment