textbackslash is an encoding dependent command and the default OT1 encoding does not have a backslash so it defaults to $backslash$ in that case (which is typically thinner). The cmtt font is designed for verbatim and despite being notionally classed as OT1 encoded in LaTeX it includes most ascii characters in their standard positions. So with url package url and path the cmtt is used so you get the heavier matching the width of the other characters.

You should avoid OT1 encoding anyway and if you add

usepackage[T1]

then T1 encoding is used and textbackslash will not use the math mode fallback.

xurl for reasons I don’t immediately see at present as it is a very thin wrapper around url makes the math mode fallback get used in the url cases as well. (I may edit this answer later….)

Using luatex and url is similar to using T1 encoding, the encoding in this case is TU (Unicode) and textbackslash simply uses the backslash from the current font so you get the latin modern tt font in all three cases.

and again xurl is forcing math mode interpretation of as above so even in luatex you are getting the cmsy math mode backslash.

the will use math mode using the original url package if one setting of xurl is copied:

documentclass %usepackage usepackage makeatletter defUrlBreaks{% do/% doadobdocdoddoedofdogdohdoidojdokdol% domdondoodopdoqdordosdotdoudovdowdoxdoydoz% doAdoBdoCdoDdoEdoFdoGdoHdoIdoJdoKdoL% doMdoNdoOdoPdoQdoRdoSdoTdoUdoVdoWdoXdoYdoZ% do*do-do~do’do”do-% do0do1do2do3do4do5do6do7do8do9do=do/do.do:% } % %usepackage[T1] begin showoutput path (path)\ url (url)\ texttt (texttt) end

Oh it is a bug in xurl it removes \from all the lists

This gives the tt backslash with xurl

documentclass usepackage expandafterdefexpandafterUrlBreaksexpandafter{UrlBreaksdo\}% %usepackage[T1] begin showoutput path (path)\ url (url)\ texttt (texttt) end

Source

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Comment moderation is enabled. Your comment may take some time to appear.