ConTeXt: uniform line height











up vote
0
down vote

favorite












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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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:



columns after



Or like this:



before-after (non-column)



In retrospect I have no problem implementing a simpler approach:



define[1]headinghmode{%
bfcsetupinterlinespacestrut#1%
}

define[1]subheadinghmode{%
bfasetupinterlinespacestrut#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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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{%
...
ifrelaxdetokenize{#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.7ht0 depth 0.3ht0 width 1ptsubheading{...}


Though I'm curious how my two exceptions manage to work, the simpler approach is best.










share|improve this question




















  • 2




    How about just using grid typesetting?
    – Henri Menke
    Dec 7 at 8:04










  • @HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
    – user19087
    Dec 10 at 1:31















up vote
0
down vote

favorite












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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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:



columns after



Or like this:



before-after (non-column)



In retrospect I have no problem implementing a simpler approach:



define[1]headinghmode{%
bfcsetupinterlinespacestrut#1%
}

define[1]subheadinghmode{%
bfasetupinterlinespacestrut#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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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{%
...
ifrelaxdetokenize{#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.7ht0 depth 0.3ht0 width 1ptsubheading{...}


Though I'm curious how my two exceptions manage to work, the simpler approach is best.










share|improve this question




















  • 2




    How about just using grid typesetting?
    – Henri Menke
    Dec 7 at 8:04










  • @HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
    – user19087
    Dec 10 at 1:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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:



columns after



Or like this:



before-after (non-column)



In retrospect I have no problem implementing a simpler approach:



define[1]headinghmode{%
bfcsetupinterlinespacestrut#1%
}

define[1]subheadinghmode{%
bfasetupinterlinespacestrut#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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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{%
...
ifrelaxdetokenize{#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.7ht0 depth 0.3ht0 width 1ptsubheading{...}


Though I'm curious how my two exceptions manage to work, the simpler approach is best.










share|improve this question















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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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:



columns after



Or like this:



before-after (non-column)



In retrospect I have no problem implementing a simpler approach:



define[1]headinghmode{%
bfcsetupinterlinespacestrut#1%
}

define[1]subheadinghmode{%
bfasetupinterlinespacestrut#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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#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{%
...
ifrelaxdetokenize{#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.7ht0 depth 0.3ht0 width 1ptsubheading{...}


Though I'm curious how my two exceptions manage to work, the simpler approach is best.







context line-spacing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked Dec 6 at 21:25









user19087

2316




2316








  • 2




    How about just using grid typesetting?
    – Henri Menke
    Dec 7 at 8:04










  • @HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
    – user19087
    Dec 10 at 1:31














  • 2




    How about just using grid typesetting?
    – Henri Menke
    Dec 7 at 8:04










  • @HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
    – user19087
    Dec 10 at 1:31








2




2




How about just using grid typesetting?
– Henri Menke
Dec 7 at 8:04




How about just using grid typesetting?
– Henri Menke
Dec 7 at 8:04












@HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
– user19087
Dec 10 at 1:31




@HenriMenke I looked into "It's in the Details" and I couldn't find any information on enabling grid typesetting for select elements. I don't want grid typesetting enabled for the entire document as it would ruin inter-paragraph and itemgroup spacing.
– user19087
Dec 10 at 1:31










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










If you want the exact same spacing in the margin block as in the main vertical list, then you have to “simulate” a page in the margin. What do I mean by this? The content in the margin is typeset in a vbox at natural height. This means that vertical glue has neither be stretched nor shrunk, whereas the main vertical list is constrained by vsize. Thus, to simulate the main vertical list in the margin you have to wrap its contents in vbox to textheight {...strutparvfill}. The strut ensures that the last line has strut depth, par switches to vertical mode, and vfill fills up the box to the bottom if the content is shorter than textheight.



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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#1}%
blank[small,samepage]%
}

showframe

starttext
startmarginblock
vbox to textheight {
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}
% fill up the box
strutparvfill
}
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


enter image description here






share|improve this answer





















  • How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
    – user19087
    Dec 11 at 4:23










  • @user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
    – Henri Menke
    Dec 11 at 4:28












  • That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
    – user19087
    2 days ago










  • I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
    – user19087
    2 days ago












  • By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
    – user19087
    2 days ago











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463594%2fcontext-uniform-line-height%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










If you want the exact same spacing in the margin block as in the main vertical list, then you have to “simulate” a page in the margin. What do I mean by this? The content in the margin is typeset in a vbox at natural height. This means that vertical glue has neither be stretched nor shrunk, whereas the main vertical list is constrained by vsize. Thus, to simulate the main vertical list in the margin you have to wrap its contents in vbox to textheight {...strutparvfill}. The strut ensures that the last line has strut depth, par switches to vertical mode, and vfill fills up the box to the bottom if the content is shorter than textheight.



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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#1}%
blank[small,samepage]%
}

showframe

starttext
startmarginblock
vbox to textheight {
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}
% fill up the box
strutparvfill
}
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


enter image description here






share|improve this answer





















  • How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
    – user19087
    Dec 11 at 4:23










  • @user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
    – Henri Menke
    Dec 11 at 4:28












  • That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
    – user19087
    2 days ago










  • I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
    – user19087
    2 days ago












  • By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
    – user19087
    2 days ago















up vote
3
down vote



accepted










If you want the exact same spacing in the margin block as in the main vertical list, then you have to “simulate” a page in the margin. What do I mean by this? The content in the margin is typeset in a vbox at natural height. This means that vertical glue has neither be stretched nor shrunk, whereas the main vertical list is constrained by vsize. Thus, to simulate the main vertical list in the margin you have to wrap its contents in vbox to textheight {...strutparvfill}. The strut ensures that the last line has strut depth, par switches to vertical mode, and vfill fills up the box to the bottom if the content is shorter than textheight.



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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#1}%
blank[small,samepage]%
}

showframe

starttext
startmarginblock
vbox to textheight {
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}
% fill up the box
strutparvfill
}
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


enter image description here






share|improve this answer





















  • How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
    – user19087
    Dec 11 at 4:23










  • @user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
    – Henri Menke
    Dec 11 at 4:28












  • That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
    – user19087
    2 days ago










  • I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
    – user19087
    2 days ago












  • By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
    – user19087
    2 days ago













up vote
3
down vote



accepted







up vote
3
down vote



accepted






If you want the exact same spacing in the margin block as in the main vertical list, then you have to “simulate” a page in the margin. What do I mean by this? The content in the margin is typeset in a vbox at natural height. This means that vertical glue has neither be stretched nor shrunk, whereas the main vertical list is constrained by vsize. Thus, to simulate the main vertical list in the margin you have to wrap its contents in vbox to textheight {...strutparvfill}. The strut ensures that the last line has strut depth, par switches to vertical mode, and vfill fills up the box to the bottom if the content is shorter than textheight.



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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#1}%
blank[small,samepage]%
}

showframe

starttext
startmarginblock
vbox to textheight {
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}
% fill up the box
strutparvfill
}
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


