Skip to content

Instantly share code, notes, and snippets.

@alexras
Created September 23, 2012 01:46
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexras/3768495 to your computer and use it in GitHub Desktop.
Save alexras/3768495 to your computer and use it in GitHub Desktop.
Fix URL breaks in LaTeX
% Allow breaking at both hyphens and spaces
\usepackage[hyphens,spaces]{url}
% A sequence of BigBreaks will be treated as one break, so it will only be able to break after ://
\renewcommand{\UrlBigBreaks}{\do\:\do\/}
% (Less aggressive) Treat both / and - as breakable characters (don't know why this does something different than hyphens in the package declaration, but it does)
\renewcommand{\UrlBreaks}{\do\/\do\-}
% (More aggressive) Any letter and / are treated as breakable characters
\renewcommand{\UrlBreaks}{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment