Skip to content

Instantly share code, notes, and snippets.

@michaelgruenewald
Created January 9, 2012 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaelgruenewald/1584374 to your computer and use it in GitHub Desktop.
Save michaelgruenewald/1584374 to your computer and use it in GitHub Desktop.
LaTeX emphasize shortcut
% Use /important/ for emphasized text and // for a single slash.
\makeatletter
\newtoggle{inSlashEmph}
\togglefalse{inSlashEmph}
\let\emphslash=/
\catcode`\/=\active
\protected\def/{%
\@ifnextchar/{\emphslash\@gobble}{%
\iftoggle{inSlashEmph}{%
\global\togglefalse{inSlashEmph}%
\egroup\xspace%
}{%
\global\toggletrue{inSlashEmph}%
\bgroup\em%
}%
}%
}
%\protected\def/{\@ifnextchar/{\emphslash\@gobble}{\startStopEmph}}
\makeatother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment