ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: h h extern <pragma@wxs.nl>
Subject: Re: algorithms style : need \starttyping with TeX and math feature
Date: Sun, 26 Dec 2004 21:57:14 +0100	[thread overview]
Message-ID: <41CF25AA.8040604@wxs.nl> (raw)
In-Reply-To: <200412251403.10518.john@wexfordpress.com>

Christmas present ...

\unprotect

\setuplines[\c!space=\v!default]

\def\startlines
   {\@@rgbefore
    \whitespace
   %\page[\v!preference]} gaat mis na koppen, nieuw: later \nobreak
    \begingroup
    \def\@@rgstepyes{\parindent\zeropoint}%
    \def\@@rgstepno {\parindent\zeropoint}%
    \edef\@@rgparindent{\the\parindent}%
    \globallet\@@rglinesteptoggle\!!plusone
    \processaction
      [\@@rgindenting]
      [  \v!yes=>\def\@@rgstepyes{\parindent\@@rgparindent}%
                 \def\@@rgstepno {\parindent\@@rgparindent},
         \v!odd=>\def\@@rgstepyes{\parindent\zeropoint    }%
                 \def\@@rgstepno {\parindent\@@rgparindent},
        \v!even=>\def\@@rgstepno {\parindent\zeropoint    }%
                 \def\@@rgstepyes{\parindent\@@rgparindent}]%
    \typesettinglinestrue
    \setupwhitespace[\v!none]%
    \obeylines
    \let\checkindentation\relax
    \@@rgstepno
    \ignorespaces
    \gdef\afterfirstobeyedline % tzt two pass, net als opsomming
      {\gdef\afterfirstobeyedline
         {\nobreak
          \global\let\afterfirstobeyedline\relax}}%
    \def\obeyedline
      {\par
       \let\checkindentation\relax % else problems with odd/even
       \afterfirstobeyedline
       \ifdim\lastskip>\zeropoint
         \globallet\@@rglinesteptoggle\!!zerocount
       \else
         \doglobal\increment\@@rglinesteptoggle
       \fi
       \ifodd\@@rglinesteptoggle\relax
         \@@rgstepyes
       \else
         \@@rgstepno
       \fi
       \futurelet\next\dobetweenthelines}%
\processaction
   [\@@rgspace]
   [ \v!on=>\obeyspaces
            \def\obeyedspace
              {\mathortext\normalspace{\dontleavehmode{\tt\controlspace}}},
    \v!yes=>\obeyspaces
            \def\obeyedspace
              {\mathortext\normalspace{\dontleavehmode\normalspace}}]%
    \GotoPar}

\protect

\starttext

\startlines
test
   test
     test $a = 10$
\stoplines

\setuplines[space=on]
\startlines
test
   test
     test $a = 10$
\stoplines

\setuplines[space=yes]
\startlines
test
   test
     test $a = 10$
\stoplines

test
   test
     test $a = 10$

\stoptext



======

John Culleton wrote:
> On Friday 24 December 2004 09:23, Mojca Miklavec wrote:
> 
>>Maurice Diamantini wrote:
>> > Well I agree that it's no more "typing" any more!
>> > So a special option for \setuplines would be more appropriate?
>>
>>Exactly, \starttyping does exactly that what you don't want: it disables
>>math and expansion of TeX commands.
>>
>>
>>>Also, perhaps my request is simply an option of \startlines
>>>which keep not only the lines break, but also the first
>>>spaces of each line (in a verbatim font fors these space)
>>
>>In plain TeX you have a command \obeyspaces (apart from \obeylines).
>>Nevertheless, whitespaces at the beginning of line are ignored when
>>using \obeyspaces, so you additionally need to write an escaped
>>whitespace '\ ' or \strut at the beginning of line (I guess there's a
>>more efficient solution for that, but I'm no expert).
>>
>>But if you really only need whitespace at the beginning of line,
>>probably make something like:
>>     \def\tab{\strut\hbox to 3em{}} % or any other size instead 3em
>>instead of using \obeyspaces and simply put \tab where you need a
>>certain amount of white space.
>>
>>Mojca
>>
> 
> Using eplain.tex you can say:
> \verbatim
> 
> |endverbatim
> (note bar instead of backslash.)
> 
> If you need a vertical bar in the verbatim text then just double it. 
> 
> Anything in between including blank spaces and lines is printed verbatim.
> Context used to complain about one non-critical statement in the eplain file.  
> Actually it complains about the following statement but you can easily spot 
> the troublemaker. Delete it and eplain works fine with Context.  Latest 
> versions of eplain may already have the fix, haven't tested them.  
> 


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2004-12-26 20:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24  8:07 Maurice Diamantini
2004-12-24  8:48 ` Maurice Diamantini
2004-12-24 14:23 ` Mojca Miklavec
2004-12-25 19:03   ` John Culleton
2004-12-26 20:57     ` h h extern [this message]
2005-01-03 15:13       ` Maurice Diamantini
2005-01-03 17:02         ` Hans Hagen
2005-01-03 14:52     ` Maurice Diamantini

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=41CF25AA.8040604@wxs.nl \
    --to=pragma@wxs.nl \
    --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).