Returning to this example, I would like to change the "Left 1" \heading
to a \subheading
while keeping the two "Left 1", "Right 1" headings vertically lined-up. And assuming ConTeXt: uniform handling of whitespace in margin and text is solved, also keeping the subsequent paragraphs aligned. I've been playing around with vertical \heading
struts to no avail, but perhaps line correction could also work. Though not clear, the documentation suggests it 'snaps' its argument to the nearest baseline.
\setuppapersize[letter]
\setupwhitespace[medium]
\setuplayout
[backspace=4.375in,
width=3.625in,
leftmargin=3.625in,
rightmargin=0in,
leftmargindistance=0.25in,
%
topspace=0.25in,
height=10.5in,
header=0.25in,
headerdistance=0.25in,
footer=0.25in,
footerdistance=0.25in,
]
\setupmarginblock
[location=left,
width=\leftmarginwidth,
]
\define[1]\heading{%
\dontleavehmode{\bfc\setupinterlinespace\strut#1}%
\blank[big,samepage]%
}
\define[1]\subheading{%
\dontleavehmode{\bfa\setupinterlinespace\strut#1}%
\blank[small,samepage]%
}
\showframe
%\showallmakeup
\starttext
\startmarginblock
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{ward}
\stopmarginblock
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{ward}
\stoptext
Edit:
I was trying to achieve something like this:
Or like this:
In retrospect I have no problem implementing a simpler approach:
\define[1]\headinghmode{%
\bfc\setupinterlinespace\strut#1%
}
\define[1]\subheadinghmode{%
\bfa\setupinterlinespace\strut#1%
}
\define[1]\heading{%
\dontleavehmode{\headinghmode{#1}}%
\blank[big,samepage]%
}
\define[1]\subheading{%
\dontleavehmode{\subheadinghmode{#1}}%
\blank[small,samepage]%
}
And using it like:
\heading{\subheadinghmode{Interlude}}
Before I was trying to avoid any reuse of my original (see above) heading definitions. For example I would insert either \blank[back]
or \blank[disable]
in all possible locations of the following lines, where ...
represents non-TeX text:
\heading{}\subheading{...}
\heading{\subheading{...}
\subheading{\heading{}...}
For example:
\heading{\blank[back]}\subheading{...}
\heading{}\blank[back]\subheading{...}
\heading{}\subheading{\blank[back]...}
\heading{}\subheading{...\blank[back]}
\heading{}\subheading{...}\blank[back]
\blank[disable]\heading{}\subheading{...}
...
\heading{}\subheading{...\blank[disable]}
\heading{\blank[back]\subheading{...}}
...
\heading{\subheading{...}\blank[disable]}
\subheading{\heading{}\blank[back]...}
...
\subheading{\heading{}...}\blank[disable]
Now this (mostly) didn't work, probably because they're stacked vertically outside of h-mode. That's fine because who wants to remember to place that extra \blank[back]
or \blank[disable]
? That said I did test them all because accidentally I came across one that works, but only in a margin block (first picture):
\setuppapersize[letter]
\setupwhitespace[medium]
\setuplayout
[backspace=4.375in,
width=3.625in,
leftmargin=3.625in,
rightmargin=0in,
leftmargindistance=0.25in,
%
topspace=0.25in,
height=10.5in,
header=0.25in,
headerdistance=0.25in,
footer=0.25in,
footerdistance=0.25in,
]
\showframe
\setupmarginblock
[location=left,
width=\leftmarginwidth,
]
\define[1]\heading{%
\dontleavehmode{\bfc\setupinterlinespace\strut#1}%
\blank[big,samepage]%
}
\define[1]\subheading{%
\dontleavehmode{\bfa\setupinterlinespace\strut#1}%
\blank[small,samepage]%
}
\starttext
\startmarginblock
%\heading{Left 1}
\heading{\subheading{Left 1}}
\samplefile{ward}
\stopmarginblock
\heading{Right 1}
\samplefile{ward}
\stoptext
That makes no sense... Why would this work, and only in a margin block?
\heading{\subheading{...}}
Anyway of all possible combinations I tested this is the only other one to work, and in either the main text or the margin:
\heading{\subheading{...\blank[back]}}
I don't understand, given all the other possible and likely combinations, why only that worked.
I also tried some even more extreme approaches. This one can't work without a second "disable \blank
" parameter, and I didn't feel like digging through ConTeXt to figure out how to implement optional parameters:
\define[1]\heading{%
...
\if\relax\detokenize{#1}\relax \else \blank[big,samepage] \fi%
}
And this one can't reproduce the vertical position of the heading, but the before/after whitespace should remain unchanged. Something's not working:
\heading{...}
\setbox0=\vbox{\heading{...}}
\vrule height 0.7\ht0 depth 0.3\ht0 width 1pt\subheading{...}
Though I'm curious how my two exceptions manage to work, the simpler approach is best.