TeX - LaTeX Asked by Tomáš Kruliš on August 27, 2021
I am learning ConTeXt (and so far it is a great experience!); however, while making notes and tests with "ConTeXt: An Excursion," and occasionally looking to into reference manual, I have hit into following:
Command setupframedtexts
should work as follows: setupframedtexts[name][..=..]
(according to reference manual), but it ignores the name
(and if name
is provided it results to defaults).
Or am I making syntactical error somewhere?
MWE:
setupframedtexts[myFrame][frame=off,topframe=on,bottomframe=on,width=textwidth]
starttext
startframedtext[myFrame]
input Knuth
stopframedtext
stoptext
I also want to use ConTeXt setups like so:
setupsomething[mything]
[settings]
setupsomethingelse[myanotherthing]
[settings,
setting={something[mything]}]
For example:
setupframedtexts[mySectionFrame]
[frame=off,
topframe=on,
bottomframe=on,
width=textwidth]
definehead[mySection][section]
setuphead[mySection]
[numberstyle=bold,
textstyle=bold,
before=vskip 2baselineskip{startframedtext[mySectionFrame]}
after=stopframedtextvskipbaselineskip]
My question originated from this situation.
This might be considered as two questions in one, but they are (pretty much) related, so I hoope it doesnt mind.
Final note: I know, that reference manual is not perfectly up-to-date, but behaviour that would accept named argument (to me) makes more sense.
Your MWE didn't work because you're passing myFramed
as a parameter to startframedtext ... stopframedtext
and it will be ignored.
In ConTeXt usually a setup...
has a define...
counterpart. In your case, you need to define your framedtext
first via defineframedtext[myFrame]
, so you set it up later. Notice setupframedtext[myFrame]
, in singular. The plural form applies changes to framed texts overall, although you could just use it specifying myFramed
, what you apparently tried. defineframedtext[myFrame]
will define startmyFrame
and stopmyFrame
. Let's see:
defineframedtext[myFrame]
setupframedtext[myFrame][frame=off,topframe=on,bottomframe=on,width=textwidth]
starttext
startmyFrame
input Knuth
stopmyFrame
stoptext
Now your environment is ready to be used in a section head (when bold
doesn't do anything, try bf
instead). I suggest you to enclose macros with braces when your content after before=
and after=
is formed by "complex" macros to avoid funny parsing errors.
defineframedtext[myFrame]
setupframedtext[myFrame][frame=off,topframe=on,bottomframe=on,width=textwidth]
definehead[mySection][section]
setuphead[mySection] [numberstyle=bf, textstyle=bf, before={vskip 2baselineskip startmyFrame}, after={stopmyFramevskipbaselineskip}]
starttext
startmyFrame
input Knuth
stopmyFrame
startmySection
input zapf
stopmySection
stoptext
ConTeXt command list is quite illustrative in case you want to understand better the endless amount of setup
s and define
s which ConTeXt handles with.
Correct answer by user220367 on August 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP