Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape character

2007-12-09 Thread dexterclarke
 Wolfgang Schuster wrote:

 \startlines
 verbatin text
 \stoplines

Thanks! That's almost perfect.

I've noticed that space is still inserted after punctuation characters
such as '.', ':' and '!'. Is it possible to disable this as well? I've
read a little about category codes but I'm not entirely sure if that's
what I should be using (perhaps ConTeXt provides a higher level macro
for it?).

__
dc
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape character

2007-12-09 Thread Wolfgang Schuster
On Sat, 8 Dec 2007 09:28:02 -0500
[EMAIL PROTECTED] wrote:

  Wolfgang Schuster wrote:
 
  \startlines
  verbatin text
  \stoplines
 
 Thanks! That's almost perfect.
 
 I've noticed that space is still inserted after punctuation characters
 such as '.', ':' and '!'. Is it possible to disable this as well? I've
 read a little about category codes but I'm not entirely sure if that's
 what I should be using (perhaps ConTeXt provides a higher level macro
 for it?).

This is possible and I give you a very simple and dirty version below
but can you explain why do you want this, I thought you want verbatim
output and spaces after punctuation marks are part of verbatim code.

\starttext

\startlines
\catcode`!=13
\catcode`:=13
\catcode`.=13
\def.{\char`.\ignorespaces}
\def:{\char`:\ignorespaces}
\def!{\char`!\ignorespaces}
text text, text. text: text! text text
text text, text! text. text: text text
text text, text: text! text. text text
text text, text. text: text! text text
\stoplines

\stoptext

Wolfgang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread Wolfgang Schuster
2007/12/7, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 Hi.

 I'm working on a document processor that has multiple backends
 for different output formats (XHTML, nroff, plain text, ConTeXt).

 The processor uses s-expression syntax with commands such as:

   (para this is a paragraph)

 The various backends then convert this statement in their own
 way (using p/p tags in XHTML, for example).

 There is one command that allows rendering of external files
 based on whatever backend is selected:

   (render file)

 The XHTML backend includes file, escaping all 'illegal' characters
 such as , ,  etc. The ConTeXt backend reads the file and also
 escapes characters, placing their TeX equivalent in the output -
 $\}$, $\backslash$ etc. Both backends place the contents of file
 directly in the output, they don't, for example, use the object
 tags in XHTML, or any ConTeXt file inclusion directives. This is
 desirable for many reasons that are out of scope for this post...

 The problem I am having is that one may do this:

   (para-verbatim (render file))

 The para-verbatim tag is meant to preserve whitespace in the output.

 For example, this becomes:

   precontents of file/pre

 in the XHTML output. Unfortunately, I've hit a wall when it comes
 to the ConTeXt equivalent: The ConTeXt backend reads
 in file and prints it to the output, escaping all reserved TeX
 characters, as mentioned earlier, but unfortunately there doesn't
 seem to be the equivalent of:

   \preservewhitespace
   contents of file
   \stoppreservingwhitespace

 \starttyping is too heavy handed in that it also escapes characters
 rather than just preserving whitespace (they've already been escaped
 by my document processor, as mentioned earlier). What I need is a
 directive that says preserve whitespace but does not escape reserved
 TeX characters.

 Does any such thing exist in ConTeXt? Unfortunately, I'm inexperienced
 with TeX so I don't know how feasible this is.

\startlines
verbatin text
\stoplines

Wolfgang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread dexterclarke
Hi.

I'm working on a document processor that has multiple backends
for different output formats (XHTML, nroff, plain text, ConTeXt).

The processor uses s-expression syntax with commands such as:

  (para this is a paragraph)

The various backends then convert this statement in their own
way (using p/p tags in XHTML, for example).

There is one command that allows rendering of external files
based on whatever backend is selected:

  (render file)

The XHTML backend includes file, escaping all 'illegal' characters
such as , ,  etc. The ConTeXt backend reads the file and also
escapes characters, placing their TeX equivalent in the output -
$\}$, $\backslash$ etc. Both backends place the contents of file
directly in the output, they don't, for example, use the object
tags in XHTML, or any ConTeXt file inclusion directives. This is
desirable for many reasons that are out of scope for this post...