enter image description here






share|improve this answer












If you want the exact same spacing in the margin block as in the main vertical list, then you have to “simulate” a page in the margin. What do I mean by this? The content in the margin is typeset in a vbox at natural height. This means that vertical glue has neither be stretched nor shrunk, whereas the main vertical list is constrained by vsize. Thus, to simulate the main vertical list in the margin you have to wrap its contents in vbox to textheight {...strutparvfill}. The strut ensures that the last line has strut depth, par switches to vertical mode, and vfill fills up the box to the bottom if the content is shorter than textheight.



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{bfcsetupinterlinespacestrut#1}%
blank[big,samepage]%
}

define[1]subheading{%
dontleavehmode{bfasetupinterlinespacestrut#1}%
blank[small,samepage]%
}

showframe

starttext
startmarginblock
vbox to textheight {
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}
% fill up the box
strutparvfill
}
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


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 11 at 3:13









Henri Menke

68.9k7153257




68.9k7153257












  • How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
    – user19087
    Dec 11 at 4:23










  • @user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
    – Henri Menke
    Dec 11 at 4:28












  • That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
    – user19087
    2 days ago










  • I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
    – user19087
    2 days ago












  • By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
    – user19087
    2 days ago


















  • How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
    – user19087
    Dec 11 at 4:23










  • @user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
    – Henri Menke
    Dec 11 at 4:28












  • That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
    – user19087
    2 days ago










  • I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
    – user19087
    2 days ago












  • By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
    – user19087
    2 days ago
















How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
– user19087
Dec 11 at 4:23




How do I replace heading{Left 1} with subheading{Left 1} without changing the vertical whitespace of that specific line?
– user19087
Dec 11 at 4:23












@user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
– Henri Menke
Dec 11 at 4:28






@user19087 By using subheading{{bfcsetupinterlinespacestrut}Left 1}.
– Henri Menke
Dec 11 at 4:28














That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
– user19087
2 days ago




That uses blank from subheading rather than heading - I literally want to make the "Left 1" text the size of a subheading without changing any vertical whitespace, either before or after. That also requires synchronizing with the definition of heading.
– user19087
2 days ago












I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
– user19087
2 days ago






I've tried many combinations of heading and subheading with blank[back] or blank[disable] (these two either introduce much more vertical space before the heading, or discard only the smaller blank) and strut and even ifxrelaxdetokenize{#1}relax {} else blank[small,samepage] fi... but it turns out all along the solution is heading{subheading{Left 1}}, which makes no sense! Why are the adjacent blanks collapsed? Adjacent vskips don't behave this way at all - they're added, not collapsed. (this was my main question actually)
– user19087
2 days ago














By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
– user19087
2 days ago




By the way very nice solution, I extended it to: definestartstop[marginpage][before={startmarginblockvbox to textheightbgroup},after={strutparvfillegroupstopmarginblock}]
– user19087
2 days ago


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463594%2fcontext-uniform-line-height%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?