[OS X TeX] A \url problem
Vic Norton
vic at norton.name
Sun Nov 1 22:34:54 EST 2009
Here is my complete preamble, Ross. Hope this helps. - Vic
%%!TEX encoding = UTF-8 Unicode
\documentclass[12pt, letterpaper]{article}
% we have to change the font encoding for Lucida.
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % to get the right copyright, etc.
\usepackage{amsmath,amssymb} % Better math support & more symbols
\usepackage{amsthm}
\usepackage{bm} % for boldfaced Greek
\usepackage{dsfont} % Mathematical doublestroke, e.g. $\mathds{R}$
% use Lucida fonts for both text and math.
\usepackage[altbullet]{lucidabr} % get larger bullet
\DeclareEncodingSubset{TS1}{hlh}{1} % including \oldstylenums
\usepackage{textcomp} % for special text symbols
\usepackage{verbatim} % for comment environment
\theoremstyle{remark}
\newtheorem*{rmk}{Remark}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\newtheorem{propn}{Proposition}
\usepackage[pdftex]{graphicx}
\usepackage{geometry}
\geometry{letterpaper, nohead,
hmargin={1.25in, 1.25in}, vmargin={1.15in, 1.15in},
footskip=0.75in
}
\usepackage{float}
\usepackage{url}
\usepackage{natbib}
\bibliographystyle{myplainnat}
\bibpunct{[}{]}{,}{a}{}{,}
\usepackage[parfill]{parskip} % Activate to begin paragraphs with
an empty line
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{color}
\definecolor{link}{rgb}{0.25,0.0,0.75}
\definecolor{paleyellow}{rgb}{1.0,1.0,0.6}
\usepackage{colortbl}
\usepackage{listings}
\usepackage{layout}
\usepackage[%
colorlinks=true,citecolor=blue,urlcolor=blue,linkcolor=link%
]{hyperref}
\newcommand{\heading}[1]{%
{\fontsize{18}{22}\selectfont\textbf{#1}}}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\newcommand{\tick}[1]%
{\textbf{\texttt{#1}}}
\begin{document}
On Nov 1, 2009, at 3:02 PM, Ross Moore wrote:
> Hello Vic, and others.
>
> On 02/11/2009, at 5:46 AM, Vic Norton wrote:
>
>>
>> On Nov 1, 2009, at 11:38 AM, Maarten Sneep wrote:
>>
>>> try to use \href{}{} instead. That way I don't think the url is
>>> broken, although text itself can be broken. Note that this is
>>> (breaking links across lines) is only supported with pdflatex, not
>>> tex+ghostscript.
>>
>> On Nov 1, 2009, at 11:46 AM, Claus Gerhardt wrote:
>>
>>> Try loading the hyperref package. The command below works fine for
>>> me. I am adding the files that are routinely loaded in my set up.
>>
>> Thanks for the advice, guys. Unfortunately nothing seems to work.
>
> So what packages *are* you loading?
> Is it just url.sty ?
> Or something else as well, or instead.
> Please show your complete LaTeX preamble, otherwise noone
> can reproduce the problems you are describing.
>
>> I've decided to go with
>>
>> \begin{minipage}{6.0in}
>> \url{http://vic.norton.name/finance-math/notionportf/
>> pricedistrib.csv}
>> \end{minipage}
>>
>> which doesn't split the URL and looks pretty good.
>>
>> I have noticed a curious behavior with
>>
>> \begin{minipage}{5.0in}
>> \url{http://vic.norton.name/finance-math/notionportf/
>> pricedistrib.csv}
>> \end{minipage}
>>
>> This typesets as
>>
>> http://vic.norton.name/finance-math/notionportf/
>> pricedistrib.csv
>
> Your original coding was quite problematic:
>
>> \parbox{6.0in}{\url{
>> http://vic.norton.name/finance-math/notionportf/pricedistrib.csv
>> }}
>
> since there are spurious spaces at the beginning and end:
>
> ' http://vic.norton.name/finance-math/notionportf/pricedistrib.csv '
>
> This is one way to solve the problem:
>
> \parbox{6.0in}{\url{%
> http://vic.norton.name/finance-math/notionportf/pricedistrib.csv%
> }}
>
> but is rather ugly, and may not be sufficiently flexible; as this
>
> \url{%
> http://vic.norton.name/finance-math/notionportf/pricedistrib.csv%
> }
>
> might result in one or more of the % symbols becoming part of the URL.
>
>
> A better way is to declare any long URLs within the document preamble.
> viz.
>
> \usepackage{url}
> \urldef\pricedistURL\url{http://vic.norton.name/finance-math/
> notionportf/pricedistrib.csv}
> \urldef .... other URL definitions ...
> ...
>
> \usepackage{hyperref}
>
>
> Note that hyperref must be loaded *after* uses of \urldef...\url{....}
> since it changes the definition of \url .
>
>
> Now all of the following should work properly:
>
> \url{\pricedistURL}
> \parbox{5.0in}{\url{\pricedistURL}}
> \parbox{6.0in}{\url{\pricedistURL}}
>
> \begin{minipage}{5.0in}
> \url{\pricedistURL}
> \end{minipage}
>
> etc.
>
>
>>
>> When you put the cursor over the text in the first line, you are
>> pointing at
>> http://vic.norton.name/finance-math/notionportf/
>
> Aaah, This is due to the extra space character at the beginning, which
> acts as a separator.
>
> http://vic.norton.name/finance-math/notionportf/
>
> This your \baseurl setting, right?
>
>> but, when you move the cursor just to the right of the text, you
>> start pointing at the correct URL
>> http://vic.norton.name/finance-math/notionportf/pricedistrib.csv
>
> This is what you want, but it occurs only after that initial space
> has been included as part of a URL.
>
>> Finally, when you put the cursor over the text in the second line,
>> you are again pointing at
>> http://vic.norton.name/finance-math/notionportf/pricedistrib.csv
>
>
> You have to be very careful with using \url directly,
> since it adjusts the \catcode of many characters.
> But this cannot happen when the {\url{....}} is within
> the argument of other commands.
> The inconsistency of results can be very confusing.
> That's why it is better to make use of \urldef ...
>
> ... or use Hyperref's \href command
> --- but this is also subject to difficulties when used
> within the argument of other commands.
>
>
>>
>>
>> Regards,
>>
>> Vic
>
>
> 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