Alignments of margin notes
Hi, I want to make a two sided document with margin notes. The notes should not be hyphenated and always aligned to the inner text body. However, I did not get this to work. It hyphenates and the alignment is only correct at even pages. Do you know the correct way? Here is a MWE: ``` \setuppagenumbering[location={footer, right}, alternative=doublesided] \definealign[myalign][inner, nothyphenated] \setupmargindata[inmargin][ location=outer, style=italic, % nothing of that seems to have any effect % align=myalign, % align=inner, % align=nothyphentated, align={inner, nothyphentated}, ] \starttext \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \stoptext ``` Best, Gerion
Hi, Something seems wrong with the align processing inside \setupmargindata, because using a macro like \def\Inmargin#1{\inmargin{\blank[-line]\startalignment[inner,nothyphenated]#1\stopalignment}} works ok (the \blank[-line] is a side-effect of using the environment inside a margin text). Best, Taco
On 1 Aug 2024, at 14:28, Gerion Entrup
wrote: Hi,
I want to make a two sided document with margin notes. The notes should not be hyphenated and always aligned to the inner text body. However, I did not get this to work. It hyphenates and the alignment is only correct at even pages.
Do you know the correct way?
Here is a MWE: ``` \setuppagenumbering[location={footer, right}, alternative=doublesided]
\definealign[myalign][inner, nothyphenated] \setupmargindata[inmargin][ location=outer, style=italic, % nothing of that seems to have any effect % align=myalign, % align=inner, % align=nothyphentated, align={inner, nothyphentated}, ]
\starttext
\inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth
\stoptext ```
Best, Gerion___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
— Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)
Am 01.08.24 um 14:50 schrieb Taco Hoekwater:
Something seems wrong with the align processing inside \setupmargindata, because using a macro like
I also got the impression that something must be wrong from my experiments with inmargin captions (see my architectural guides article in the current journal) but couldn’t yet make a minimal example. E.g. I needed \outermarginwidth for inner margin, the vertical placement is irregular, and I couldn’t always get the alignment that I wanted. Hraban
On 8/1/2024 2:50 PM, Taco Hoekwater wrote:
Hi,
Something seems wrong with the align processing inside \setupmargindata, because using a macro like
\def\Inmargin#1{\inmargin{\blank[-line]\startalignment[inner,nothyphenated]#1\stopalignment}}
works ok (the \blank[-line] is a side-effect of using the environment inside a margin text). can you test with
\permanent\protected\tolerant\def\definealign[#1]#*[#2]% {\pushmacro\raggedcommand \pushmacro\updateraggedskips \edef\m_spac_align_named{#1}% \edef\m_spac_align_asked{#2}% \spac_align_add_to_cache \popmacro\updateraggedskips \popmacro\raggedcommand} (in cont-new.mkxl after \unprotect) 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 -----------------------------------------------------------------
Am Donnerstag, 1. August 2024, 15:36:57 MESZ schrieb Hans Hagen:
On 8/1/2024 2:50 PM, Taco Hoekwater wrote:
Hi,
Something seems wrong with the align processing inside \setupmargindata, because using a macro like
\def\Inmargin#1{\inmargin{\blank[-line]\startalignment[inner,nothyphenated]#1\stopalignment}}
works ok (the \blank[-line] is a side-effect of using the environment inside a margin text). can you test with
\permanent\protected\tolerant\def\definealign[#1]#*[#2]% {\pushmacro\raggedcommand \pushmacro\updateraggedskips \edef\m_spac_align_named{#1}% \edef\m_spac_align_asked{#2}% \spac_align_add_to_cache \popmacro\updateraggedskips \popmacro\raggedcommand}
(in cont-new.mkxl after \unprotect)
I see no visible change for my minimal example with that. Gerion
Gerion Entrup schrieb am 01.08.2024 um 14:28:
Hi,
I want to make a two sided document with margin notes. The notes should not be hyphenated and always aligned to the inner text body. However, I did not get this to work. It hyphenates and the alignment is only correct at even pages.
Do you know the correct way?
Here is a MWE: ``` \setuppagenumbering[location={footer, right}, alternative=doublesided]
\definealign[myalign][inner, nothyphenated] \setupmargindata[inmargin][ location=outer, style=italic, % nothing of that seems to have any effect % align=myalign, % align=inner, % align=nothyphentated, align={inner, nothyphentated}, ]
Use \setupmarginframed for the alignment. \setupmarginframed [inmargin] [align={inner,nothyphenated}] Wolfgang
Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster:
Gerion Entrup schrieb am 01.08.2024 um 14:28:
Hi,
I want to make a two sided document with margin notes. The notes should not be hyphenated and always aligned to the inner text body. However, I did not get this to work. It hyphenates and the alignment is only correct at even pages.
Do you know the correct way?
Here is a MWE: ``` \setuppagenumbering[location={footer, right}, alternative=doublesided]
\definealign[myalign][inner, nothyphenated] \setupmargindata[inmargin][ location=outer, style=italic, % nothing of that seems to have any effect % align=myalign, % align=inner, % align=nothyphentated, align={inner, nothyphentated}, ]
Use \setupmarginframed for the alignment.
\setupmarginframed [inmargin] [align={inner,nothyphenated}]
Does the align parameter of \setupmargindata has any function, then? Also, using setupmarginframed leads to other problems: - The margin text is bold now(?) - All margin nodes are on the left of the page now (this should be only the case for even pages) I tested with (and Hans' patch): ``` \setuppagenumbering[location={footer, right}, alternative=doublesided] % \definealign[myalign][inner, nothyphenated] \setupmarginframed[inmargin][ location=outer, style=italic, % align=myalign, % align=inner, % align=nothyphentated, align={inner, nothyphentated}, ] \starttext \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \inmargin{significant incredible components}\input knuth \stoptext ```
Gerion Entrup schrieb am 01.08.2024 um 16:20: > Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster: >> Gerion Entrup schrieb am 01.08.2024 um 14:28: >>> Hi, >>> >>> I want to make a two sided document with margin notes. >>> The notes should not be hyphenated and always aligned to the inner text body. >>> However, I did not get this to work. >>> It hyphenates and the alignment is only correct at even pages. >>> >>> Do you know the correct way? >>> >>> Here is a MWE: >>> ``` >>> \setuppagenumbering[location={footer, right}, alternative=doublesided] >>> >>> \definealign[myalign][inner, nothyphenated] >>> \setupmargindata[inmargin][ >>> location=outer, >>> style=italic, >>> % nothing of that seems to have any effect >>> % align=myalign, >>> % align=inner, >>> % align=nothyphentated, >>> align={inner, nothyphentated}, >>> ] >> Use \setupmarginframed for the alignment. >> >> \setupmarginframed >> [inmargin] >> [align={inner,nothyphenated}] > Does the align parameter of \setupmargindata has any function, then? > Also, using setupmarginframed leads to other problems: > - The margin text is bold now(?) > - All margin nodes are on the left of the page now (this should be only the case for even pages) The location of the margin block and the style are still controlled by \setupmargindata and only the alignment has to be changed with \setupmarginframed. \setupmargindata [inmargin] [location=outer, style=italic] \setupmarginframed [inmargin] [align={inner,nothyphenated}] Wolfgang
Am Donnerstag, 1. August 2024, 16:36:06 MESZ schrieb Wolfgang Schuster: > Gerion Entrup schrieb am 01.08.2024 um 16:20: > > Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster: > >> Gerion Entrup schrieb am 01.08.2024 um 14:28: > >>> Hi, > >>> > >>> I want to make a two sided document with margin notes. > >>> The notes should not be hyphenated and always aligned to the inner text body. > >>> However, I did not get this to work. > >>> It hyphenates and the alignment is only correct at even pages. > >>> > >>> Do you know the correct way? > >>> > >>> Here is a MWE: > >>> ``` > >>> \setuppagenumbering[location={footer, right}, alternative=doublesided] > >>> > >>> \definealign[myalign][inner, nothyphenated] > >>> \setupmargindata[inmargin][ > >>> location=outer, > >>> style=italic, > >>> % nothing of that seems to have any effect > >>> % align=myalign, > >>> % align=inner, > >>> % align=nothyphentated, > >>> align={inner, nothyphentated}, > >>> ] > >> Use \setupmarginframed for the alignment. > >> > >> \setupmarginframed > >> [inmargin] > >> [align={inner,nothyphenated}] > > Does the align parameter of \setupmargindata has any function, then? > > Also, using setupmarginframed leads to other problems: > > - The margin text is bold now(?) > > - All margin nodes are on the left of the page now (this should be only the case for even pages) > > The location of the margin block and the style are still controlled by > \setupmargindata and only the alignment has to be changed with > \setupmarginframed. > > \setupmargindata > [inmargin] > [location=outer, > style=italic] > > \setupmarginframed > [inmargin] > [align={inner,nothyphenated}] Thanks, that works for the alignment. It does not change the hyphenation. I would have expected this line breaks in the margin note: significant incredible components Instead, ConTeXt generates: significant in credible com ponents In general: Does the "align" argument in setupmargindata has a meaning at all? Why is the action to setup margin notes splitted in setupmargindata and setupmarginframed? I find it kind of unintuitive. Gerion
Gerion Entrup schrieb am 01.08.2024 um 17:19: > Am Donnerstag, 1. August 2024, 16:36:06 MESZ schrieb Wolfgang Schuster: >> Gerion Entrup schrieb am 01.08.2024 um 16:20: >>> Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster: >>>> Gerion Entrup schrieb am 01.08.2024 um 14:28: >>>>> Hi, >>>>> >>>>> I want to make a two sided document with margin notes. >>>>> The notes should not be hyphenated and always aligned to the inner text body. >>>>> However, I did not get this to work. >>>>> It hyphenates and the alignment is only correct at even pages. >>>>> >>>>> Do you know the correct way? >>>>> >>>>> Here is a MWE: >>>>> ``` >>>>> \setuppagenumbering[location={footer, right}, alternative=doublesided] >>>>> >>>>> \definealign[myalign][inner, nothyphenated] >>>>> \setupmargindata[inmargin][ >>>>> location=outer, >>>>> style=italic, >>>>> % nothing of that seems to have any effect >>>>> % align=myalign, >>>>> % align=inner, >>>>> % align=nothyphentated, >>>>> align={inner, nothyphentated}, >>>>> ] >>>> Use \setupmarginframed for the alignment. >>>> >>>> \setupmarginframed >>>> [inmargin] >>>> [align={inner,nothyphenated}] >>> Does the align parameter of \setupmargindata has any function, then? >>> Also, using setupmarginframed leads to other problems: >>> - The margin text is bold now(?) >>> - All margin nodes are on the left of the page now (this should be only the case for even pages) >> The location of the margin block and the style are still controlled by >> \setupmargindata and only the alignment has to be changed with >> \setupmarginframed. >> >> \setupmargindata >> [inmargin] >> [location=outer, >> style=italic] >> >> \setupmarginframed >> [inmargin] >> [align={inner,nothyphenated}] > Thanks, that works for the alignment. It does not change the hyphenation. > I would have expected this line breaks in the margin note: > > significant > incredible > components > > Instead, ConTeXt generates: > > significant in > credible com > ponents > > In general: > Does the "align" argument in setupmargindata has a meaning at all? The align key works and the output is correct but the problem in this case is a user error. When you compare mine and your example you should notice a difference in the spelling of nothyphenated which has an extra "t" in your case. > Why is the action to setup margin notes splitted in setupmargindata and setupmarginframed? I find it kind of unintuitive. There are two different mechanism at work here: 1. The placement of the texts is controlled with the margindata mechanism has style and align options. 2. In addition to the placement mechanism some of the margin texts make use of \framed for the content. Because not all margin texts should make use \framed this is optional and controlled with an extra setup-command. The separate setup mechanism avoid also problems with keys which have a different meaning for the placement of the margin texts, e.g. location is an already existing framed-key but it is also used to set the horizontal position of the block. Wolfgang
Am Donnerstag, 1. August 2024, 17:37:21 MESZ schrieb Wolfgang Schuster: > Gerion Entrup schrieb am 01.08.2024 um 17:19: > > Am Donnerstag, 1. August 2024, 16:36:06 MESZ schrieb Wolfgang Schuster: > >> Gerion Entrup schrieb am 01.08.2024 um 16:20: > >>> Am Donnerstag, 1. August 2024, 16:13:23 MESZ schrieb Wolfgang Schuster: > >>>> Gerion Entrup schrieb am 01.08.2024 um 14:28: > >>>>> Hi, > >>>>> > >>>>> I want to make a two sided document with margin notes. > >>>>> The notes should not be hyphenated and always aligned to the inner text body. > >>>>> However, I did not get this to work. > >>>>> It hyphenates and the alignment is only correct at even pages. > >>>>> > >>>>> Do you know the correct way? > >>>>> > >>>>> Here is a MWE: > >>>>> ``` > >>>>> \setuppagenumbering[location={footer, right}, alternative=doublesided] > >>>>> > >>>>> \definealign[myalign][inner, nothyphenated] > >>>>> \setupmargindata[inmargin][ > >>>>> location=outer, > >>>>> style=italic, > >>>>> % nothing of that seems to have any effect > >>>>> % align=myalign, > >>>>> % align=inner, > >>>>> % align=nothyphentated, > >>>>> align={inner, nothyphentated}, > >>>>> ] > >>>> Use \setupmarginframed for the alignment. > >>>> > >>>> \setupmarginframed > >>>> [inmargin] > >>>> [align={inner,nothyphenated}] > >>> Does the align parameter of \setupmargindata has any function, then? > >>> Also, using setupmarginframed leads to other problems: > >>> - The margin text is bold now(?) > >>> - All margin nodes are on the left of the page now (this should be only the case for even pages) > >> The location of the margin block and the style are still controlled by > >> \setupmargindata and only the alignment has to be changed with > >> \setupmarginframed. > >> > >> \setupmargindata > >> [inmargin] > >> [location=outer, > >> style=italic] > >> > >> \setupmarginframed > >> [inmargin] > >> [align={inner,nothyphenated}] > > Thanks, that works for the alignment. It does not change the hyphenation. > > I would have expected this line breaks in the margin note: > > > > significant > > incredible > > components > > > > Instead, ConTeXt generates: > > > > significant in > > credible com > > ponents > > > > In general: > > Does the "align" argument in setupmargindata has a meaning at all? > > The align key works and the output is correct but the problem in this > case is a user error. > > When you compare mine and your example you should notice a difference in > the spelling of nothyphenated which has an extra "t" in your case. Oh, you are right, I made a typo here (I appreciate your diplomatic words ;)). > > Why is the action to setup margin notes splitted in setupmargindata and setupmarginframed? I find it kind of unintuitive. > > There are two different mechanism at work here: > > 1. The placement of the texts is controlled with the margindata > mechanism has style and align options. > > 2. In addition to the placement mechanism some of the margin texts make > use of \framed for the content. Because not all margin texts should make > use \framed this is optional and controlled with an extra setup-command. > The separate setup mechanism avoid also problems with keys which have a > different meaning for the placement of the margin texts, e.g. location > is an already existing framed-key but it is also used to set the > horizontal position of the block. Ok, I think I understand that in principal. Thanks for the explanation. Can I somehow know in advance that a margin note makes use of \framed? Gerion
On 8/2/24 01:13, Gerion Entrup wrote:
Ok, I think I understand that in principal. Thanks for the explanation. Can I somehow know in advance that a margin note makes use of \framed?
Hi Gerion, there is an \ifinframed conditional, such as in: \starttext \framed{\ifinframed a\else b\fi} \ifinframed a\else b\fi \framed{\doiftextelse{\ifinframed a\fi} {framed} {not framed}} \doiftextelse{\ifinframed a\fi} {framed} {not framed} \stoptext This may help to achieve what you want. Just in case it helps, Pablo
Am Freitag, 2. August 2024, 07:42:29 MESZ schrieb Pablo Rodriguez via ntg- context:
On 8/2/24 01:13, Gerion Entrup wrote:
Ok, I think I understand that in principal. Thanks for the explanation. Can I somehow know in advance that a margin note makes use of \framed?
Hi Gerion,
there is an \ifinframed conditional, such as in: ... This may help to achieve what you want.
Just in case it helps,
Thanks for the answer, but we misunderstood. I'll try to formulate it clearer: If I get it right, to set margin notes, you need to specify \setupmargindata in any case. However, on the one hand, there might be notes that follow the style of the "style" argument within \setupmargindata. And on the other hand, there might be notes that internally uses \framed and follow the "style" argument within a separately specified \setupmarginframed. My question is, whether I have any chance to get in advance (when writing down the document styling) which style argument my future (not yet written) margin notes will follow to know if I need to specify a \setupmarginframed at all. Is it the style argument of \setupmargindata or \setupmarginframed or is it a good practice to _always_ specify \setupmarginframed with the same style argument as given to \setupmargindata? Gerion
Gerion Entrup schrieb am 02.08.2024 um 14:10:
Am Freitag, 2. August 2024, 07:42:29 MESZ schrieb Pablo Rodriguez via ntg- context:
On 8/2/24 01:13, Gerion Entrup wrote:
Ok, I think I understand that in principal. Thanks for the explanation. Can I somehow know in advance that a margin note makes use of \framed? Hi Gerion,
there is an \ifinframed conditional, such as in: ... This may help to achieve what you want.
Just in case it helps, Thanks for the answer, but we misunderstood. I'll try to formulate it clearer: If I get it right, to set margin notes, you need to specify \setupmargindata in any case. However, on the one hand, there might be notes that follow the style of the "style" argument within \setupmargindata. And on the other hand, there might be notes that internally uses \framed and follow the "style" argument within a separately specified \setupmarginframed.
My question is, whether I have any chance to get in advance (when writing down the document styling) which style argument my future (not yet written) margin notes will follow to know if I need to specify a \setupmarginframed at all.
Is it the style argument of \setupmargindata or \setupmarginframed or is it a good practice to _always_ specify \setupmarginframed with the same style argument as given to \setupmargindata?
I have no idea what your question is but you should use \setupmarginframed only when the setup requires it, e.g. to change the alignment for blocks which use the framed mechanism. The example below shows which predefined margin blocks rely only on margindata where you can change the alignment with \etupmargindata and also the ones which require \setupmarginframed. %%%% begin example \setuppapersize[A4][A3] \setuplayout[location=middle] \starttext \doloopoverlist{ inleftmargin, inrightmargin, inoutermargin, ininnermargin, inleftedge, inrightedge, inouteredge, ininneredge, atleftmargin, atrightmargin, } { \setupmargindata[\recursestring][align=middle] \title{\tex{\recursestring}} \samplefile{lorem} \margindata[\recursestring]{Text in the margin!} \samplefile{lorem} } \doloopoverlist{ inleft, inright, inouter, ininner, inmargin, inother, } { %\setupmargindata[\recursestring][align=middle] \setupmarginframed[\recursestring][align=middle] \title{\tex{\recursestring}} \samplefile{lorem} \margindata[\recursestring]{Text in the margin!} \samplefile{lorem} } \stoptext %%%% end example Wolfgang
On 8/2/24 16:41, Wolfgang Schuster wrote:
[...] The example below shows which predefined margin blocks rely only on margindata where you can change the alignment with \etupmargindata and also the ones which require \setupmarginframed.
%%%% begin example \setuppapersize[A4][A3]
Sorry, Wolfgang, but I must be missing something here. Unless I add the following, inner doesn’t behave as expected (I think it is always outer without these lines): \setuppagenumbering[alternative=doublesided] \setuphead[title][page=yes] Is that right or am I missing something? Many thanks for your help, Pablo
Pablo Rodriguez via ntg-context schrieb am 02.08.2024 um 18:36:
On 8/2/24 16:41, Wolfgang Schuster wrote:
[...] The example below shows which predefined margin blocks rely only on margindata where you can change the alignment with \etupmargindata and also the ones which require \setupmarginframed.
%%%% begin example \setuppapersize[A4][A3] Sorry, Wolfgang, but I must be missing something here.
Unless I add the following, inner doesn’t behave as expected (I think it is always outer without these lines):
\setuppagenumbering[alternative=doublesided] \setuphead[title][page=yes]
Is that right or am I missing something?
When you have a singlesided document each page is a right side and it doesn't matter whether it's an even or odd page. Wolfgang
On 8/3/24 07:55, Wolfgang Schuster wrote:
Pablo Rodriguez via ntg-context schrieb am 02.08.2024 um 18:36:
[...] Unless I add the following, inner doesn’t behave as expected (I think it is always outer without these lines):
\setuppagenumbering[alternative=doublesided] \setuphead[title][page=yes]
Is that right or am I missing something?
When you have a singlesided document each page is a right side and it doesn't matter whether it's an even or odd page.
Many thanks for your reply, Wolfgang. Everything is clear now: (default) singlesided may be even or odd page, but it will only give right pages. Many thanks for your help, Pablo
participants (6)
-
Gerion Entrup
-
Hans Hagen
-
Henning Hraban Ramm
-
Pablo Rodriguez
-
Taco Hoekwater
-
Wolfgang Schuster