1

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 \setupframedtextsshould 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 2\baselineskip{\startframedtext[mySectionFrame]} after=\stopframedtext\vskip\baselineskip] 

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.

3
  • \defineframedtext[myFrame] \setupframedtext[myFrame][frame=off,topframe=on,bottomframe=on,width=\textwidth] \starttext \startmyFrame \input Knuth \stopmyFrame \stoptext You have to define your framed text first. Commented Jul 23, 2020 at 7:45
  • Additionally, your setup points to two or more environments. \setupframedtext, in singular, is enough. A functional example: \defineframedtext[myFrame] \setupframedtext[myFrame][frame=off,topframe=on,bottomframe=on,width=\textwidth] \definehead[mySection][section] \setuphead[mySection] [numberstyle=\bf, textstyle=\bf, before={\vskip 2\baselineskip \startmyFrame}, after={\stopmyFrame\vskip\baselineskip}] \starttext \startmyFrame \input Knuth \stopmyFrame \startmySection \input zapf \stopmySection \stoptext Commented Jul 23, 2020 at 7:55
  • @Noone Thank you for clarification. Would you like to make it an answer? Commented Jul 23, 2020 at 8:20

1 Answer 1

5

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 2\baselineskip \startmyFrame}, after={\stopmyFrame\vskip\baselineskip}] \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 \setups and \defines which ConTeXt handles with.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.