Extract only certain part of document (via modes)?
Dear list, and in particular Hans, I asked the same question on stackexchange before today (http://tex.stackexchange.com/q/337738/52406), and got the answer that what I want to do might not be possible. In my large document I have exercises (typeset with \startexercise \stopexercise, defined as an enumeration). Is it possible to use modes (or any other trick) to be able to compile the same file and get only the exercises. For example, context file.tex should give the full document, while context --mode=exercises file.tex should give only all the exercises (or just everything "in one mode")? /Mikael
Mikael P. Sundqvist mailto:mickep@gmail.com 6. November 2016 um 12:51 Dear list, and in particular Hans,
I asked the same question on stackexchange before today (http://tex.stackexchange.com/q/337738/52406), and got the answer that what I want to do might not be possible.
In my large document I have exercises (typeset with \startexercise \stopexercise, defined as an enumeration). Is it possible to use modes (or any other trick) to be able to compile the same file and get only the exercises. For example,
context file.tex
should give the full document, while
context --mode=exercises file.tex
should give only all the exercises (or just everything "in one mode")? You can put each exercise in a block and ask Hans to add a \saveblocks commands which writes the content of all exercise blocks to a external file (like \savebuffer lets you save the content of a buffer in a external file).
\defineblock[exercise] \keepblocks [exercise] \defineenumeration[exercise][text=Exercise] %\doifmode{exercises}{\saveblocks[exercise][exercises.tex]} \starttext \beginexercise \startexercise This is the first exercise. \stopexercise \endexercise \beginexercise \startexercise This is the second exercise. \stopexercise \endexercise \stoptext The content of this saved file can then be read by another file to get a document which contains only the exercises. \defineenumeration[exercise][text=Exercise] \starttext \doiffileelse{exercise} {\input{exercises}} {{\tttf Exercise file doesn’t exist.}} \stoptext Wolfgang
On Sun, Nov 6, 2016 at 3:03 PM, Wolfgang Schuster
Mikael P. Sundqvist 6. November 2016 um 12:51 Dear list, and in particular Hans,
I asked the same question on stackexchange before today (http://tex.stackexchange.com/q/337738/52406), and got the answer that what I want to do might not be possible.
In my large document I have exercises (typeset with \startexercise \stopexercise, defined as an enumeration). Is it possible to use modes (or any other trick) to be able to compile the same file and get only the exercises. For example,
context file.tex
should give the full document, while
context --mode=exercises file.tex
should give only all the exercises (or just everything "in one mode")?
You can put each exercise in a block and ask Hans to add a \saveblocks commands which writes the content of all exercise blocks to a external file (like \savebuffer lets you save the content of a buffer in a external file).
\defineblock[exercise] \keepblocks [exercise]
\defineenumeration[exercise][text=Exercise]
%\doifmode{exercises}{\saveblocks[exercise][exercises.tex]}
\starttext
\beginexercise \startexercise This is the first exercise. \stopexercise \endexercise
\beginexercise \startexercise This is the second exercise. \stopexercise \endexercise
\stoptext
The content of this saved file can then be read by another file to get a document which contains only the exercises.
\defineenumeration[exercise][text=Exercise]
\starttext
\doiffileelse{exercise} {\input{exercises}} {{\tttf Exercise file doesn’t exist.}}
\stoptext
Wolfgang
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
Thank you for the answer, I think that would be nice to have. Hans, do you mind adding such a feature? Or do you have any other idea on the problem as is? /Mikael
On 11/6/2016 12:51 PM, Mikael P. Sundqvist wrote:
Dear list, and in particular Hans,
I asked the same question on stackexchange before today (http://tex.stackexchange.com/q/337738/52406), and got the answer that what I want to do might not be possible.
In my large document I have exercises (typeset with \startexercise \stopexercise, defined as an enumeration). Is it possible to use modes (or any other trick) to be able to compile the same file and get only the exercises. For example,
context file.tex
should give the full document, while
context --mode=exercises file.tex
should give only all the exercises (or just everything "in one mode")?
search for 'blocks' ... \defineblock ... \hideblocks \keepblocks \useblocks \processblocks \selectblocks Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen mailto:pragma@wxs.nl 10. November 2016 um 17:27
search for 'blocks' ...
\defineblock ... \hideblocks \keepblocks \useblocks \processblocks \selectblocks This doesn’t solve the problem because he want a document which contains *only* certain blocks and nothing else, a solution for this is a commands (\saveblocks) which saves the content of a block in a external file (like \savebuffer does).
Wolfgang
Dear list members: I have this simple table: \starttext \placetable[here]{title}{ \setuptables[bodyfont=8pt,rulethickness=0.04em] \start \setuplocalinterlinespace[2.2ex] \starttable[|lp(5cm)|lp(5cm)|cp(2cm)|] \HL[2] \NC \bf First Column \NC \bf Second Column \NC \bf Third Column \NC \SR \HL \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa turpis, semper quis fringilla ut, viverra nec risus. \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. \NC Lorem ipsum \NC \SR \HL \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque \NC \SR \HL \NC Donec nunc lorem, sollicitudin vel sodales eget \NC Donec nunc lorem, sollicitudin vel sodales eget Donec nunc lorem, sollicitudin vel sodales eget \NC Donec \NC \SR \HL[2] \stoptable \stop} \stoptext I have some questions related to the above table. 1. How can I set the distance between the text (in rows) and the rule above and below the text, separately? I find that the rules are too close to the text. I tried \setuptables' height and depth options but those are not what I need, I guess. What are height and depth options are for exactly? 2. Can \setuptables[bodyfont=...] option use font sizes as \tfa, \tfb, \tfc, \tfx, \tfxx, or point size has to be set explicitly? 3. What is the distance option in \setuptables? Thank you in advance, bcsikos
On 11/11/2016 4:26 PM, Csikos Bela wrote:
Dear list members:
I have this simple table:
\starttext \placetable[here]{title}{ \setuptables[bodyfont=8pt,rulethickness=0.04em] \start \setuplocalinterlinespace[2.2ex] \starttable[|lp(5cm)|lp(5cm)|cp(2cm)|] \HL[2] \NC \bf First Column \NC \bf Second Column \NC \bf Third Column \NC \SR \HL \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa turpis, semper quis fringilla ut, viverra nec risus. \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. \NC Lorem ipsum \NC \SR \HL \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque \NC \SR \HL \NC Donec nunc lorem, sollicitudin vel sodales eget \NC Donec nunc lorem, sollicitudin vel sodales eget Donec nunc lorem, sollicitudin vel sodales eget \NC Donec \NC \SR \HL[2] \stoptable \stop} \stoptext
I have some questions related to the above table.
1. How can I set the distance between the text (in rows) and the rule above and below the text, separately? I find that the rules are too close to the text. I tried \setuptables' height and depth options but those are not what I need, I guess. What are height and depth options are for exactly?
it's not configurable i'll an openup key \unprotect \def\tabl_table_normal_full_rule {\starttablenoalign \!ttGetHalfRuleThickness \scratchdistance\directtablesparameter\c!openup \ifzeropt\scratchdistance\else\kern\scratchdistance\fi \hrule\s!height\scratchdimen\s!depth\scratchdimen \ifzeropt\scratchdistance\else\kern\scratchdistance\fi \stoptablenoalign} \setuptables [\c!openup=\zeropoint] \protect ... % \setuplocalinterlinespace[2.2ex] \setuptables [openup=-.2ex]
2. Can \setuptables[bodyfont=...] option use font sizes as \tfa, \tfb, \tfc, \tfx, \tfxx, or point size has to be set explicitly?
indeed
3. What is the distance option in \setuptables?
Thank you in advance,
bcsikos
___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen írta:
On 11/11/2016 4:26 PM, Csikos Bela wrote:
Dear list members:
I have this simple table:
\starttext \placetable[here]{title}{ \setuptables[bodyfont=8pt,rulethickness=0.04em] \start \setuplocalinterlinespace[2.2ex] \starttable[|lp(5cm)|lp(5cm)|cp(2cm)|] \HL[2] \NC \bf First Column \NC \bf Second Column \NC \bf Third Column \NC \SR \HL \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa turpis, semper quis fringilla ut, viverra nec risus. \NC Lorem ipsum dolor sit amet, consectetur adipiscing elit. \NC Lorem ipsum \NC \SR \HL \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque habitant morbi tristique senectus et netus \NC Pellentesque \NC \SR \HL \NC Donec nunc lorem, sollicitudin vel sodales eget \NC Donec nunc lorem, sollicitudin vel sodales eget Donec nunc lorem, sollicitudin vel sodales eget \NC Donec \NC \SR \HL[2] \stoptable \stop} \stoptext
I have some questions related to the above table.
1. How can I set the distance between the text (in rows) and the rule above and below the text, separately? I find that the rules are too close to the text. I tried \setuptables' height and depth options but those are not what I need, I guess. What are height and depth options are for exactly?
Thank you for your answer.
it's not configurable
Is it configurable in other table types, e.g. in TABLE or xtables?
i'll an openup key
\unprotect
\def\tabl_table_normal_full_rule {\starttablenoalign \!ttGetHalfRuleThickness \scratchdistance\directtablesparameter\c!openup \ifzeropt\scratchdistance\else\kern\scratchdistance\fi \hrule\s!height\scratchdimen\s!depth\scratchdimen \ifzeropt\scratchdistance\else\kern\scratchdistance\fi \stoptablenoalign}
\setuptables [\c!openup=\zeropoint]
\protect
...
% \setuplocalinterlinespace[2.2ex] \setuptables [openup=-.2ex]
Thank you. This forks for the distance between the rule and the top of the following text, but not for the distance between the bottom of the text and the following rule. How would it be that? Thank you in advance, bcsikos
participants (4)
-
Csikos Bela
-
Hans Hagen
-
Mikael P. Sundqvist
-
Wolfgang Schuster