ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \hyphenatedurl and the '%' character
@ 2010-06-02 21:16 Rogutės Sparnuotos
  2010-06-03 13:36 ` URLs [Re: \hyphenatedurl and the '%' character] rogutes
  0 siblings, 1 reply; 3+ messages in thread
From: Rogutės Sparnuotos @ 2010-06-02 21:16 UTC (permalink / raw)
  To: ntg-context

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?

-- 
--  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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* URLs [Re: \hyphenatedurl and the '%' character]
  2010-06-02 21:16 \hyphenatedurl and the '%' character Rogutės Sparnuotos
@ 2010-06-03 13:36 ` rogutes
  2010-06-03 14:43   ` Otared Kavian
  0 siblings, 1 reply; 3+ messages in thread
From: rogutes @ 2010-06-03 13:36 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: URLs [Re: \hyphenatedurl and the '%' character]
  2010-06-03 13:36 ` URLs [Re: \hyphenatedurl and the '%' character] rogutes
@ 2010-06-03 14:43   ` Otared Kavian
  0 siblings, 0 replies; 3+ messages in thread
From: Otared Kavian @ 2010-06-03 14:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-03 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).