[OS X TeX] A \url problem
Ross Moore
ross at ics.mq.edu.au
Wed Nov 4 00:06:23 EST 2009
Hi Victor,
On 03/11/2009, at 8:57 PM, Vic Norton wrote:
> I'm still missing something, Peter. These two code snippets
> illustrate the problem.
>
> I'd really like to indent the URL like this.\\
> \hspace*{4.0ex}
...
> hello hello hello hello hello hello hello hello
> }
> \end{minipage}
>
> The top segment doesn't work, the bottom does. (See attached PDF.)
Both links in the PDF that you supplied work just fine for me.
There is no "inaccessible directory" as the target of either link.
>
> Regards,
>
> Vic
Are you sure that you tested the correct PDF?
As for getting a nice line-break in the anchor text of a URL,
try the following, based upon your example.
>>> I'd like to put the URL below this statement, but indented a bit.
>>> Unfortunately the URL splits in an ugly way, and it no longer works
>>> properly. The top goes nowhere; only the ``cvs'' part takes you
>>> where
>>> you are supposed to go.\\
>>> \hspace*{4.0ex}{\hspace*{4.0ex}\vtop{\advance\hsize by -3.6cm
>>> \url{http://vic.norton.name/finance-math/notionportf/
>>> pricedistrib.csv}}
The point is that you are trying to do two things here:
1. have the URL split at a good place;
2. stop the URL from being formatted as part of the paragraph,
but have its own indentation after the break.
Point 2. is achieved by putting the URL inside a \vtop box.
But if you do this, you need to set the width of this box.
That is the purpose of the \advance\hsize by -3.6cm .
You may have to fiddle with the amount to achieve the correct
breaking, in any given instance.
Using \href the following should also work:
>>> Unfortunately the URL splits in an ugly way, and it no longer works
>>> properly. The top goes nowhere; only the ``cvs'' part takes you
>>> where
>>> you are supposed to go.\\
>>> \hspace*{4.0ex}\href{http://vic.norton.name/finance-math/
>>> notionportf/pricedistrib.csv}%
>>> {\ttfamily http://vic.norton.name/finance-math/notionportf/\newline
>>> \hspace*{4.0ex}pricedistrib.csv}
This doesn't use a \vtop box, but then you have to explicitly
force the indent after the break.
If either of these doesn't work for you then there must be a problem
with some part of hyperref or url.sty on your TeX installation.
I've had it working with:
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
hyperref.sty 2009/10/31 v6.79d Hypertext links for LaTeX
and with
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
hyperref.sty 2008/09/27 v6.78k Hypertext links for LaTeX
Hope this helps,
Ross
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
More information about the MacOSX-TeX
mailing list