* Indenting in \setuplines
@ 2013-06-03 13:20 Marcin Borkowski
2013-06-05 21:06 ` Marcin Borkowski
0 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2013-06-03 13:20 UTC (permalink / raw)
To: ConTeXt mailing list
Hi,
I'd like to have my \startlines ... \stoplines indented in the
following way: the first two lines unindented, the next two indented,
and so on. Basically, this means that I'd like the pattern to be based
on (mod 4) arithmetic and not (mod 2). Is it possible? If yes, how?
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indenting in \setuplines
2013-06-03 13:20 Indenting in \setuplines Marcin Borkowski
@ 2013-06-05 21:06 ` Marcin Borkowski
2013-06-05 22:22 ` Hans Hagen
0 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2013-06-05 21:06 UTC (permalink / raw)
To: ntg-context
Dnia 2013-06-03, o godz. 15:20:45
Marcin Borkowski <mbork@wmi.amu.edu.pl> napisał(a):
> Hi,
>
> I'd like to have my \startlines ... \stoplines indented in the
> following way: the first two lines unindented, the next two indented,
> and so on. Basically, this means that I'd like the pattern to be
> based on (mod 4) arithmetic and not (mod 2). Is it possible? If
> yes, how?
OK, so I thought I can handle this... but not:(.
I found the relevant definitions in spac-hor.mkiv and tried to add a
line saying
\installindentingmethod
\v!evenpairs{\c_spac_indentation_toggle_state\plusfour}
But after context --make I got an "Undefined control sequence." Here's
an excerpt from the log information:
! Undefined control sequence.
system > tex > error on line 108 in
file /home/marcin/context-2013-05-22-19-28/tex/texmf-context/tex/context/base/spac-hor.mkiv:
Undefined control sequence ...
98
99 \installindentingmethod \v!yes
{\parindent\d_spac_indentation_par\relax} % not \indent ! 100
\installindentingmethod
\v!always{\parindent\d_spac_indentation_par\relax} % not \indent ! 101
102 \installindentingmethod \v!never
{\parindent\zeropoint\relax % no \indent !
103
\c_spac_indentation_toggle_state\zerocount} 104 105
\installindentingmethod \v!odd
{\c_spac_indentation_toggle_state\plusone} 106
\installindentingmethod \v!even
{\c_spac_indentation_toggle_state\plustwo} 107
%\installindentingmethod \v!oddpairs
{\c_spac_indentation_toggle_state\plusthree} 108 >>
\installindentingmethod \v!evenpairs
{\c_spac_indentation_toggle_state\plusfour} 109 110
\installindentingmethod \v!normal{\ifx\normalindentation\empty\else
111
\let\v_spac_indentation_current\normalindentation
112 \simplesetupindenting
113 \fi} 114 115
\installindentingmethod \v!reset
{\settrue\c_spac_indentation_indent_first
116 \parindent\zeropoint
117
\c_spac_indentation_toggle_state\zerocount} 118
<argument> \??indentingmethod \v!evenpairs
\setvalue #1?-\expandafter \def \csname #1
\endcsname
\installindentingmethod ...{\??indentingmethod #1}
{#2}
l.108 ...{\c_spac_indentation_toggle_state\plusfour}
What am I doing wrong?
> TIA,
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indenting in \setuplines
2013-06-05 21:06 ` Marcin Borkowski
@ 2013-06-05 22:22 ` Hans Hagen
2013-06-05 22:36 ` Marcin Borkowski
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2013-06-05 22:22 UTC (permalink / raw)
To: ntg-context
On 6/5/2013 11:06 PM, Marcin Borkowski wrote:
> Dnia 2013-06-03, o godz. 15:20:45
> Marcin Borkowski <mbork@wmi.amu.edu.pl> napisał(a):
>
>> Hi,
>>
>> I'd like to have my \startlines ... \stoplines indented in the
>> following way: the first two lines unindented, the next two indented,
>> and so on. Basically, this means that I'd like the pattern to be
>> based on (mod 4) arithmetic and not (mod 2). Is it possible? If
>> yes, how?
>
> OK, so I thought I can handle this... but not:(.
>
> I found the relevant definitions in spac-hor.mkiv and tried to add a
> line saying
>
> \installindentingmethod
> \v!evenpairs{\c_spac_indentation_toggle_state\plusfour}
% there is no \v!evenpairs
\unprotect
% english interface only:
\installindentingmethod
{evenpairs}
{\c_spac_indentation_toggle_state\plusfour}
% or maybe:
\installindentingmethod
\v!quadruple
{\c_spac_indentation_toggle_state\plusfour}
% as \v!quadruple is a known keyword
\protect
-----------------------------------------------------------------
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
-----------------------------------------------------------------
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indenting in \setuplines
2013-06-05 22:22 ` Hans Hagen
@ 2013-06-05 22:36 ` Marcin Borkowski
2013-06-06 7:49 ` Hans Hagen
0 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2013-06-05 22:36 UTC (permalink / raw)
To: ntg-context
Dnia 2013-06-06, o godz. 00:22:04
Hans Hagen <pragma@wxs.nl> napisał(a):
> On 6/5/2013 11:06 PM, Marcin Borkowski wrote:
> > Dnia 2013-06-03, o godz. 15:20:45
> > Marcin Borkowski <mbork@wmi.amu.edu.pl> napisał(a):
> >
> >> Hi,
> >>
> >> I'd like to have my \startlines ... \stoplines indented in the
> >> following way: the first two lines unindented, the next two
> >> indented, and so on. Basically, this means that I'd like the
> >> pattern to be based on (mod 4) arithmetic and not (mod 2). Is it
> >> possible? If yes, how?
> >
> > OK, so I thought I can handle this... but not:(.
> >
> > I found the relevant definitions in spac-hor.mkiv and tried to add a
> > line saying
> >
> > \installindentingmethod
> > \v!evenpairs{\c_spac_indentation_toggle_state\plusfour}
>
> % there is no \v!evenpairs
>
> \unprotect
>
> % english interface only:
>
> \installindentingmethod
> {evenpairs}
> {\c_spac_indentation_toggle_state\plusfour}
>
> % or maybe:
>
> \installindentingmethod
> \v!quadruple
> {\c_spac_indentation_toggle_state\plusfour}
>
> % as \v!quadruple is a known keyword
>
> \protect
Sorry to say that, but neither seems to work...
! Missing number, treated as zero.
<to be read again>
q
\v_spac_indentation_current ->q
uadruple
\4>unknown #1#2#3#4#5->#2=#1
\relax
\spac_indentation_apply_step_one ...on_setup_size
\fi
\next1 #1,->\spac_indentation_apply_step_one {#1}
\syst_helpers_do_process_co...
\syst_helpers_do_process_comma_list ...rgument #1,
]\relax \global
\advance \... ...
l.36 \startlines[indenting=quadruple]
?
What do I do? (And what do I do if I really want "evenpairs",
especially that I'd like to have "oddpairs", too, so "quadruple" is not
really a good keyword for me?)
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indenting in \setuplines
2013-06-05 22:36 ` Marcin Borkowski
@ 2013-06-06 7:49 ` Hans Hagen
2013-06-06 8:58 ` Marcin Borkowski
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2013-06-06 7:49 UTC (permalink / raw)
To: ntg-context
On 6/6/2013 12:36 AM, Marcin Borkowski wrote:
> Sorry to say that, but neither seems to work...
it is hard to say what goes wrong if you only show the error message and
no real code
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
-----------------------------------------------------------------
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indenting in \setuplines
2013-06-06 7:49 ` Hans Hagen
@ 2013-06-06 8:58 ` Marcin Borkowski
0 siblings, 0 replies; 6+ messages in thread
From: Marcin Borkowski @ 2013-06-06 8:58 UTC (permalink / raw)
To: ntg-context
Dnia 2013-06-06, o godz. 09:49:27
Hans Hagen <pragma@wxs.nl> napisał(a):
> On 6/6/2013 12:36 AM, Marcin Borkowski wrote:
>
> > Sorry to say that, but neither seems to work...
>
> it is hard to say what goes wrong if you only show the error message
> and no real code
Sorry for that, my fault.
Now comes the fun part: I *copied* my code from "my" version of
spac-hor.mkiv to the document, and it started to work then! Strange.
I attach a MWE. Hans, is it possible to add something like that to
spac-hor.mkiv? (This code is not very nice, there's some duplication,
but it's simple and works;).)
%%%%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%%%%%
\unprotect
\installindentingmethod{oddpairs}{\c_spac_indentation_toggle_state\plusthree}
\installindentingmethod{evenpairs}{\c_spac_indentation_toggle_state\plusfour}
\newcount \c_spac_par_modulo_four
\def\spac_indentation_evenpairs_toggle
{%
\advance \c_spac_par_modulo_four \plusone
\ifnum \c_spac_par_modulo_four=4
\c_spac_par_modulo_four=0
\fi
\ifcase \c_spac_par_modulo_four
\global\indentationtrue
\or
\global\indentationfalse \spac_indentation_remove
\or
\global\indentationfalse \spac_indentation_remove
\or
\global\indentationtrue
\fi
}
\def\spac_indentation_oddpairs_toggle
{%
\advance \c_spac_par_modulo_four \plusone
\ifnum \c_spac_par_modulo_four=4
\c_spac_par_modulo_four=0
\fi
\ifcase \c_spac_par_modulo_four
\global\indentationfalse \spac_indentation_remove
\or
\global\indentationtrue
\or
\global\indentationtrue
\or
\global\indentationfalse \spac_indentation_remove
\fi
}
\def\spac_indentation_check_toggle
{\ifcase\c_spac_indentation_toggle_state
% nothing
\or % odd
\spac_indentation_no_toggle
\or % even
\spac_indentation_do_toggle
\or % oddpairs
\global\let\checkindentation\spac_indentation_oddpairs_toggle
\or % evenpairs
\global\let\checkindentation\spac_indentation_evenpairs_toggle
\fi}
\protect
\setupindenting[yes,1em]
\starttext
\startlines[indenting=evenpairs]
Lorem ipsum
dolor sit amet,
consectetuer adipiscing elit.
Ut purus elit,
vestibulum ut,
placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget,
consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque.
\stoplines
\stoptext
%%%%%%%%%%%%%%%%%%%% cut here %%%%%%%%%%%%%%%%%%%%
> Hans
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-06 8:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 13:20 Indenting in \setuplines Marcin Borkowski
2013-06-05 21:06 ` Marcin Borkowski
2013-06-05 22:22 ` Hans Hagen
2013-06-05 22:36 ` Marcin Borkowski
2013-06-06 7:49 ` Hans Hagen
2013-06-06 8:58 ` Marcin Borkowski
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).