Trouble with percent character in ConTeXt text (programm code typing)
Hello all... I am converting any manual from HTML to ConTeXt. There are a lot of programm code. and in the code is very often % character. Ther is no problem in \startyping - \stoptyping environment, but I need using this in text ... for example The sequence \type{%0} stands for the whole match. The sequence \type{%%} stands for a single~\type{%}. or For instance, the call \type{string.format('%q', 'a string with "quotes" and \n new line')} will produce the string: ... etc.. 1. It is clear that this can not work, but is there any satisfactory solution?? Something like \startypingintext ... \stoptypingintext i.e. intext typing environment.. 2. in html code is often emphasis found inside the program code for example: <code>\<em>ddd</em></code>, Maybe it's a dumb question, but may be inside emphasis inside verbatim (\startyping - \stoptyping) environment?? Thanx Jaroslav
Am 24.08.10 15:53, schrieb Jaroslav Hajtmar:
Hello all...
I am converting any manual from HTML to ConTeXt. There are a lot of programm code. and in the code is very often % character. Ther is no problem in \startyping - \stoptyping environment, but I need using this in text ... for example
The sequence \type{%0} stands for the whole match. The sequence \type{%%} stands for a single~\type{%}. or For instance, the call \type{string.format('%q', 'a string with "quotes" and \n new line')} will produce the string: ... etc..
1.
It is clear that this can not work, but is there any satisfactory solution?? Something like \startypingintext ... \stoptypingintext i.e. intext typing environment..
What prevents you from testting this yourself, \type{%} produce a '%' in the text.
2. in html code is often emphasis found inside the program code for example: <code>\<em>ddd</em></code>,
Maybe it's a dumb question, but may be inside emphasis inside verbatim (\startyping - \stoptyping) environment??
Yes, it's possible to use style commands in verbatim mode but the mechanism in MkII and MkIV are different and it's important to know which system you use. Wolfgang
Very sorry ... I compiled (it be set for simplify work :-( ) main project, not my minimal example... I found error in code on the same row.. after several hours is difficult for me to look for errors Thank you to help and sorry... Jaroslav Dne 24.8.2010 16:15, Wolfgang Schuster napsal(a):
Am 24.08.10 15:53, schrieb Jaroslav Hajtmar:
Hello all...
I am converting any manual from HTML to ConTeXt. There are a lot of programm code. and in the code is very often % character. Ther is no problem in \startyping - \stoptyping environment, but I need using this in text ... for example
The sequence \type{%0} stands for the whole match. The sequence \type{%%} stands for a single~\type{%}. or For instance, the call \type{string.format('%q', 'a string with "quotes" and \n new line')} will produce the string: ... etc..
1.
It is clear that this can not work, but is there any satisfactory solution?? Something like \startypingintext ... \stoptypingintext i.e. intext typing environment..
What prevents you from testting this yourself, \type{%} produce a '%' in the text.
2. in html code is often emphasis found inside the program code for example: <code>\<em>ddd</em></code>,
Maybe it's a dumb question, but may be inside emphasis inside verbatim (\startyping - \stoptyping) environment??
Yes, it's possible to use style commands in verbatim mode but the mechanism in MkII and MkIV are different and it's important to know which system you use.
Wolfgang
Hello, all Why is a problem with character # inside TABLE?? \type{#XXX} is without problem but inside TABLE is a problem with compilation It works: \bTABLE \bTR \bTD \type{\#patt}\eTD \eTR \eTABLE Isnt works: \bTABLE \bTR \bTD \type{#patt}\eTD \eTR \eTABLE Is there solving the problem?? Jaroslav Dne 24.8.2010 16:15, Wolfgang Schuster napsal(a):
Am 24.08.10 15:53, schrieb Jaroslav Hajtmar:
Hello all...
I am converting any manual from HTML to ConTeXt. There are a lot of programm code. and in the code is very often % character. Ther is no problem in \startyping - \stoptyping environment, but I need using this in text ... for example
The sequence \type{%0} stands for the whole match. The sequence \type{%%} stands for a single~\type{%}. or For instance, the call \type{string.format('%q', 'a string with "quotes" and \n new line')} will produce the string: ... etc..
1.
It is clear that this can not work, but is there any satisfactory solution?? Something like \startypingintext ... \stoptypingintext i.e. intext typing environment..
What prevents you from testting this yourself, \type{%} produce a '%' in the text.
2. in html code is often emphasis found inside the program code for example: <code>\<em>ddd</em></code>,
Maybe it's a dumb question, but may be inside emphasis inside verbatim (\startyping - \stoptyping) environment??
Yes, it's possible to use style commands in verbatim mode but the mechanism in MkII and MkIV are different and it's important to know which system you use.
Wolfgang
On 25-8-2010 9:27, Jaroslav Hajtmar wrote:
Hello, all
Why is a problem with character # inside TABLE?? \type{#XXX} is without problem but inside TABLE is a problem with compilation
It works: \bTABLE \bTR \bTD \type{\#patt}\eTD \eTR \eTABLE
Isnt works: \bTABLE \bTR \bTD \type{#patt}\eTD \eTR \eTABLE
Is there solving the problem??
the next version will have \asciimode which will make all those chars regular characters (apart from % \ { }) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Ok. Thanx Hans. I solve it with \#\type{patt} it look like as have it and therefore isnt problem. BUT now I have problem with \starttyping - \stoptyping environment too. here is example: This works OK... \starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end}) \stoptyping But when I add last row, then stop work and get error message: \starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end}) print(c:match'[==[]]===]]]]==]===[]') --> 17 \stoptyping Message error surprised me: systems : begin file lpeg.tex at line 32 ! LuaTeX error <main ctx instance>:7: ')' expected (to close '(' at line 1) near ']'. \dododowithbuffer ...!!bs \detokenize {#1}\!!es )} \dododowithbuffer \nododo... l.46 \stoptyping What system controlling inside \starttyping \ stoptyping environment? Thanx Jaroslav Dne 25.8.2010 11:46, Hans Hagen napsal(a):
On 25-8-2010 9:27, Jaroslav Hajtmar wrote:
Hello, all
Why is a problem with character # inside TABLE?? \type{#XXX} is without problem but inside TABLE is a problem with compilation
It works: \bTABLE \bTR \bTD \type{\#patt}\eTD \eTR \eTABLE
Isnt works: \bTABLE \bTR \bTD \type{#patt}\eTD \eTR \eTABLE
Is there solving the problem??
the next version will have \asciimode which will make all those chars regular characters (apart from % \ { })
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 25-8-2010 12:07, Jaroslav Hajtmar wrote:
Ok. Thanx Hans. I solve it with \#\type{patt} it look like as have it and therefore isnt problem.
BUT now I have problem with \starttyping - \stoptyping environment too.
here is example:
This works OK...
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end})
\stoptyping
But when I add last row, then stop work and get error message:
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end})
print(c:match'[==[]]===]]]]==]===[]') --> 17 \stoptyping
Message error surprised me:
mkiv happens to use === itself so either change your example to use 4 ='s or adapt this: \unprotect \def\!!bs{[=====[} \def\!!es{]=====]} \protect (i might even move to == instead of === as it's saves tokens) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Thanx Hans, I did not think that inside \starttyping -- \stoptyping environment ConTeXt could do such a check this thing. Thanks so much. Health Jaroslav Dne 25.8.2010 13:34, Hans Hagen napsal(a):
On 25-8-2010 12:07, Jaroslav Hajtmar wrote:
Ok. Thanx Hans. I solve it with \#\type{patt} it look like as have it and therefore isnt problem.
BUT now I have problem with \starttyping - \stoptyping environment too.
here is example:
This works OK...
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end})
\stoptyping
But when I add last row, then stop work and get error message:
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ]], {void = function () return true end})
print(c:match'[==[]]===]]]]==]===[]') --> 17 \stoptyping
Message error surprised me:
mkiv happens to use === itself so either change your example to use 4 ='s or adapt this:
\unprotect \def\!!bs{[=====[} \def\!!es{]=====]} \protect
(i might even move to == instead of === as it's saves tokens)
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 25-8-2010 8:49, Jaroslav Hajtmar wrote:
Thanx Hans,
I did not think that inside \starttyping -- \stoptyping environment ConTeXt could do such a check this thing.
Well, the captured content is passed to the lua end using long strings so nothing is processed at that stage. Of course I could parse for embedded long strings but that a bit over the top I think. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Wed, 25 Aug 2010, Hans Hagen wrote:
On 25-8-2010 12:07, Jaroslav Hajtmar wrote:
Ok. Thanx Hans. I solve it with \#\type{patt} it look like as have it and therefore isnt problem.
BUT now I have problem with \starttyping - \stoptyping environment too.
here is example:
This works OK...
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ] ] , {void = function () return true end})
\stoptyping
But when I add last row, then stop work and get error message:
\starttyping c = re.compile([[ longstring <- ('[' {:eq: '='* :} '[' <close>) => void close <- ']' =eq ']' / . <close> ] ] , {void = function () return true end})
print(c:match'[==[]]===]]]]==]===[]') --> 17 \stoptyping
Message error surprised me:
mkiv happens to use === itself so either change your example to use 4 ='s or adapt this:
\unprotect \def\!!bs{[=====[} \def\!!es{]=====]} \protect
(i might even move to == instead of === as it's saves tokens)
Is there a more robust way to do this? Perhaps making the number of equal signs user configurable? Aditya
On 25-8-2010 8:59, Aditya Mahajan wrote:
Is there a more robust way to do this? Perhaps making the number of equal signs user configurable?
redefining \!!bs and \!!es is ok as they will not disappear after all, how often does one use [===[ and ]===] in lua code (in a non symmetrical way). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Wed, Aug 25 2010, Hans Hagen wrote:
the next version will have \asciimode which will make all those chars regular characters (apart from % \ { })
Why not "%"? Peter -- Contact information: http://pmrb.free.fr/contact/
On 25-8-2010 12:42, Peter Münster wrote:
On Wed, Aug 25 2010, Hans Hagen wrote:
the next version will have \asciimode which will make all those chars regular characters (apart from % \ { })
Why not "%"?
debatable but it's a comment things like this can be discussed extensively at the upcoming context meeting Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
Jaroslav Hajtmar
-
Peter Münster
-
Wolfgang Schuster