The problem I am having is that one may do this:

  (para-verbatim (render file))

The para-verbatim tag is meant to preserve whitespace in the output.

For example, this becomes:

  precontents of file/pre

in the XHTML output. Unfortunately, I've hit a wall when it comes
to the ConTeXt equivalent: The ConTeXt backend reads
in file and prints it to the output, escaping all reserved TeX
characters, as mentioned earlier, but unfortunately there doesn't
seem to be the equivalent of:

  \preservewhitespace
  contents of file
  \stoppreservingwhitespace

\starttyping is too heavy handed in that it also escapes characters
rather than just preserving whitespace (they've already been escaped
by my document processor, as mentioned earlier). What I need is a 
directive that says preserve whitespace but does not escape reserved 
TeX characters.

Does any such thing exist in ConTeXt? Unfortunately, I'm inexperienced
with TeX so I don't know how feasible this is.

--
dc
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread Aditya Mahajan
On Sat, 8 Dec 2007, Wolfgang Schuster wrote:

 2007/12/7, [EMAIL PROTECTED] [EMAIL PROTECTED]:
 Hi.

 I'm working on a document processor that has multiple backends
 for different output formats (XHTML, nroff, plain text, ConTeXt).

 The processor uses s-expression syntax with commands such as:

   (para this is a paragraph)

 The various backends then convert this statement in their own
 way (using p/p tags in XHTML, for example).

 There is one command that allows rendering of external files
 based on whatever backend is selected:

   (render file)

 The XHTML backend includes file, escaping all 'illegal' characters
 such as , ,  etc. The ConTeXt backend reads the file and also
 escapes characters, placing their TeX equivalent in the output -
 $\}$, $\backslash$ etc. Both backends place the contents of file
 directly in the output, they don't, for example, use the object
 tags in XHTML, or any ConTeXt file inclusion directives. This is
 desirable for many reasons that are out of scope for this post...

 The problem I am having is that one may do this:

   (para-verbatim (render file))

 The para-verbatim tag is meant to preserve whitespace in the output.

 For example, this becomes:

   precontents of file/pre

 in the XHTML output. Unfortunately, I've hit a wall when it comes
 to the ConTeXt equivalent: The ConTeXt backend reads
 in file and prints it to the output, escaping all reserved TeX
 characters, as mentioned earlier, but unfortunately there doesn't
 seem to be the equivalent of:

   \preservewhitespace
   contents of file
   \stoppreservingwhitespace

 \starttyping is too heavy handed in that it also escapes characters
 rather than just preserving whitespace (they've already been escaped
 by my document processor, as mentioned earlier). What I need is a
 directive that says preserve whitespace but does not escape reserved
 TeX characters.

 Does any such thing exist in ConTeXt? Unfortunately, I'm inexperienced
 with TeX so I don't know how feasible this is.

\setuplines[space=yes]

followed by

 \startlines
 verbatin text
 \stoplines

Note that everything between start-stop lines is normal tex code.

Aditya
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread Wolfgang Schuster
On Sat, 8 Dec 2007 09:44:52 -0500 (EST)
Aditya Mahajan [EMAIL PROTECTED] wrote:

 On Sat, 8 Dec 2007, Wolfgang Schuster wrote:
 
  2007/12/7, [EMAIL PROTECTED] [EMAIL PROTECTED]:
  Hi.
 
  I'm working on a document processor that has multiple backends
  for different output formats (XHTML, nroff, plain text, ConTeXt).
 
  The processor uses s-expression syntax with commands such as:
 
(para this is a paragraph)
 
  The various backends then convert this statement in their own
  way (using p/p tags in XHTML, for example).
 
  There is one command that allows rendering of external files
  based on whatever backend is selected:
 
(render file)
 
  The XHTML backend includes file, escaping all 'illegal' characters
  such as , ,  etc. The ConTeXt backend reads the file and also
  escapes characters, placing their TeX equivalent in the output -
  $\}$, $\backslash$ etc. Both backends place the contents of file
  directly in the output, they don't, for example, use the object
  tags in XHTML, or any ConTeXt file inclusion directives. This is
  desirable for many reasons that are out of scope for this post...
 
  The problem I am having is that one may do this:
 
