I want to write URLs, but the stylesheet cannot be used with url or hyperref packages. Then if I copy the urls from my pdf file and paste them to the browser, tilde symbols become %2(+a weird character which looks like o with something on it) and I cannot reach the websites. What should I do with this problem?
2 Answers
A primitive way of writing URLs is the \verb command:
\verb|http://example.org/~user/index.html#start| Of course, this does not create any link, package hyperref can do this. But, some PDF viewers use a heuristics to detect links in text.
Allows line breaking at /, -, _ and ~ characters (more can be added). I added sloppypar, since even this many breakpoints may stress the flushing algorithms.
\documentclass{article} \usepackage[nopar]{lipsum} %%%%%%%%%%% \newcommand\fauxurl[1]{\bgroup\ttfamily\fauxurlhelp#1\relax\relax\egroup} \def\fauxurlhelp#1#2\relax{% \ifx/#1#1\penalty0\else% \ifx-#1#1\penalty0\else% \ifx\_#1#1\penalty0\else% \ifx~#1\char"7E\penalty0\else#1% \fi\fi\fi\fi% \ifx\relax#2\relax\else\fauxurlhelp#2\relax\fi} %%%%%%%%%%% \begin{document} \begin{sloppypar} \lipsum[4] \fauxurl{% http://tex.stackexchange.com/questions/331979/is~there~a-good-way-to-write~urls-with-tilde-without-using-url-or-hyperref-packa% } \lipsum[2] \end{sloppypar} \end{document} 
%7eis nothing but ascii tilde... On my browser it automatically becomes~%7eis the precent encodnig ( en.wikipedia.org/wiki/Percent-encoding ) of~. However, does this question help you or answer your problem? tex.stackexchange.com/questions/10858/url-with-tilde-characterurldoes is define\urland appropriate mechanisms to print URLs, so there's no obvious need for an alternative!urlconflicts with other packages. What's the problem?urlis not usable.