Text FormattingLong URL will not line-break at hyphen

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Long URL will not line-break at hyphen

Post by ptrcao »

I have a long URL wrapping problem, despite invoking all the relevant packages normally used to remedy this. URLs elsewhere wrap fine, just this one doesn't:
url-wrapping-problem.gif
url-wrapping-problem.gif (33.13 KiB) Viewed 8752 times

Code: Select all

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{verbatim} %for commenting
\usepackage[hyphens]{url}
\usepackage{xcolor}
\usepackage[urlbordercolor=blue]{hyperref}
\usepackage{breakurl}
\title{SRS}
\author{XXX}
\begin{document}
...


Non-standalone exemplars used in environments other than forums include:

\begin{enumerate}
\item Microsoft Word Equation Editor (Proprietary).  \url{http://en.wikipedia.org/wiki/Microsoft_Equation_Editor}
\item GoogleDocs is equipped with their own version of equation editor, but in the manner discussed above preview and insert are separate.  See \url{http://googlesystem.blogspot.com/2009/09/google-docs-has-equation-editor.html}.
\end{enumerate}

The proprietary Mathematica has been suggested as relevant, but based on my limited experience of it, I am not aware that it includes an equation editor per se.\\
Can you clever cookies help me troubleshoot this?

I'm aware that the order in which the packets are invoked matter (apparently because of overriding and conflicts), and I've tried the shuffle them around but I get "option conflict" errors for any other order I've tried so far, though I can't say I've exhaustively tried every order.
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Long URL will not line-break at hyphen

Post by shadgrind »

The breakurl package only works when using the latex->dvi->ps->pdf method; it has no effect when using pdflatex. The problem appears to be with using a fixed-width font for the URLs, which is the default. When I used pdflatex with the url package and put

Code: Select all

\urlstyle{rm}
in the preamble so that the roman-style font is used, it split your long URL properly:
urlwrap.png
urlwrap.png (29.71 KiB) Viewed 8736 times
This didn't work with plain latex. If using plain latex, you'll need to use the breakurl package with the [hyphenbreaks] option. It sucks if you want to use a fixed-width font, but that's the only solution I could find.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Long URL will not line-break at hyphen

Post by ptrcao »

The problem appears to be with using a fixed-width font for the URLs.
Can you please explain why using a fixed-width font for URLs causes this problem?

Also, I'm...not sure if it's me but it still occurs elsewhere even in rm url style:
dragmath.gif
dragmath.gif (45.65 KiB) Viewed 8732 times
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Long URL will not line-break at hyphen

Post by shadgrind »

ptrcao wrote:Can you please explain why using a fixed-width font for URLs causes this problem?
No, I can't.
I suppose you could contact the author of the url package.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
ptrcao
Posts: 88
Joined: Sun Dec 05, 2010 3:26 am

Long URL will not line-break at hyphen

Post by ptrcao »

I see, so there's nothing to be done for this persisting instance either?:
dragmath.gif
dragmath.gif (45.65 KiB) Viewed 8723 times
OS info: Win XP | Debian 6.0 | Ubuntu 10.04
Latex editor of choice: TexWorks (for dual view feature)
Post Reply