(para-verbatim (render file))
 
  The para-verbatim tag is meant to preserve whitespace in the output.
 
  For example, this becomes:
 
precontents of file/pre
 
  in the XHTML output. Unfortunately, I've hit a wall when it comes
  to the ConTeXt equivalent: The ConTeXt backend reads
  in file and prints it to the output, escaping all reserved TeX
  characters, as mentioned earlier, but unfortunately there doesn't
  seem to be the equivalent of:
 
\preservewhitespace
contents of file
\stoppreservingwhitespace
 
  \starttyping is too heavy handed in that it also escapes characters
  rather than just preserving whitespace (they've already been escaped
  by my document processor, as mentioned earlier). What I need is a
  directive that says preserve whitespace but does not escape reserved
  TeX characters.
 
  Does any such thing exist in ConTeXt? Unfortunately, I'm inexperienced
  with TeX so I don't know how feasible this is.
 
 \setuplines[space=yes]
 
 followed by
 
  \startlines
  verbatin text
  \stoplines
 
 Note that everything between start-stop lines is normal tex code.

you mean start/stoplines need style and color keys.

 Aditya

Wolfgang
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread Aditya Mahajan
On Sat, 8 Dec 2007, Wolfgang Schuster wrote:

 On Sat, 8 Dec 2007 09:44:52 -0500 (EST)
 Aditya Mahajan [EMAIL PROTECTED] wrote:

 \startlines
 verbatin text
 \stoplines

 Note that everything between start-stop lines is normal tex code.

 you mean start/stoplines need style and color keys.

That would not be bad :) but it is not what I meant. I meant that it is 
the author's (or in the case the convertor's) responsibility to make sure 
that everything inside is valid tex code. So something like

\startlines
\undefinedmacro blah blah
\stoplines

will not work.

Aditya
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Semi-verbatim - preserve whitespace - don't escape characters

2007-12-08 Thread Wolfgang Schuster
On Sat, 8 Dec 2007 17:30:38 -0500 (EST)
Aditya Mahajan [EMAIL PROTECTED] wrote:

 On Sat, 8 Dec 2007, Wolfgang Schuster wrote:
 
  On Sat, 8 Dec 2007 09:44:52 -0500 (EST)
  Aditya Mahajan [EMAIL PROTECTED] wrote:
 
  \startlines
  verbatin text
  \stoplines
 
  Note that everything between start-stop lines is normal tex code.
 
  you mean start/stoplines need style and color keys.
 
 That would not be bad :) but it is not what I meant. I meant that it is 
 the author's (or in the case the convertor's) responsibility to make sure 
 that everything inside is valid tex code. So something like

I know but setup keys are the best way to change the layout of
environemnts and keep the document clean. Using a converter is no
answer why you should't you this mechanism and write the styyle change
in the document and not in preamble.

 \startlines
 \undefinedmacro blah blah
 \stoplines
 
 will not work.
 
 Aditya

As Dexter? already mentioned, he writes the escaped commands in the
document \undefinedmacro will end up as \tex{undefinedmacro} or
\type{\undefinedmacro} in the output file.

Wolfgang

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Semi-verbatim

2007-03-25 Thread John R. Culleton
I have a situation where I wish to import a file and have the line 
endings and the spaces honored as in \typefile. But I want any font 
changes (e.g. \it) honored as well. I tried the plain TeX commands 
\obeylines and \obeyspaces. The line endings and typeface changes 
were honored but the spaces were not.  

Is there a convenient way to do this? I can preprocess the file 
through e.g. sed to patch in \crlf and hard spaces but this seems a 
bit clumsy. 

BTW this is text in columns. The length of every line is limited to 45 
characters. 
-- 
John Culleton
Able Indexing and Typesetting
Precision typesetting (tm) at reasonable cost.
Satisfaction guaranteed. 
http://wexfordpress.com

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context