ConTeXt: Columnar section titles, floats, and imagesImages, titles and marginsAlignment of section titles in...
What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?
least quadratic residue under GRH: an EXPLICIT bound
Can you lasso down a wizard who is using the Levitate spell?
Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?
Email Account under attack (really) - anything I can do?
Can Medicine checks be used, with decent rolls, to completely mitigate the risk of death from ongoing damage?
What is the meaning of "of trouble" in the following sentence?
Is it possible to do 50 km distance without any previous training?
How is this relation reflexive?
How to make payment on the internet without leaving a money trail?
declaring a variable twice in IIFE
Example of a relative pronoun
Why don't electron-positron collisions release infinite energy?
How to type dʒ symbol (IPA) on Mac?
Motorized valve interfering with button?
Non-Jewish family in an Orthodox Jewish Wedding
How do you conduct xenoanthropology after first contact?
How do I create uniquely male characters?
Is Social Media Science Fiction?
If Manufacturer spice model and Datasheet give different values which should I use?
My colleague's body is amazing
"which" command doesn't work / path of Safari?
Simulate Bitwise Cyclic Tag
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
ConTeXt: Columnar section titles, floats, and images
Images, titles and marginsAlignment of section titles in multi-column paragraphs in ConTeXtConTeXt no bottom titlesFigures/Floats and Section Headings on New Pages in ConTeXt?ConTeXt : side floats and backgroundProblem in rendering bibliography in ConTeXtImplement Friggeri in ConTeXtPandoc + ConTeXt: Inline imagesContext images / figures and linenumbering
Background
Regarding floats in columns, the wiki states:
By default, a title will be moved down to appear below a float, it will not be "wrapped" around a float like normal text.
Problem
The section title disappears, instead of being moved below the float. Ultimately, I'm trying to produce the following two layouts without changing the content (between starttext
and stoptext
):
As an aside, it is important that the content need not change as there are other layouts that use the same document structure. If content changes can be made universal such that the other layouts remain unaffected, for example by adding a new namespace and command, then that will work. This might resemble:
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% ...
starttext
setupInsertPhotograph[
author=Full Name,
homepage=http://authorname.com/about.html,
source=http://flickr.com/authorname/sunset.jpg,
]
% Calls "placefigure" and "externalfigure" using the setup parameters.
InsertPhotograph
% ...
stoptext
Then the InsertPhotograph
macro could be used to customize how the photograph is typeset, independently of the layout.
Code
So far, I have the following code:
setupalign[hz,tolerant,]
setuphead[chapter][footer=empty,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
]
setuphead[chapter,section,subsection][header=none,number=no,]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[width=hsize,]
definecolumnset[BookColumns][n=2]
definecolumnsetspan[BookColumnSpan][n=2]
starttext
startchapter[title=Chapter One]
page
startcolumnset[BookColumns]
startsection[title=Section One]
% This could be InsertPhotograph instead of placefigure...
placefigure[tblr]{}{externalfigure[fake][]}
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{4} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsection
startsection[title=Section Two]
dorecurse{4} { input knuth }
stopsection
stopcolumnset
stopchapter
stoptext
Question
How can the photograph float to the left of the section title when a figure is present, whilst the section title spans the page when no figure is present?
floats titles context context-mkiv
add a comment |
Background
Regarding floats in columns, the wiki states:
By default, a title will be moved down to appear below a float, it will not be "wrapped" around a float like normal text.
Problem
The section title disappears, instead of being moved below the float. Ultimately, I'm trying to produce the following two layouts without changing the content (between starttext
and stoptext
):
As an aside, it is important that the content need not change as there are other layouts that use the same document structure. If content changes can be made universal such that the other layouts remain unaffected, for example by adding a new namespace and command, then that will work. This might resemble:
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% ...
starttext
setupInsertPhotograph[
author=Full Name,
homepage=http://authorname.com/about.html,
source=http://flickr.com/authorname/sunset.jpg,
]
% Calls "placefigure" and "externalfigure" using the setup parameters.
InsertPhotograph
% ...
stoptext
Then the InsertPhotograph
macro could be used to customize how the photograph is typeset, independently of the layout.
Code
So far, I have the following code:
setupalign[hz,tolerant,]
setuphead[chapter][footer=empty,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
]
setuphead[chapter,section,subsection][header=none,number=no,]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[width=hsize,]
definecolumnset[BookColumns][n=2]
definecolumnsetspan[BookColumnSpan][n=2]
starttext
startchapter[title=Chapter One]
page
startcolumnset[BookColumns]
startsection[title=Section One]
% This could be InsertPhotograph instead of placefigure...
placefigure[tblr]{}{externalfigure[fake][]}
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{4} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsection
startsection[title=Section Two]
dorecurse{4} { input knuth }
stopsection
stopcolumnset
stopchapter
stoptext
Question
How can the photograph float to the left of the section title when a figure is present, whilst the section title spans the page when no figure is present?
floats titles context context-mkiv
add a comment |
Background
Regarding floats in columns, the wiki states:
By default, a title will be moved down to appear below a float, it will not be "wrapped" around a float like normal text.
Problem
The section title disappears, instead of being moved below the float. Ultimately, I'm trying to produce the following two layouts without changing the content (between starttext
and stoptext
):
As an aside, it is important that the content need not change as there are other layouts that use the same document structure. If content changes can be made universal such that the other layouts remain unaffected, for example by adding a new namespace and command, then that will work. This might resemble:
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% ...
starttext
setupInsertPhotograph[
author=Full Name,
homepage=http://authorname.com/about.html,
source=http://flickr.com/authorname/sunset.jpg,
]
% Calls "placefigure" and "externalfigure" using the setup parameters.
InsertPhotograph
% ...
stoptext
Then the InsertPhotograph
macro could be used to customize how the photograph is typeset, independently of the layout.
Code
So far, I have the following code:
setupalign[hz,tolerant,]
setuphead[chapter][footer=empty,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
]
setuphead[chapter,section,subsection][header=none,number=no,]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[width=hsize,]
definecolumnset[BookColumns][n=2]
definecolumnsetspan[BookColumnSpan][n=2]
starttext
startchapter[title=Chapter One]
page
startcolumnset[BookColumns]
startsection[title=Section One]
% This could be InsertPhotograph instead of placefigure...
placefigure[tblr]{}{externalfigure[fake][]}
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{4} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsection
startsection[title=Section Two]
dorecurse{4} { input knuth }
stopsection
stopcolumnset
stopchapter
stoptext
Question
How can the photograph float to the left of the section title when a figure is present, whilst the section title spans the page when no figure is present?
floats titles context context-mkiv
Background
Regarding floats in columns, the wiki states:
By default, a title will be moved down to appear below a float, it will not be "wrapped" around a float like normal text.
Problem
The section title disappears, instead of being moved below the float. Ultimately, I'm trying to produce the following two layouts without changing the content (between starttext
and stoptext
):
As an aside, it is important that the content need not change as there are other layouts that use the same document structure. If content changes can be made universal such that the other layouts remain unaffected, for example by adding a new namespace and command, then that will work. This might resemble:
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% ...
starttext
setupInsertPhotograph[
author=Full Name,
homepage=http://authorname.com/about.html,
source=http://flickr.com/authorname/sunset.jpg,
]
% Calls "placefigure" and "externalfigure" using the setup parameters.
InsertPhotograph
% ...
stoptext
Then the InsertPhotograph
macro could be used to customize how the photograph is typeset, independently of the layout.
Code
So far, I have the following code:
setupalign[hz,tolerant,]
setuphead[chapter][footer=empty,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
]
setuphead[chapter,section,subsection][header=none,number=no,]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[width=hsize,]
definecolumnset[BookColumns][n=2]
definecolumnsetspan[BookColumnSpan][n=2]
starttext
startchapter[title=Chapter One]
page
startcolumnset[BookColumns]
startsection[title=Section One]
% This could be InsertPhotograph instead of placefigure...
placefigure[tblr]{}{externalfigure[fake][]}
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{4} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsection
startsection[title=Section Two]
dorecurse{4} { input knuth }
stopsection
stopcolumnset
stopchapter
stoptext
Question
How can the photograph float to the left of the section title when a figure is present, whilst the section title spans the page when no figure is present?
floats titles context context-mkiv
floats titles context context-mkiv
edited Feb 14 '14 at 9:52
Dave Jarvis
asked Feb 14 '14 at 4:57
Dave JarvisDave Jarvis
4,64184084
4,64184084
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Here I present a solution which uses the second optional argument of the
sectioning commands.
The values can be retrieved with the command
structureuservariable
. First, a custom head alternative is defined which
checks if the figure
key is present. If it is, it includes the figure and
the section head, otherwise only the section head is included. Then the section head is set up to use the custom head alternative.
setupexternalfigures
[location=default]
defineframed
[headframe]
[width=textwidth,
frame=off]
defineheadalternative
[graphiccolumn]
[renderingsetup=graphiccolumn]
startsetups [graphiccolumn]
headsetupspacing
doifsomethingelse
{structureuservariable{figure}}
{headframe
{externalfigure[structureuservariable{figure}]hfill
headnumbercontentspaceheadtextcontent}}
{headnumbercontentspaceheadtextcontent}
stopsetups
setuphead
[section]
[alternative=graphiccolumn]
starttext
startsection [title=Alpha] [figure=cow]
input ward
stopsection
startsection [title=Beta]
input ward
stopsection
startsection [title=Gamma] [figure=hacker]
input ward
stopsection
stoptext
add a comment |
Creating a custom section to indicate when a photograph is present (sectionpicture
) allows for that section to be wrapped in a two-column mode and its title made empty
. This preserves the structure of the document allowing for a wide variety of layout possibilities.
It might also be possible to use:
deftrueref{true}
startsection[title=Section One][picture=trueref]
Photograph
% ...
stopsection
However, I could not get that approach to work. Instead, the code following the preview almost produces the correct result.
Preview:
Code:
setuppapersize[letter][letter]
setuplayout[width=fit,]
setupalign[hz,tolerant,]
setuphead[chapter,section,subsection][header=none,number=no,]
setuphead[chapter][footer=empty,after=page,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
page=no,
]
setuphead[subsection][
beforesection={startmixedcolumns[n=2,balance=no,]},
aftersection={stopmixedcolumns},
page=no,
]
definehead[sectionpicture][section][
placehead=empty,
before={startcolumns[n=2,]},
after={vskip-1em},
]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[
width=hsize,
location={none,left,high},
]
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% Define parameters within the Photograph namespace.
setupPhotograph[
author=,
homepage=,
source=,
% Pass along the current section title into the Photograph macro.
sectiontitle={namedstructurevariable{section}{title}},
attribution=photo:,
cite={%
Word{Photographparameter{attribution}} %
Photographparameter{author}},
]
setupcaptions[location=,]
definefloat[photograph][photographs][figure]
showframe
% Defines how the photograph is used.
defPhotograph{%
placephotograph[top,left,force]{}{externalfigure[fake][]}
columnbreak
{switchtobodyfont[24pt]Photographparameter{sectiontitle}} par \
Photographparameter{cite}
stopcolumns
}
starttext
startchapter[title=Chapter One]
startsectionpicture[title=Section One]
Photograph
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsectionpicture
startsection[title=Section Two]
startsubsection[title=Subsection]
input knuth
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour CO$_2$ into beaker. stopitem }
stopPreparation
stopsubsection
stopsection
stopchapter
stoptext
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f160376%2fcontext-columnar-section-titles-floats-and-images%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here I present a solution which uses the second optional argument of the
sectioning commands.
The values can be retrieved with the command
structureuservariable
. First, a custom head alternative is defined which
checks if the figure
key is present. If it is, it includes the figure and
the section head, otherwise only the section head is included. Then the section head is set up to use the custom head alternative.
setupexternalfigures
[location=default]
defineframed
[headframe]
[width=textwidth,
frame=off]
defineheadalternative
[graphiccolumn]
[renderingsetup=graphiccolumn]
startsetups [graphiccolumn]
headsetupspacing
doifsomethingelse
{structureuservariable{figure}}
{headframe
{externalfigure[structureuservariable{figure}]hfill
headnumbercontentspaceheadtextcontent}}
{headnumbercontentspaceheadtextcontent}
stopsetups
setuphead
[section]
[alternative=graphiccolumn]
starttext
startsection [title=Alpha] [figure=cow]
input ward
stopsection
startsection [title=Beta]
input ward
stopsection
startsection [title=Gamma] [figure=hacker]
input ward
stopsection
stoptext
add a comment |
Here I present a solution which uses the second optional argument of the
sectioning commands.
The values can be retrieved with the command
structureuservariable
. First, a custom head alternative is defined which
checks if the figure
key is present. If it is, it includes the figure and
the section head, otherwise only the section head is included. Then the section head is set up to use the custom head alternative.
setupexternalfigures
[location=default]
defineframed
[headframe]
[width=textwidth,
frame=off]
defineheadalternative
[graphiccolumn]
[renderingsetup=graphiccolumn]
startsetups [graphiccolumn]
headsetupspacing
doifsomethingelse
{structureuservariable{figure}}
{headframe
{externalfigure[structureuservariable{figure}]hfill
headnumbercontentspaceheadtextcontent}}
{headnumbercontentspaceheadtextcontent}
stopsetups
setuphead
[section]
[alternative=graphiccolumn]
starttext
startsection [title=Alpha] [figure=cow]
input ward
stopsection
startsection [title=Beta]
input ward
stopsection
startsection [title=Gamma] [figure=hacker]
input ward
stopsection
stoptext
add a comment |
Here I present a solution which uses the second optional argument of the
sectioning commands.
The values can be retrieved with the command
structureuservariable
. First, a custom head alternative is defined which
checks if the figure
key is present. If it is, it includes the figure and
the section head, otherwise only the section head is included. Then the section head is set up to use the custom head alternative.
setupexternalfigures
[location=default]
defineframed
[headframe]
[width=textwidth,
frame=off]
defineheadalternative
[graphiccolumn]
[renderingsetup=graphiccolumn]
startsetups [graphiccolumn]
headsetupspacing
doifsomethingelse
{structureuservariable{figure}}
{headframe
{externalfigure[structureuservariable{figure}]hfill
headnumbercontentspaceheadtextcontent}}
{headnumbercontentspaceheadtextcontent}
stopsetups
setuphead
[section]
[alternative=graphiccolumn]
starttext
startsection [title=Alpha] [figure=cow]
input ward
stopsection
startsection [title=Beta]
input ward
stopsection
startsection [title=Gamma] [figure=hacker]
input ward
stopsection
stoptext
Here I present a solution which uses the second optional argument of the
sectioning commands.
The values can be retrieved with the command
structureuservariable
. First, a custom head alternative is defined which
checks if the figure
key is present. If it is, it includes the figure and
the section head, otherwise only the section head is included. Then the section head is set up to use the custom head alternative.
setupexternalfigures
[location=default]
defineframed
[headframe]
[width=textwidth,
frame=off]
defineheadalternative
[graphiccolumn]
[renderingsetup=graphiccolumn]
startsetups [graphiccolumn]
headsetupspacing
doifsomethingelse
{structureuservariable{figure}}
{headframe
{externalfigure[structureuservariable{figure}]hfill
headnumbercontentspaceheadtextcontent}}
{headnumbercontentspaceheadtextcontent}
stopsetups
setuphead
[section]
[alternative=graphiccolumn]
starttext
startsection [title=Alpha] [figure=cow]
input ward
stopsection
startsection [title=Beta]
input ward
stopsection
startsection [title=Gamma] [figure=hacker]
input ward
stopsection
stoptext
answered Feb 14 '14 at 10:08
MarcoMarco
24.2k26999
24.2k26999
add a comment |
add a comment |
Creating a custom section to indicate when a photograph is present (sectionpicture
) allows for that section to be wrapped in a two-column mode and its title made empty
. This preserves the structure of the document allowing for a wide variety of layout possibilities.
It might also be possible to use:
deftrueref{true}
startsection[title=Section One][picture=trueref]
Photograph
% ...
stopsection
However, I could not get that approach to work. Instead, the code following the preview almost produces the correct result.
Preview:
Code:
setuppapersize[letter][letter]
setuplayout[width=fit,]
setupalign[hz,tolerant,]
setuphead[chapter,section,subsection][header=none,number=no,]
setuphead[chapter][footer=empty,after=page,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
page=no,
]
setuphead[subsection][
beforesection={startmixedcolumns[n=2,balance=no,]},
aftersection={stopmixedcolumns},
page=no,
]
definehead[sectionpicture][section][
placehead=empty,
before={startcolumns[n=2,]},
after={vskip-1em},
]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[
width=hsize,
location={none,left,high},
]
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% Define parameters within the Photograph namespace.
setupPhotograph[
author=,
homepage=,
source=,
% Pass along the current section title into the Photograph macro.
sectiontitle={namedstructurevariable{section}{title}},
attribution=photo:,
cite={%
Word{Photographparameter{attribution}} %
Photographparameter{author}},
]
setupcaptions[location=,]
definefloat[photograph][photographs][figure]
showframe
% Defines how the photograph is used.
defPhotograph{%
placephotograph[top,left,force]{}{externalfigure[fake][]}
columnbreak
{switchtobodyfont[24pt]Photographparameter{sectiontitle}} par \
Photographparameter{cite}
stopcolumns
}
starttext
startchapter[title=Chapter One]
startsectionpicture[title=Section One]
Photograph
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsectionpicture
startsection[title=Section Two]
startsubsection[title=Subsection]
input knuth
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour CO$_2$ into beaker. stopitem }
stopPreparation
stopsubsection
stopsection
stopchapter
stoptext
add a comment |
Creating a custom section to indicate when a photograph is present (sectionpicture
) allows for that section to be wrapped in a two-column mode and its title made empty
. This preserves the structure of the document allowing for a wide variety of layout possibilities.
It might also be possible to use:
deftrueref{true}
startsection[title=Section One][picture=trueref]
Photograph
% ...
stopsection
However, I could not get that approach to work. Instead, the code following the preview almost produces the correct result.
Preview:
Code:
setuppapersize[letter][letter]
setuplayout[width=fit,]
setupalign[hz,tolerant,]
setuphead[chapter,section,subsection][header=none,number=no,]
setuphead[chapter][footer=empty,after=page,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
page=no,
]
setuphead[subsection][
beforesection={startmixedcolumns[n=2,balance=no,]},
aftersection={stopmixedcolumns},
page=no,
]
definehead[sectionpicture][section][
placehead=empty,
before={startcolumns[n=2,]},
after={vskip-1em},
]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[
width=hsize,
location={none,left,high},
]
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% Define parameters within the Photograph namespace.
setupPhotograph[
author=,
homepage=,
source=,
% Pass along the current section title into the Photograph macro.
sectiontitle={namedstructurevariable{section}{title}},
attribution=photo:,
cite={%
Word{Photographparameter{attribution}} %
Photographparameter{author}},
]
setupcaptions[location=,]
definefloat[photograph][photographs][figure]
showframe
% Defines how the photograph is used.
defPhotograph{%
placephotograph[top,left,force]{}{externalfigure[fake][]}
columnbreak
{switchtobodyfont[24pt]Photographparameter{sectiontitle}} par \
Photographparameter{cite}
stopcolumns
}
starttext
startchapter[title=Chapter One]
startsectionpicture[title=Section One]
Photograph
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsectionpicture
startsection[title=Section Two]
startsubsection[title=Subsection]
input knuth
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour CO$_2$ into beaker. stopitem }
stopPreparation
stopsubsection
stopsection
stopchapter
stoptext
add a comment |
Creating a custom section to indicate when a photograph is present (sectionpicture
) allows for that section to be wrapped in a two-column mode and its title made empty
. This preserves the structure of the document allowing for a wide variety of layout possibilities.
It might also be possible to use:
deftrueref{true}
startsection[title=Section One][picture=trueref]
Photograph
% ...
stopsection
However, I could not get that approach to work. Instead, the code following the preview almost produces the correct result.
Preview:
Code:
setuppapersize[letter][letter]
setuplayout[width=fit,]
setupalign[hz,tolerant,]
setuphead[chapter,section,subsection][header=none,number=no,]
setuphead[chapter][footer=empty,after=page,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
page=no,
]
setuphead[subsection][
beforesection={startmixedcolumns[n=2,balance=no,]},
aftersection={stopmixedcolumns},
page=no,
]
definehead[sectionpicture][section][
placehead=empty,
before={startcolumns[n=2,]},
after={vskip-1em},
]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[
width=hsize,
location={none,left,high},
]
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% Define parameters within the Photograph namespace.
setupPhotograph[
author=,
homepage=,
source=,
% Pass along the current section title into the Photograph macro.
sectiontitle={namedstructurevariable{section}{title}},
attribution=photo:,
cite={%
Word{Photographparameter{attribution}} %
Photographparameter{author}},
]
setupcaptions[location=,]
definefloat[photograph][photographs][figure]
showframe
% Defines how the photograph is used.
defPhotograph{%
placephotograph[top,left,force]{}{externalfigure[fake][]}
columnbreak
{switchtobodyfont[24pt]Photographparameter{sectiontitle}} par \
Photographparameter{cite}
stopcolumns
}
starttext
startchapter[title=Chapter One]
startsectionpicture[title=Section One]
Photograph
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsectionpicture
startsection[title=Section Two]
startsubsection[title=Subsection]
input knuth
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour CO$_2$ into beaker. stopitem }
stopPreparation
stopsubsection
stopsection
stopchapter
stoptext
Creating a custom section to indicate when a photograph is present (sectionpicture
) allows for that section to be wrapped in a two-column mode and its title made empty
. This preserves the structure of the document allowing for a wide variety of layout possibilities.
It might also be possible to use:
deftrueref{true}
startsection[title=Section One][picture=trueref]
Photograph
% ...
stopsection
However, I could not get that approach to work. Instead, the code following the preview almost produces the correct result.
Preview:
Code:
setuppapersize[letter][letter]
setuplayout[width=fit,]
setupalign[hz,tolerant,]
setuphead[chapter,section,subsection][header=none,number=no,]
setuphead[chapter][footer=empty,after=page,]
setuphead[section][page=yes,]
setuphead[subsection][
before={vskip0.5em},
after={vskip0.5em},
page=no,
]
setuphead[subsection][
beforesection={startmixedcolumns[n=2,balance=no,]},
aftersection={stopmixedcolumns},
page=no,
]
definehead[sectionpicture][section][
placehead=empty,
before={startcolumns[n=2,]},
after={vskip-1em},
]
defineitemgroup[Preparation]
setupitemgroup[Preparation][each][packed][
before={empty},
]
setupexternalfigures[
width=hsize,
location={none,left,high},
]
definenamespace[Photograph][
type=module,
name=Photograph,
parent=Photograph,
setup=list,
version=1.0,
style=yes,
command=list,
]
% Define parameters within the Photograph namespace.
setupPhotograph[
author=,
homepage=,
source=,
% Pass along the current section title into the Photograph macro.
sectiontitle={namedstructurevariable{section}{title}},
attribution=photo:,
cite={%
Word{Photographparameter{attribution}} %
Photographparameter{author}},
]
setupcaptions[location=,]
definefloat[photograph][photographs][figure]
showframe
% Defines how the photograph is used.
defPhotograph{%
placephotograph[top,left,force]{}{externalfigure[fake][]}
columnbreak
{switchtobodyfont[24pt]Photographparameter{sectiontitle}} par \
Photographparameter{cite}
stopcolumns
}
starttext
startchapter[title=Chapter One]
startsectionpicture[title=Section One]
Photograph
startsubsection[title=Subsection]
input douglas
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour liquid helium into flask. stopitem }
stopPreparation
stopsubsection
stopsectionpicture
startsection[title=Section Two]
startsubsection[title=Subsection]
input knuth
stopsubsection
startsubsection[title=Preparation]
startPreparation
dorecurse{3} { startitem Pour CO$_2$ into beaker. stopitem }
stopPreparation
stopsubsection
stopsection
stopchapter
stoptext
edited 22 hours ago
answered Feb 15 '14 at 2:12
Dave JarvisDave Jarvis
4,64184084
4,64184084
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f160376%2fcontext-columnar-section-titles-floats-and-images%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown