ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: URLs [Re: \hyphenatedurl and the '%' character]
Date: Thu, 3 Jun 2010 16:43:05 +0200	[thread overview]
Message-ID: <8F1290A9-1FF2-4616-8FB7-B37BC4894D81@gmail.com> (raw)
In-Reply-To: <20100603133641.GA29047@urvas>

Hi Rogutés,

I found two examples in my archives: plesae see below.
I hope this will help…
Best regards: OK

%%%%%%%%%%%%%%%%%%%%%%%%%%%
First one: from an answer by Hans to Mojca:
%Mojca Miklavec wrote:

%hack hack hack hack ....

%I tried solutions with special patterns sveral times but the problem is 
%in mixed languages, i.e. english text mixed with url-language; there are 
%some limitations (in pdftex for instance the same codes are used fo rthe 
%whole par (i.e. mixed languages are possible but with the same lccodes 
%etc). Also, one needs to get rid of the -

%Anyhow, there is another trick, one that Aditya might love ...
\setupinteraction[state=start]

\bgroup

\gdef\lettercolon{:}

\catcode`\:=\active
\catcode`\^=\active
\catcode`\/=\active
\catcode`\~=\active

\gdef\ForMojcaWhoLikesHacks#1%
  {\dontleavehmode
   \begingroup
   \mathcode`\:="8000
   \mathcode`\^="8000
   \mathcode`\/="8000
   \mathcode`\~="8000
   \def:{\nobreak   \hbox{\lettercolon}\allowbreak}%
   \def^{\allowbreak\hbox{\letterhat  }\nobreak}%
   \def/{\nobreak   \hbox{\letterslash}\allowbreak}%
   \def~{\allowbreak\hbox{\lettertilde}\nobreak}%
   \everymath\emptytoks
   \mathsurround\zeropoint$\tttf#1$%
   \endgroup}
\egroup
\starttext 
\input ward
\start
\hsize 1mm \ForMojcaWhoLikesHacks{http://www.sil.org/silesr/hans.html/hagen.html/hyphenate}
\stop
Hans
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%
Second one: from a thread about bibliographies. I must aplogize, I haven't written the names of people who gave this solution…
\setupcolors [state=start,textcolor=black] 
	\setupcolor[rgb]

\setupinteraction[state=start,color=blue,style=rm]

%Bibliography Format
\definehead[BibTitle][subject]
\setupsectionblock[BibTitle][number=no,page=right]
\setuphead[BibTitle][style={sc}, after={\blank}]

\def\hangover{\hangafter=1\hangindent=1.5pc\raggedright}
\definestartstop[bibliography][
  before={
    \page[no]
    \indenting[never]
    \startalignment[left]
    \BibTitle{bibliography}
    \stopalignment
    \bgroup\appendtoks\hangover\to\everypar
    },
  after={
    \egroup
    \indenting[yes]}]

\def\bibentryrule{\noindent\vrule height0.4pt width44pt depth0pt\thinspace}

\useURL
[CampbellinLICSa]
[{http://www.leeds.ac.uk/classics/lics/2002/200203.pdf}]
[]
[{\hyphenatedurl{http://www.leeds.ac.uk/classics/lics/2002/200203.pdf}}]
\useURL
[CampbellinLICSb]
[{http://www.leeds.ac.uk/classics/lics/discussion/2002dp1.pdf}]
[]
[{\hyphenatedurl{http://www.leeds.ac.uk/classics/lics/discussion/2002dp1.pdf}}]

\starttext
\input knuth

The following is a test of URL wrapping \from[CampbellinLICSa]

\startbibliography
Blickman, D.\ R.\ 1989.\ \quote{Lucretius, Epicurus and Prehistory}.\ {\em Harvard Studies in Classical Philology} 92:157||191. 

Campbell, G. 2002a. \quote{Lucretius 5.1011||27: The Origins of Justice and the Prisoner's 
Dilemma}.\ {\em Leeds International Classical Studies} 1.3:1||12 (\from[CampbellinLICSa]). 

\bibentryrule 2002b. \quote{Lucretius and the Memes of Prehistory}.\ Discussion Paper 1, November 2002.\ {\em Leeds International Classical Studies} \from[CampbellinLICSb]. 


\stopbibliography
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%% 

On 3 juin 2010, at 15:36, rogutes@googlemail.com wrote:

> Rogutės Sparnuotos (2010-06-03 00:16):
>> Hello,
>> 
>> I defined
>> 
>>  \def\url[#1]{\hyphenatedurl{#1}}
>> 
>> for URLs, because I find 
>> 
>>  \useURL[][]
>>  \from[]
>> 
>> inconvenient (there are ~30 URLs in my document and all of them unique).
>> But \hyphenatedurl doesn't work with '%' (and '\%' gets printed
>> literally). I'll just use \useURL as a workaround, but shouldn't
>> \hyphenatedurl work as well?
> 
> 1. Is anyone hyphenating URLs by hand? How? Is this ok?
>   {\tt http://wiki.contextgarden.net/\crlf{}Article_Abstracts}
> 
>   Perhaps someone has done a macro like
>   \urlparts{http://}{wiki.}{contextgarden}{.net}{Article_}{Abstract}?
> 
>   What about active URLs (\crlf doesn't work in \goto with MkII)?
> 
> 2. Regarding URL hyphenation, why is an overfull line preferred over a
>   slightly underfull one?
> 
>  \starttext
>  \startframedtext[width=6.3cm]
>    \hyphenatedurl{http://wiki.contextgarden.net/Article_Abstracts}
>  \stopframedtext
>  \stoptext
> 
> 
> Some observed MkII and MkIV differences follow (still don't know if anyone
> is interested in these...):
> 
> 3. It seems that one can't redefine \url[] and still use \useURL[][],
>   \from[] with MkII (but it works with MkIV).
> 
> 4. \from[] is not hyphenated with MkII, but is hyphenated with MkIV
>   (with \setupinteraction[state=start]).
> 
> 5. \from[] is typeset in typewriter font with MkII, and in roman with MkIV
>   (without \setupinteraction[state=start]).
> 
> Example for 4., 5.:
> 
> \useURL[x][http://minimals.contextgarden.net/pragma/linux-64/texmf-linux-64/bin/]
> \starttext
> \from[x]
> \stoptext
> 
> -- 
> --  Rogutės Sparnuotos
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2010-06-03 14:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-02 21:16 \hyphenatedurl and the '%' character Rogutės Sparnuotos
2010-06-03 13:36 ` URLs [Re: \hyphenatedurl and the '%' character] rogutes
2010-06-03 14:43   ` Otared Kavian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8F1290A9-1FF2-4616-8FB7-B37BC4894D81@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).