ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* starttyping
@ 2006-02-04 13:39 Hans van der Meer
  2006-02-04 14:37 ` starttyping Taco Hoekwater
  2006-02-06 11:34 ` starttyping Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Hans van der Meer @ 2006-02-04 13:39 UTC (permalink / raw)


Found something annoying with \starttyping...\stoptyping.

I wanted side by side two framed texts in verbatim, one of them one  
line longer than the other.
Of course they should align there lines.

To accomplish this I put a blank line at the end of the shortest text.
Alas, \starttyping does not honor a blank line at the end, although  
it does honors blank lines inbetween.
I am inclined to call this a bug.

Below a minimal example showing the blank line in between but not the  
one at the end.
The ContextWiki site gives the same result.

\starttext
\startframedtext[strut=no,offset=0pt]
\starttyping
before blank line

after blank line
blank line follows

\stoptyping
\stopframedtext
\stoptext

yours sincerely,
dr. H. van der Meer

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

* Re: starttyping
  2006-02-04 13:39 starttyping Hans van der Meer
@ 2006-02-04 14:37 ` Taco Hoekwater
  2006-02-06 13:53   ` starttyping Hans Hagen
  2006-02-06 11:34 ` starttyping Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2006-02-04 14:37 UTC (permalink / raw)


Hans van der Meer wrote:
> Found something annoying with \starttyping...\stoptyping.
> 
> I wanted side by side two framed texts in verbatim, one of them one  
> line longer than the other.
> Of course they should align there lines.
> 
> To accomplish this I put a blank line at the end of the shortest text.
> Alas, \starttyping does not honor a blank line at the end, although  
> it does honors blank lines inbetween.
> I am inclined to call this a bug.

I agree, but only when \obeyemptylines is in effect (i have documents
that depend on that auto-dropping of trailing empty lines in other
cases). So my patch proposal is:

   \def\presetemptylastverbatimline%
   {\ifcase \verbatimstatus \or \or  \or \doflushverbatimline
    \else \kern \zeropoint \doverbatimnobreak \doflushverbatimline \fi
    %TH the next \kern is new
    \kern \zeropoint }

   \def\obeyemptylines%
   {\let\donextemptyverbatimline\doemptyverbatimline
    %TH the next reassignment is new
    \let\presetlastverbatimline\presetemptylastverbatimline  }

You have to add an \obeyemptylines command in your document(s), of
course.

Cheers, Taco

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

* Re: starttyping
  2006-02-04 13:39 starttyping Hans van der Meer
  2006-02-04 14:37 ` starttyping Taco Hoekwater
@ 2006-02-06 11:34 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-02-06 11:34 UTC (permalink / raw)


Hans van der Meer wrote:
> Found something annoying with \starttyping...\stoptyping.
>
> I wanted side by side two framed texts in verbatim, one of them one  
> line longer than the other.
> Of course they should align there lines.
>
> To accomplish this I put a blank line at the end of the shortest text.
> Alas, \starttyping does not honor a blank line at the end, although  
> it does honors blank lines inbetween.
> I am inclined to call this a bug.
>   
no, it's on purpose and therefore a feature
> Below a minimal example showing the blank line in between but not the  
> one at the end.
> The ContextWiki site gives the same result.
>
> \starttext
> \startframedtext[strut=no,offset=0pt]
> \starttyping
> before blank line
>
> after blank line
> blank line follows
>
> \stoptyping
> \stopframedtext
> \stoptext
>   
just add a \blank or \crlf after the typing 

Hans 

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

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

* Re: starttyping
  2006-02-04 14:37 ` starttyping Taco Hoekwater
@ 2006-02-06 13:53   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-02-06 13:53 UTC (permalink / raw)


Taco Hoekwater wrote:
> Hans van der Meer wrote:
>   
>> Found something annoying with \starttyping...\stoptyping.
>>
>> I wanted side by side two framed texts in verbatim, one of them one  
>> line longer than the other.
>> Of course they should align there lines.
>>
>> To accomplish this I put a blank line at the end of the shortest text.
>> Alas, \starttyping does not honor a blank line at the end, although  
>> it does honors blank lines inbetween.
>> I am inclined to call this a bug.
>>     
>
> I agree, but only when \obeyemptylines is in effect (i have documents
> that depend on that auto-dropping of trailing empty lines in other
> cases). So my patch proposal is:
>
>    \def\presetemptylastverbatimline%
>    {\ifcase \verbatimstatus \or \or  \or \doflushverbatimline
>     \else \kern \zeropoint \doverbatimnobreak \doflushverbatimline \fi
>     %TH the next \kern is new
>     \kern \zeropoint }
>
>    \def\obeyemptylines%
>    {\let\donextemptyverbatimline\doemptyverbatimline
>     %TH the next reassignment is new
>     \let\presetlastverbatimline\presetemptylastverbatimline  }
>
> You have to add an \obeyemptylines command in your document(s), of
> course.
>   

we can add such an option, but

- how does it behave at page boundaries (extra kern)
- when typing files

so, we need a way to configure it per environment

also, this patch does not honour the first empty lines

how about a slight variation (taco's patch + another one + modes):

\unprotect

% vervalt: \donextemptyverbatimline

\chardef\verbatimemptylinemode\zerocount

\def\presetemptyverbatimline
  {\ifcase\verbatimstatus
     \global\chardef\verbatimstatus\plusone
   \or
\ifcase\verbatimemptylinemode\or\or
  \doemptyverbatimline
\fi
   \or
\ifcase\verbatimemptylinemode\else
  \doemptyverbatimline
\fi
   \or
     \doflushverbatimline
     \global\let\savedverbatimline\empty
     \doemptyverbatimline
     \global\chardef\verbatimstatus\plustwo
   \else
     \kern\zeropoint
     \doverbatimnobreak
     \doflushverbatimline
     \global\let\savedverbatimline\empty
     \doemptyverbatimline
     \global\chardef\verbatimstatus\plustwo
   \fi}

\def\presetlastverbatimline
  {\ifcase \verbatimstatus
   \or
   \or
   \or
     \doflushverbatimline
   \else
     \kern \zeropoint
     \doverbatimnobreak
     \doflushverbatimline
   \fi
\ifcase\verbatimemptylinemode\or\else
   \kern \zeropoint
\fi }

\def\obeyemptylines
  {\chardef\verbatimemptylinemode\plusone}

\def\obeyallemptylines
  {\chardef\verbatimemptylinemode\plustwo}

\obeyemptylines
\obeyallemptylines

\showgrid \setuplayout[grid=yes]

\starttext

xxx
\starttyping



1test

test


test
\stoptyping
xxx
\starttyping
2test
test
test

\stoptyping
xxx

\starttyping
3test
test
test




\stoptyping
xxx
\starttyping
test

test

test

test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


test


\stoptyping


\stoptext


Hans

-- 

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

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

end of thread, other threads:[~2006-02-06 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-04 13:39 starttyping Hans van der Meer
2006-02-04 14:37 ` starttyping Taco Hoekwater
2006-02-06 13:53   ` starttyping Hans Hagen
2006-02-06 11:34 ` starttyping Hans Hagen

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).