# Line breaking for ConTeXt `\type`

[Edit: What I wanted is a clickable url, or if impossible, at least a nicely wrapped url in mono font, but the original wording is somewhat vague.] In ConTeXt, when using `\type` for verbatim text (as suggested here), how to break long lines? (In the manner which the LaTeX counterpart showed here)

For convenience, I copy the commands here.

``````color   = COLOR
command = CSNAME
compact = absolute last (all)
escape  = yes (no) TEXT PROCESSOR->TEXT
left    = COMMAND
lines   = yes (no) normal hyphenated
option  = mp lua xml parsed-xml nested tex context none NAME
right   = COMMAND
space   = on (off) normal fixed stretch
tab     = (yes) no NUMBER
``````

Is any among them responsible for the line breaking?

• It could be useful with a minimal example of what you want to break and where you suggest to break. – mickep May 4 at 19:31
• Why do you use `\type` for URLs? The LaTeX counterpart to `\type` would be `\verb` (or if you want `\lstinline`), so what's your aim? – TeXnician May 4 at 19:32
• @TeXnician Oh, I just want to input urls, with usual line wrapping, so what is the correct ConTeXt way? – Violapterin May 5 at 7:33

If you want to typeset URLs here's a simple macro that uses ConTeXt's `\hyphenatedurl` to break the URL, mono font and a Goto-Link (which will only become active when you start interaction). This might not be as comfortable as using `\type` because you have to escape the `#` character (see example) but it might be more flexible.

``````%\setupinteraction[state=start]
\define[1]\url{\goto{\mono{\hyphenatedurl{#1}}}[url(#1)]}

\starttext
\url{https://tex.stackexchange.com/questions/489204/line-breaking-for-context-type?noredirect=1\#comment1235264_489204}
\stoptext
``````

To get regular hyphenation use `lines=hyphenated`. Nevertheless, the resulting linebreaks will be really bad because of the monospaced font. To remedy this you could typeset that bit flush left.

``````\showframe
\setuptype[lines=hyphenated]
\starttext
\startalignment[flushleft]
\type{https://tex.stackexchange.com/questions/489204/line-breaking-for-context-type}
\stopalignment
\stoptext
``````

I have probably picked this up from the mail list, and I suppose that this is (one of) the intended way to typeset urls:

``````\useURL[thisquestion][https://tex.stackexchange.com/questions/489204/line-breaking-for-context-type]

\startTEXpage[width=5in,offset=0.5in]
We see in \from[thisquestion] that the url breaks by default.
\stopTEXpage
``````

The result is:

A bit more information on how to use `\useURL` is given in the wiki.

• This will also turn it into a clickable link automatically when switching `\setupinteraction[state=start]`, so this is the correct solution for typesetting URLs (+1). Unfortunately it's not really clear what is OP's intention. – Henri Menke May 6 at 4:37