I don't know if I've stated the problem clearly.
You know , with keyval related packages, we can define a macro with
{key=value} style arguement.
Now, I want to define a macro which takes the following form:
for instance,
\mvcmd{{some text1}, {some text 2},{},{some text 3},,,,}
as if each pair of {} would be added "key=" before it, so we can
process each value between the curly brackets {} orderly, if it's not
empty.
Maybe this problem seems somewhat strange, however, I still hope that
there's somebody can give any suggests or a little hints. Thanks a lot.
|
|
0
|
|
|
|
Reply
|
rockyzhz (6)
|
12/27/2009 4:19:52 PM |
|
On Dec 27, 4:19=A0pm, Rocky Zhang <rocky...@gmail.com> wrote:
> I don't know if I've stated the problem clearly.
>
> You know , with keyval related packages, we can define a macro with
> {key=3Dvalue} style arguement.
> Now, I want to define a macro which takes the following form:
> for instance,
> \mvcmd{{some text1}, {some text 2},{},{some text 3},,,,}
> as if each pair of {} would be added "key=3D" before it, so we can
> process each value between the curly brackets {} orderly, if it's not
> empty.
>
> Maybe this problem seems somewhat strange, however, I still hope that
> there's somebody can give any suggests or a little hints. Thanks a lot.
Perhaps you could use \@for from the LaTeX kernel to iterate over each
comma-separated value?
\newcommand*\mvcmd[1]{%
\@for\mv@temp:=3D#1\do{%
% Whatever you want to do with each comma-separated item
}%
}
It might help to know what you are actually trying to achieve. Could
you explain what the idea actually is?
--
Joseph Wright
|
|
0
|
|
|
|
Reply
|
Joseph
|
12/27/2009 5:54:57 PM
|
|
Rocky Zhang <rockyzhz@gmail.com> wrote:
> I don't know if I've stated the problem clearly.
>
> You know , with keyval related packages, we can define a macro with
> {key=value} style arguement.
> Now, I want to define a macro which takes the following form:
> for instance,
> \mvcmd{{some text1}, {some text 2},{},{some text 3},,,,}
> as if each pair of {} would be added "key=" before it, so we can
> process each value between the curly brackets {} orderly, if it's not
> empty.
It's not entirely clear to me. If you want to process comma separated
lists, then \@for of LaTeX's kernel already can this.
Or you can use package `kvsetkeys', section "1.7 Comma separated
lists".
Yours sincerely
Heiko <oberdiek@uni-freiburg.de>
|
|
0
|
|
|
|
Reply
|
Heiko
|
12/27/2009 7:19:25 PM
|
|
On 12=D4=C228=C8=D5, =C9=CF=CE=E71=CA=B154=B7=D6, Joseph Wright <joseph.wri=
....@morningstar2.co.uk>
wrote:
> On Dec 27, 4:19 pm, Rocky Zhang <rocky...@gmail.com> wrote:
>
> > I don't know if I've stated the problem clearly.
>
> > You know , with keyval related packages, we can define a macro with
> > {key=3Dvalue} style arguement.
> > Now, I want to define a macro which takes the following form:
> > for instance,
> > \mvcmd{{some text1}, {some text 2},{},{some text 3},,,,}
> > as if each pair of {} would be added "key=3D" before it, so we can
> > process each value between the curly brackets {} orderly, if it's not
> > empty.
>
> > Maybe this problem seems somewhat strange, however, I still hope that
> > there's somebody can give any suggests or a little hints. Thanks a lot.
>
> Perhaps you could use \@for from the LaTeX kernel to iterate over each
> comma-separated value?
>
> \newcommand*\mvcmd[1]{%
> \@for\mv@temp:=3D#1\do{%
> % Whatever you want to do with each comma-separated item
> }%
>
> }
>
> It might help to know what you are actually trying to achieve. Could
> you explain what the idea actually is?
> --
> Joseph Wright
Actually, this is just an part of the idea which is to mock the style
of a Mankiw's book <Principles of Economics>. On the every
chapter titlepage of that book, there's a panel consists of some
color blocks, varying the number by the given sentences which
are the keypoints of that chapter.
So, I just want to use these sentences to determine the number
of color blocks. Your hints and the help of Heiko Oberdiek make
this come to realized. This feather can loosen the constraint of
user That's so great! Thanks a lot!
The basic purpose of doing such a work is to make the format of
typesetting depart from the content. So that we can simply change
a header file to get the totally different style of the book, without
change the commands used in the common 'book' document class.
For example, to redifined the section command, we can realized
another style of section title even with a color frame. This can
make us generate different version of our books or articles, the plain
one is for print, another is for electronic reading. In a words, it's
just a book template with high compatibility.:-)
Thank you for your help. Also many thanks go to Heiko Oberdiek,
the command \comma@normalize is so amazing!
Best regards,
Rocky Zhang
|
|
0
|
|
|
|
Reply
|
Rocky
|
12/28/2009 12:33:26 PM
|
|
|
3 Replies
168 Views
(page loaded in 0.106 seconds)
Similiar Articles: [memoir, fourier, microtype] horizontal/vertical shifts when ...... 2008/08/11 v1.5 Definitions with two optional arguments (HO ... 24 v6.0f Patches for memoir class v1.6180339 svn-multi ... Geometry keyval.sty 1999/03/16 v1.13 key=value ... Comparison of a Simple Join done by EG and Hand Coded - 22 times ...I can easily pass macro arguments to batch jobs using ... column product sales; MPRINT(SALESRPT): define ... I think getting the argument value from the meta data is ... Assigning same value to multiple variables - comp.lang.rexx ...How to pass dataset variables' value to macro - comp.soft-sys ... grouping variable - but i get the same ... argument if ... proc import - how to define char or numeric as char ... extern typedef struct - comp.lang.cNow I look at 6.10.3 Macro replacement, item 2 "An ... C style question - comp.lang.c typedef unsigned int long ... nuubu: C: typedef, struct, extern What is typedef and struct? Finding ERRORs in SASLOG - comp.soft-sys.sas... records" " 0 rows" " 0 obs" "%to value of ... creates a common" "default estimation" "default style ... are not allowed" > > "argument 1" > > "argument 2 ... Wrap a function - comp.lang.python... run("cmd") were "cmd" is a command with its arguments to ... supposing that could be solved with a DSL or a macro ... text file outside your program, in which you define ... blank variable if value is 0 help - comp.soft-sys.stat.spss ...... when I am listing data for eyeballing what is ... This is a multi-part message in MIME format ... following the value_if_true argument), the IF function returns the value 0 ... Could anyone give me the spice-mode.el - comp.emacsHi, All I am new to *NIX and I am thinking of writing spice code under Emacs. However, I have no idea of Emacs Lisp. Hence, I could not write a packa... New features added to development gawk - comp.lang.awkDo you mean multidimensional arrays FORTRAN style, or ... memory as to what syntax Fortran and BASIC use for multi ... RTTI - comp.lang.c++.moderated For RAD development, what is ... error LNK2019: unresolved external symbol _main referenced in ...... cbSize = sizeof(WNDCLASSEX); WndClsEx.style ... mean you would not be able to access any program arguments ... Unicode it is not necessary to use the UNICODE macro ... Built-in Macro Functions - RSB Home PageAborts the macro if the value is not a number or the key is ... setFont(name, size[, style]) Sets the font used ... The third argument is the value to be added or modified. #define Directive (C/C++)The #define creates a macro, which is the association of an identifier or ... textual instances followed by an argument list indicate a macro call. The actual arguments ... 7/21/2012 5:36:34 PM
|