[l2h] Tilde problem

Igor Peshansky pechtcha at cs.nyu.edu
Tue Jan 3 20:03:55 CET 2006


On Tue, 3 Jan 2006, Bob van der Poel wrote:

> Robin Fairbairns wrote:
>
> > > Thanks for the pointer, Les. After smacking the side of head a few times
> > > the light is slowly coming on :)
> > >
> > > Yes, a tilde is a non-breaking space. So, with
> > >
> > > \newcommand{\path}[1]{\texttt{#1}}
> > >
> > > I can do something like \path{\~{}/foo} and it works just fine. But, if I
> > > use the \path{} from the url.sty file which provides some line breaking
> > > feature (?? I really have to go check why I'm using this I think ??) then
> > > "\" and "{}"s are printed verbatim. So, I guess I have to use the same
> > > macro for both latex and latex2html.
> > >
> > > Anyone have a simple solution?
> >
> > url.sty provides "sensible" breaks that are useful in long urls.
> >
> > since it postdates the invention of l2h, there's never been an
> > adequate way of dealing with it in l2h.
> >
> > if you want to have typeset urls in your documents, i would recommend
> > having latex-only and html-only sections, load url in a latex-only
> > section and do "proper" urls in that, and do the old-fashioned
> > non-breakable \texttt-style urls in the html sections.
> >
> > otoh, if you don't need anything more complicated than your ~/foo
> > things, you might as well forget url.sty altogether.
> >
> > r
>
> Thanks for this.
>
> I have just taken the easy way out and am using a macroized texttt{} to
> print my paths in the document. This now works fine in the l2h and latex
> version. Of course, I did have to fix the tildes, but that was not a big
> deal.
>
> Interesting is that I have some tildes in urls, like
> \url{http://mypage.uniserve.com/~bvdp} and the tilde in this case prints
> find in both l2h and latex versions. I'm no tex-expert, but looking at
> url.sty I was assuming that \path{} and \url{} were pretty much the
> same.

That's because latex2html handles \url internally, but doesn't know about
\path.

> Oh, one other interesting difference is that with the url version of
> \path{} I get a larger "~" centered (vertically) on the line; with
> \textt{} I get a smaller, raised "~". Why the difference?

They are different characters.  url.sty redefines ~ to be
$\scriptstyle\sim$ (somewhat raised).  With \~{} in \texttt, you get the
tilde accent character.  You can define a \Tilde command as it's done in
url.sty (search for \UrlTildeSpecial), and use that in \texttt to get the
same result.

> I don't have any really long paths so my hack seems to work fine. But,
> it would be nice if url.sty worked with both versions. Maybe when you
> have absolutely nothing else to do :)

Someone will have to write a corresponding .perl implementation of url.sty
(non-trivial, since it uses lots of verbatim tricks).
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha at cs.nyu.edu | igor at watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"



More information about the latex2html mailing list