Re: [NTG-context] lmtx update
On Fri, 31 Jul 2020, Hans Hagen wrote: Thanks for the update. Other work in progress is: better columns in itemize, esp proper footnote support (not that I ever need that but I know users do so ...), experiments work ok, but I need to check spacing. In general, footnotes (will) behave a bit better, especially those used nested in other mechanisms. A side effect of more control is that we can do other tricks too and we're playing with it (kind of fun). Does this mean we can get two-column footnotes in two-column documents? Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] margin notes (was: lmtx update)
Hi Hraban, Thanks for the hint… indeed I did see that \ColWidth command but didn't think about its definition… Sorry! Now with \ColWidth defined, your code works fine and it has the advantage that the text of the sidenote begins in the margin at the level where the \footnote command appears. However, it cannot control the overflow of a sidenote to the next page, whereas the code given by Hans can do that. I admit that this does not happen very often since a well designed text should not have too many long sidenotes… In case other users would like to use your code, I put the whole example below. Best regards: Otared %%% sidenotes, or footnotes in the margin %%% example given by Hraban: %%% here the tweaking of the width of the sidenote is turned off %%% remove the comment where there is \ColWidth %%% in order to adapt to your layout \showframe \setuplayout [cutspace=7cm, width=middle, margin=5cm, margindistance=7mm] %\def\ColWidth{57mm} \setupmargindata[inmargin] [location=right, stack=continue, align=flushright, ] \setupmargindata[inouter] [location=right, stack=continue, align=flushright, ] \def\FNVOffset{0} % Negative vertical offset of footnotes in lines % Manual tweaking was necessary for a while, when stacking didn’t work reliably. \def\MarginNote#1{% \inmargin[ voffset=\dimexpr-\FNVOffset\lineheight\relax, % width=\ColWidth, align=flushleft, ]{% \inframed[ % width=\ColWidth, align=right, frame=off, offset=overlay, strut=yes, ]{#1}% }% } \define\PlaceFootnote{% \inmargin[ voffset=\dimexpr-\FNVOffset\lineheight\relax, % width=\ColWidth, ]{% \vtop{\placelocalnotes[footnote][before=,after=]}}% } \def\FNo#1{{#1~}} % I never managed to get number and text in consecutive lines without indented text % or at least a constant whitespace after the number. \setupnote[footnote] [location=text, bodyfont=, indenting=no, before={\noindentation}, next=\PlaceFootnote, ] \setupnotation[footnote] [way=bychapter, align=flushleft, indenting=no, location=serried, alternative=serried, width=broad, numbercommand=\FNo, ] % footnote text \setuptexttexts[margin][] [% {\framed[ align={flushright,bottom}, frame=off, height=\textheight, % width=\ColWidth, ]{% \strut\vfill\placenotes[footnote]}}% ] \starttext \dorecurse{6}{\input ward\expanded{\footnote{This is a footnote \recurselevel}} } test \dorecurse{10}{ test \footnote{\input ward }\input tufte.tex \par test \footnote{This is a note about Ward, who says: \par \input ward.tex} \input ward.tex \par test \footnote{This is a note about Donald Knuth.} \input knuth.tex \par } This is a last note. \footnote{This last note is here to see what happens in the next page\dots\par \input knuth.tex} \par \dorecurse{3}{\input knuth.tex } \stoptext > On 1 Aug 2020, at 23:01, Henning Hraban Ramm wrote: > > >> Am 01.08.2020 um 22:36 schrieb Otared Kavian : >> >> Hi Hraban, >> >> Thank you for taking the time to send your code for sidenotes. >> Unfortunately when I add >> >> \starttext >> test\footnote{A footnote in the margin.} >> \stoptext >> >> to your code, I get an error and unfortunately with recent versions of LMTX >> the error message >> ! Undefined control sequence >> is not helpful to find the error… (LMTX considers \footnote as an undefined >> control sequence…). >> > > Of course it’s not \footnote that is undefined but something else from my > code – I didn’t take the time to strip it of all the references to other > setups in the same environment, probably \ColWidth that was just a shortcut > for the column width: > \def\ColWidth{57mm} > > Hraban > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl
Re: [NTG-context] margin notes (was: lmtx update)
> Am 01.08.2020 um 22:36 schrieb Otared Kavian : > > Hi Hraban, > > Thank you for taking the time to send your code for sidenotes. > Unfortunately when I add > > \starttext > test\footnote{A footnote in the margin.} > \stoptext > > to your code, I get an error and unfortunately with recent versions of LMTX > the error message > ! Undefined control sequence > is not helpful to find the error… (LMTX considers \footnote as an undefined > control sequence…). > Of course it’s not \footnote that is undefined but something else from my code – I didn’t take the time to strip it of all the references to other setups in the same environment, probably \ColWidth that was just a shortcut for the column width: \def\ColWidth{57mm} Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
> Am 01.08.2020 um 22:44 schrieb Wolfgang Schuster > : >>> \define[1]\Ort{\expanded{\index{...}}} >> Ah, I never know where to expand (tried \expanded\ctxlua). > > \expanded needs a argument, i.e. \expanded{...} I recognized it doesn’t work otherwise. But I thought TeX would always use the next token? Isn’t a command (or its result?) such a token? >>> When you use formatting commands etc. you have to use the optional argument >>> for sorting. >> I don’t understand. >> \Ort[kursiv->]{Hamburg} works. > > You mentioned only \index{\emph{...}} in your mail ... I tried to simplify and couldn’t remember which command I needed when I had the \index{\something} problem (probably something similar, i.e. a self defined command that changed the text of the index entry). >>> begin tex example >> Oh, this is also nice. But isn’t the Lua version faster? (I have >600 person >> entries and a few hundred locations). > > Hard to say without testing but the difference can be ignored because \index > itself is what take processing time. Ok, thank you! Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
Henning Hraban Ramm schrieb am 01.08.2020 um 22:16: Am 01.08.2020 um 21:30 schrieb Wolfgang Schuster : \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} You have to expand the \index argument: \define[1]\Ort{\expanded{\index{...}}} Ah, I never know where to expand (tried \expanded\ctxlua). \expanded needs a argument, i.e. \expanded{...} Now, \def\TOrt#1{\expanded{\Ort{\ctxlua{userdata.Lookup("#1")}}}#1} % Loc + Text \defineprocessor[kursiv][style=italicface] \def\TFOrt#1{\expanded{\Ort[kursiv->]{\ctxlua{userdata.Lookup("#1")}}}#1} % Loc in Footnote + Text works. :) (I always define \TIndex to avoid doubling, e.g. Hamburg\index{Hamburg}.) When you use formatting commands etc. you have to use the optional argument for sorting. I don’t understand. \Ort[kursiv->]{Hamburg} works. You mentioned only \index{\emph{...}} in your mail ... You can avoid a few problems when you move the \index command to Lua and use context.index or you use a pure TeX solution. begin lua example function userdata.index(name) local indexentry = userdata.lookup[name] or name context.index(indexentry) end That’s nice, but since I use different registers, I’d need to define that function for each. Since I also use several shortcuts (e.g. \TOrt, \TFOrt, \TPerson, \TFPerson) I would multiply the effort on the Lua side. I find my TeX definitions (like above) shorter, where I can use the same Lua function for each. With your code I could at least shorten it to: function userdata.Lookup(name) context(userdata.Lookups[name] or name) end begin tex example Oh, this is also nice. But isn’t the Lua version faster? (I have >600 person entries and a few hundred locations). Hard to say without testing but the difference can be ignored because \index itself is what take processing time. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] margin notes (was: lmtx update)
Hi Hraban, Thank you for taking the time to send your code for sidenotes. Unfortunately when I add \starttext test\footnote{A footnote in the margin.} \stoptext to your code, I get an error and unfortunately with recent versions of LMTX the error message ! Undefined control sequence is not helpful to find the error… (LMTX considers \footnote as an undefined control sequence…). Best regards: Otared > On 1 Aug 2020, at 19:19, Henning Hraban Ramm wrote: > > > >> Am 01.08.2020 um 18:57 schrieb Otared Kavian : >> >> Hi Hraban, >> >> Thank you for reminding me of the solution cooked up by Wolfgang for you a >> few years ago. That solution works fine when the notes are short enough, but >> in some cases the notes in the margin bump into each other (indeed it is not >> a good habit to have long notes, but in some cases one cannot avoid them). > > One essential bit is missing in the wiki example: > > \setupmargindata[inmargin][ > location=right, > stack=continue, % !! > align=flushright, > ] > > The code I’m actually using for our German literature magazine “Kritische > Ausgabe” is much more elaborated, but also cluttered with obsolete stuff – I > need to sort that out some time... > (I only deleted some styling.) > > %%% Footnotes / Marginals > > \setupmargindata[inmargin][ > location=right, > stack=continue, > align=flushright, > ] > \setupmargindata[inouter][ > location=right, > stack=continue, > align=flushright, > ] > > \def\FNVOffset{0} % Negative vertical offset of footnotes in lines > % Manual tweaking was necessary for a while, when stacking didn’t work > reliably. > > \def\MarginNote#1{% > \inmargin[ > voffset=\dimexpr-\FNVOffset\lineheight\relax, > width=\ColWidth, > align=flushleft, > ]{% > \inframed[ >width=\ColWidth, >align=right, >frame=off, >offset=overlay, >strut=yes, >]{#1}% > }% > } > > \define\PlaceFootnote{% > \inmargin[ > voffset=\dimexpr-\FNVOffset\lineheight\relax, > width=\ColWidth, > ]{% > \vtop{\placelocalnotes[footnote][before=,after=]}}% > } > > \def\FNo#1{{#1~}} > % I never managed to get number and text in consecutive lines without > indented text > % or at least a constant whitespace after the number. > > \setupnote[footnote][ > location=text, > bodyfont=, > indenting=no, > before={\noindentation}, > next=\PlaceFootnote, > ] > > \setupnotation[footnote][ > way=bychapter, > align=flushleft, > indenting=no, > location=serried, > alternative=serried, > width=broad, > numbercommand=\FNo, > ] % footnote text > > \setuptexttexts[margin][][% > {\framed[ >align={flushright,bottom}, >frame=off, >height=\textheight, >width=\ColWidth, > ]{% >\strut\vfill\placenotes[footnote]}}% > ] > > > Best, Hraban > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
> Am 01.08.2020 um 21:30 schrieb Wolfgang Schuster > : >> \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} > > You have to expand the \index argument: > > \define[1]\Ort{\expanded{\index{...}}} Ah, I never know where to expand (tried \expanded\ctxlua). Now, \def\TOrt#1{\expanded{\Ort{\ctxlua{userdata.Lookup("#1")}}}#1} % Loc + Text \defineprocessor[kursiv][style=italicface] \def\TFOrt#1{\expanded{\Ort[kursiv->]{\ctxlua{userdata.Lookup("#1")}}}#1} % Loc in Footnote + Text works. :) (I always define \TIndex to avoid doubling, e.g. Hamburg\index{Hamburg}.) > When you use formatting commands etc. you have to use the optional argument > for sorting. I don’t understand. \Ort[kursiv->]{Hamburg} works. > You can avoid a few problems when you move the \index command to Lua and use > context.index or you use a pure TeX solution. > > begin lua example > > function userdata.index(name) >local indexentry = userdata.lookup[name] or name >context.index(indexentry) > end That’s nice, but since I use different registers, I’d need to define that function for each. Since I also use several shortcuts (e.g. \TOrt, \TFOrt, \TPerson, \TFPerson) I would multiply the effort on the Lua side. I find my TeX definitions (like above) shorter, where I can use the same Lua function for each. With your code I could at least shorten it to: function userdata.Lookup(name) context(userdata.Lookups[name] or name) end > begin tex example Oh, this is also nice. But isn’t the Lua version faster? (I have >600 person entries and a few hundred locations). Thank you! Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
> Am 01.08.2020 um 21:01 schrieb Jairo A. del Rio : > > Hi, Henning. According to the garden, something like: > > \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} > > as long as #1 is capable of being sorted in the normal way, should work. Thank you, but that doesn’t work if my lookup e.g. creates "Garmisch-Partenkirchen" from "Partenkirchen". > Am 01.08.2020 um 21:18 schrieb Jairo A. del Rio : > > Wrt formatting (e.g. \index{\emph{something}}), the garden also mentions > processors for MkIV (https://wiki.contextgarden.net/Registers#Processors), so > you can wrap them with custom commands, in case it helps. I already use processors; \emph was just an example. Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
Henning Hraban Ramm schrieb am 01.08.2020 um 20:49: Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm : Hi, besides the CG journal I’m working on a scientific biography with huge person and locality indexes (named Person and Locality for the examples). In many cases, the author wants additional information in the index, e.g. \Locality{Altona (Hamburg)} \Locality{Breslau (pol. Wrocław)} or \Person{Arends, Katharina (née Schoemaker)} \Person{Wilhelm II. (Kaiser)} Now, I need that consistent and I don’t want to type these complicated entries every time. I’m looking for a good way to handle this – maybe a lookup table in Lua, so that \LookupPerson{Willy II} would call a Lua function that returns \Person{Wilhelm II. (Kaiser)} ? Or is there already something in place that I overlooked, like \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} ? I came up with: \startluacode user.Lookups = { ["Albano"] = "Albano (Provinz Rom)", ["Altona"] = "Altona (Hamburg)", ["Aurich"] = "Aurich (Ostfriesland)" } function user.Lookup(Name) local Res = user.Lookups[Name] if Res then return context(Res) else return context(Name) end end \stopluacode \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} You have to expand the \index argument: \define[1]\Ort{\expanded{\index{...}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \strut\page \placeindex \stoptext The lookup works so far, but all the entries get sorted unter C (because of \ctxlua). I remember I had the same problem with other macros (like \index{\emph{bla}}), but can’t find a solution in my usual sources. When you use formatting commands etc. you have to use the optional argument for sorting. You can avoid a few problems when you move the \index command to Lua and use context.index or you use a pure TeX solution. begin lua example \startluacode userdata = userdata or { } userdata.lookup = { ["Albano"] = "Albano (Provinz Rom)", -- ["Altona"] = "Altona (Hamburg)", ["Aurich"] = "Aurich (Ostfriesland)" } function userdata.index(name) local indexentry = userdata.lookup[name] or name context.index(indexentry) end \stopluacode \define[1]\Ort{\ctxlua{userdata.index("#1")}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \dontleavehmode\page \placeindex \stoptext end lua example begin tex example \setvariables [index] [Albano={Albano (Provinz Rom)}, %Altona={Altona (Hamburg)}, Aurich={Aurich (Ostfriesland)}] \define[1]\Ort {\doifelsevariable{index}{#1} {\expanded{\index{\getvariable{index}{#1 {\index{#1}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \dontleavehmode\page \placeindex \stoptext end tex example Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
Wrt formatting (e.g. \index{\emph{something}}), the garden also mentions processors for MkIV (https://wiki.contextgarden.net/Registers#Processors), so you can wrap them with custom commands, in case it helps. Cordially, Jairo. El sáb., 1 de ago. de 2020 a la(s) 14:01, Jairo A. del Rio ( jairoadelr...@gmail.com) escribió: > Hi, Henning. According to the garden, something like: > > \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} > > as long as #1 is capable of being sorted in the normal way, should work. > > Regards, > > Jairo > > El sáb., 1 de ago. de 2020 a la(s) 13:49, Henning Hraban Ramm ( > te...@fiee.net) escribió: > >> >> >> > Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm : >> > >> > Hi, >> > >> > besides the CG journal I’m working on a scientific biography with huge >> person and locality indexes (named Person and Locality for the examples). >> > >> > In many cases, the author wants additional information in the index, >> e.g. >> > >> > \Locality{Altona (Hamburg)} >> > \Locality{Breslau (pol. Wrocław)} >> > or >> > \Person{Arends, Katharina (née Schoemaker)} >> > \Person{Wilhelm II. (Kaiser)} >> > >> > Now, I need that consistent and I don’t want to type these complicated >> entries every time. >> > >> > I’m looking for a good way to handle this – maybe a lookup table in >> Lua, so that >> > \LookupPerson{Willy II} >> > would call a Lua function that returns >> > \Person{Wilhelm II. (Kaiser)} >> > ? >> > >> > Or is there already something in place that I overlooked, like >> > \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} >> > ? >> >> I came up with: >> >> \startluacode >> user.Lookups = { >> ["Albano"] = "Albano (Provinz Rom)", >> ["Altona"] = "Altona (Hamburg)", >> ["Aurich"] = "Aurich (Ostfriesland)" >> } >> >> function user.Lookup(Name) >> local Res = user.Lookups[Name] >> if Res then >> return context(Res) >> else >> return context(Name) >> end >> end >> \stopluacode >> >> \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} >> >> \starttext >> >> \Ort{Albano} >> \Ort{Altona} >> \Ort{Aurich} >> \strut\page >> >> \placeindex >> >> \stoptext >> >> >> The lookup works so far, but all the entries get sorted unter C (because >> of \ctxlua). >> >> I remember I had the same problem with other macros (like >> \index{\emph{bla}}), but can’t find a solution in my usual sources. >> >> >> Hraban >> >> >> ___ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://context.aanhet.net >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> wiki : http://contextgarden.net >> >> ___ >> > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
Hi, Henning. According to the garden, something like: \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} as long as #1 is capable of being sorted in the normal way, should work. Regards, Jairo El sáb., 1 de ago. de 2020 a la(s) 13:49, Henning Hraban Ramm ( te...@fiee.net) escribió: > > > > Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm : > > > > Hi, > > > > besides the CG journal I’m working on a scientific biography with huge > person and locality indexes (named Person and Locality for the examples). > > > > In many cases, the author wants additional information in the index, e.g. > > > > \Locality{Altona (Hamburg)} > > \Locality{Breslau (pol. Wrocław)} > > or > > \Person{Arends, Katharina (née Schoemaker)} > > \Person{Wilhelm II. (Kaiser)} > > > > Now, I need that consistent and I don’t want to type these complicated > entries every time. > > > > I’m looking for a good way to handle this – maybe a lookup table in Lua, > so that > > \LookupPerson{Willy II} > > would call a Lua function that returns > > \Person{Wilhelm II. (Kaiser)} > > ? > > > > Or is there already something in place that I overlooked, like > > \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} > > ? > > I came up with: > > \startluacode > user.Lookups = { > ["Albano"] = "Albano (Provinz Rom)", > ["Altona"] = "Altona (Hamburg)", > ["Aurich"] = "Aurich (Ostfriesland)" > } > > function user.Lookup(Name) > local Res = user.Lookups[Name] > if Res then > return context(Res) > else > return context(Name) > end > end > \stopluacode > > \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} > > \starttext > > \Ort{Albano} > \Ort{Altona} > \Ort{Aurich} > \strut\page > > \placeindex > > \stoptext > > > The lookup works so far, but all the entries get sorted unter C (because > of \ctxlua). > > I remember I had the same problem with other macros (like > \index{\emph{bla}}), but can’t find a solution in my usual sources. > > > Hraban > > > ___ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > ___ > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] consistent index entries
> Am 01.08.2020 um 13:22 schrieb Henning Hraban Ramm : > > Hi, > > besides the CG journal I’m working on a scientific biography with huge person > and locality indexes (named Person and Locality for the examples). > > In many cases, the author wants additional information in the index, e.g. > > \Locality{Altona (Hamburg)} > \Locality{Breslau (pol. Wrocław)} > or > \Person{Arends, Katharina (née Schoemaker)} > \Person{Wilhelm II. (Kaiser)} > > Now, I need that consistent and I don’t want to type these complicated > entries every time. > > I’m looking for a good way to handle this – maybe a lookup table in Lua, so > that > \LookupPerson{Willy II} > would call a Lua function that returns > \Person{Wilhelm II. (Kaiser)} > ? > > Or is there already something in place that I overlooked, like > \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} > ? I came up with: \startluacode user.Lookups = { ["Albano"] = "Albano (Provinz Rom)", ["Altona"] = "Altona (Hamburg)", ["Aurich"] = "Aurich (Ostfriesland)" } function user.Lookup(Name) local Res = user.Lookups[Name] if Res then return context(Res) else return context(Name) end end \stopluacode \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \strut\page \placeindex \stoptext The lookup works so far, but all the entries get sorted unter C (because of \ctxlua). I remember I had the same problem with other macros (like \index{\emph{bla}}), but can’t find a solution in my usual sources. Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] margin notes (was: lmtx update)
> Am 01.08.2020 um 18:57 schrieb Otared Kavian : > > Hi Hraban, > > Thank you for reminding me of the solution cooked up by Wolfgang for you a > few years ago. That solution works fine when the notes are short enough, but > in some cases the notes in the margin bump into each other (indeed it is not > a good habit to have long notes, but in some cases one cannot avoid them). One essential bit is missing in the wiki example: \setupmargindata[inmargin][ location=right, stack=continue, % !! align=flushright, ] The code I’m actually using for our German literature magazine “Kritische Ausgabe” is much more elaborated, but also cluttered with obsolete stuff – I need to sort that out some time... (I only deleted some styling.) %%% Footnotes / Marginals \setupmargindata[inmargin][ location=right, stack=continue, align=flushright, ] \setupmargindata[inouter][ location=right, stack=continue, align=flushright, ] \def\FNVOffset{0} % Negative vertical offset of footnotes in lines % Manual tweaking was necessary for a while, when stacking didn’t work reliably. \def\MarginNote#1{% \inmargin[ voffset=\dimexpr-\FNVOffset\lineheight\relax, width=\ColWidth, align=flushleft, ]{% \inframed[ width=\ColWidth, align=right, frame=off, offset=overlay, strut=yes, ]{#1}% }% } \define\PlaceFootnote{% \inmargin[ voffset=\dimexpr-\FNVOffset\lineheight\relax, width=\ColWidth, ]{% \vtop{\placelocalnotes[footnote][before=,after=]}}% } \def\FNo#1{{#1~}} % I never managed to get number and text in consecutive lines without indented text % or at least a constant whitespace after the number. \setupnote[footnote][ location=text, bodyfont=, indenting=no, before={\noindentation}, next=\PlaceFootnote, ] \setupnotation[footnote][ way=bychapter, align=flushleft, indenting=no, location=serried, alternative=serried, width=broad, numbercommand=\FNo, ] % footnote text \setuptexttexts[margin][][% {\framed[ align={flushright,bottom}, frame=off, height=\textheight, width=\ColWidth, ]{% \strut\vfill\placenotes[footnote]}}% ] Best, Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
Hi Hraban, Thank you for reminding me of the solution cooked up by Wolfgang for you a few years ago. That solution works fine when the notes are short enough, but in some cases the notes in the margin bump into each other (indeed it is not a good habit to have long notes, but in some cases one cannot avoid them). Best regards: Otared > On 1 Aug 2020, at 18:41, Henning Hraban Ramm wrote: > > >> Am 01.08.2020 um 15:20 schrieb Otared Kavian : >> >> Regarding footnotes, would it be possible to have a built-in support for >> writing the footnotes in the margin? (For instance, assuming that the layout >> is such that for instance the right margin takes 1/3 of the page width, then >> the footnotes would occupy the right margin, beginning at the top). > > I wanted to have footnotes in the margin, possibly starting in the same line > as the marker. > > Wolfgang came up with this: > https://wiki.contextgarden.net/Footnotes#..._but_not_at_the_bottom > > (Not related to LMTX.) > > Hraban > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
> Am 01.08.2020 um 15:20 schrieb Otared Kavian : > > Regarding footnotes, would it be possible to have a built-in support for > writing the footnotes in the margin? (For instance, assuming that the layout > is such that for instance the right margin takes 1/3 of the page width, then > the footnotes would occupy the right margin, beginning at the top). I wanted to have footnotes in the margin, possibly starting in the same line as the marker. Wolfgang came up with this: https://wiki.contextgarden.net/Footnotes#..._but_not_at_the_bottom (Not related to LMTX.) Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
> On 1 Aug 2020, at 16:17, Hans Hagen wrote: > > On 8/1/2020 3:20 PM, Otared Kavian wrote: >>> On 31 Jul 2020, at 10:32, Hans Hagen wrote: >>> >>> […] >>> >>> Other work in progress is: better columns in itemize, esp proper footnote >>> support (not that I ever need that but I know users do so ...), experiments >>> work ok, but I need to check spacing. In general, footnotes (will) behave a >>> bit better, especially those used nested in other mechanisms. A side effect >>> of more control is that we can do other tricks too and we're playing with >>> it (kind of fun). >> Hi Hans, >> Thanks for your explanations. >> Regarding footnotes, would it be possible to have a built-in support for >> writing the footnotes in the margin? (For instance, assuming that the layout >> is such that for instance the right margin takes 1/3 of the page width, then >> the footnotes would occupy the right margin, beginning at the top). > It depends on what you want. This works ok: > […] Hi Hans, That's great! Thanks a lot! I have two questions in order to adapt what you sent to my case. I played a bit with your second solution, as in: %%% begin sidenote-Hans.tex \showframe \setupinteraction[state=start] \setuplayout [cutspace=7cm, width=middle, margin=5cm, margindistance=7mm] \setuptexttexts [margin] [] [{\directsetup{notabene}}] \newbox\MyNoteOverflow \setupnotation[endnote] [interaction=yes, after={\blank[big]}] \startsetups notabene \setbox\scratchbox\vbox \bgroup \setupalign[tolerant] \ifvoid\MyNoteOverflow \else \unvbox\MyNoteOverflow \fi \placenotes[endnote][before=,after=] \egroup \scratchdimen\dimexpr\textheight-.5\lineheight\relax \ifdim\ht\scratchbox>\scratchdimen \global\setbox\MyNoteOverflow\box\scratchbox \setbox\scratchbox\vsplit \MyNoteOverflow to \scratchdimen \fi \vbox \bgroup \topskipcorrection \unvbox\scratchbox \vfilll \egroup \stopsetups \startsetups notaflush \doloop { \page \ifvoid\MyNoteOverflow \exitloop \else \null \page \fi } \stopsetups \starttext \dorecurse{10}{ test \endnote{\input ward }\input tufte.tex \par test \endnote{This is a note about Ward, who says: \par \input ward.tex} \input ward.tex \par test \endnote{This is a note about Donald Knuth.} \input knuth.tex \par } This is a last note. \endnote{This last note is here to see what happens in the next page\dots\par \input knuth.tex} \par \input knuth.tex %\setups{notaflush} \stoptext %%% end sidenote-Hans.tex The first question is why did you define a setups called notaflush, and why your example works fine without using it ? The second question is: the side notes are vertically centered in the margin (one can see this when the notes do not cover all the margin), which is fine for me. But, out of curiosity, what can be changed in the setups notabene in order to have the notes to begin at the top of the margin ? (When a note runs into the next page, as in the last note, then it would be nicer to begin on top of the margin). Thanks again: Otared K. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
On 8/1/2020 3:20 PM, Otared Kavian wrote: On 31 Jul 2020, at 10:32, Hans Hagen wrote: […] Other work in progress is: better columns in itemize, esp proper footnote support (not that I ever need that but I know users do so ...), experiments work ok, but I need to check spacing. In general, footnotes (will) behave a bit better, especially those used nested in other mechanisms. A side effect of more control is that we can do other tricks too and we're playing with it (kind of fun). Hi Hans, Thanks for your explanations. Regarding footnotes, would it be possible to have a built-in support for writing the footnotes in the margin? (For instance, assuming that the layout is such that for instance the right margin takes 1/3 of the page width, then the footnotes would occupy the right margin, beginning at the top). It depends on what you want. This works ok: \setuplayout [cutspace=5cm, width=middle, margin=4cm] \setuptexttexts [margin] [] [{\directsetup{notabene}}] \startsetups notabene \vbox to \textheight \bgroup \setupalign[tolerant] \topskipcorrection \placenotes[endnote][before=,after=] \vfilll \egroup \stopsetups \starttext test \endnote{\input ward }\par test \endnote{x}\par test \endnote{x}\par \setups{notaflush} \stoptext This one handles overflow (suboptimal, nicer is stepwise flushing) but this one also flushes notes that have refs on the next page. It just indicates the usual: most can be done in tex without too much hassle but one always needs to think about the edge cases as users can drop anything in there and all can interfere. \newbox\MyNoteOverflow \startsetups notabene \setbox\scratchbox\vbox\bgroup \setupalign[tolerant] \ifvoid\MyNoteOverflow \else \unvbox\MyNoteOverflow \fi \placenotes[endnote][before=,after=] \egroup \scratchdimen\dimexpr\textheight-.5\lineheight\relax \ifdim\ht\scratchbox>\scratchdimen \global\setbox\MyNoteOverflow\box\scratchbox \setbox\scratchbox\vsplit \MyNoteOverflow to \scratchdimen \fi \vbox\bgroup \topskipcorrection \unvbox\scratchbox \vfilll \egroup \stopsetups \startsetups notaflush \doloop { \page \ifvoid\MyNoteOverflow \exitloop \else \null \page \fi } \stopsetups \starttext test \endnote{\input ward }\par test \endnote{x}\par test \endnote{x}\par \setups{notaflush} \stoptext Variants (i can make one but not with this warm weather) can use selective flushing (all kinds of things are possible with notes) but another challenge is to have an independent criterium hooked into the page builder (when i'm done with playing with extensions regarding pars i might give that a go ... as usual more a challenge than a need so i need some motive). 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 - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] handle_error_hook in LuaMetaTeX
On 7/31/2020 6:17 PM, Marcel Fabian Krüger wrote: Hi, thanks for handling f file consition in LuaMetaTeX. While playing with that, I encountered a potential bug in the latest LuaMetaTeX version: If handle_error_hook is executed and returns any number, LuaMetaTeX segfaults. (I'm pretty sure that this still worked with the previous version) Minimal ConTeXt example: \enabledirectives[system.quitonerror=false] \directlua{ print(callbacks.register('handle_error_hook', function(...) return 3 end)) } \undefined % Trigger an error \starttext \stoptext This triggers [...] system > ConTeXt ver: 2020.07.31 10:20 LMTX fmt: 2020.7.31 int: english/english [...] tex error > tex error on line 7 in file ./test_empty_input.tex: ! Undefined control sequence l.7 \undefined [...] 9 \stoptext segmentation fault (core dumped) /home/marcel/lmtx-install/tex/texmf-linux-64/bin/luametatexcont-yes.mki hm, i don't use that callback myself so i hadn't notice that i swapped an argument there; show_error_hook and handle_error_hook now both get an argument passed that indicates it it was a runaway error ... an easy fix so it should work okay in the next upload 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 - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] lmtx update
> On 31 Jul 2020, at 10:32, Hans Hagen wrote: > > […] > > Other work in progress is: better columns in itemize, esp proper footnote > support (not that I ever need that but I know users do so ...), experiments > work ok, but I need to check spacing. In general, footnotes (will) behave a > bit better, especially those used nested in other mechanisms. A side effect > of more control is that we can do other tricks too and we're playing with it > (kind of fun). Hi Hans, Thanks for your explanations. Regarding footnotes, would it be possible to have a built-in support for writing the footnotes in the margin? (For instance, assuming that the layout is such that for instance the right margin takes 1/3 of the page width, then the footnotes would occupy the right margin, beginning at the top). Best regards: Otared ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] limit of index entries?
On 8/1/2020 1:54 PM, Henning Hraban Ramm wrote: Hi, my aforementioned person index has more than 600 entries. If I get over ~500, ConTeXt (MkIV, several versions) breaks with ! error (push_node): stack overflow mtx-context | fatal error: return code: 256 Is there a hard limit? Can I change it? Is there a simple mwe to check this? It is no problem to bump the size but maybe it's something else, 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 - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] limit of index entries?
Hi, my aforementioned person index has more than 600 entries. If I get over ~500, ConTeXt (MkIV, several versions) breaks with ! error (push_node): stack overflow mtx-context | fatal error: return code: 256 Is there a hard limit? Can I change it? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] consistent index entries
Hi, besides the CG journal I’m working on a scientific biography with huge person and locality indexes (named Person and Locality for the examples). In many cases, the author wants additional information in the index, e.g. \Locality{Altona (Hamburg)} \Locallity{Breslau (pol. Wrocław)} or \Person{Arends, Katharina (née Schoemaker)} \Person{Wilhelm II. (Kaiser)} Now, I need that consistent and I don’t want to type these complicated entries every time. I’m looking for a good way to handle this – maybe a lookup table in Lua, so that \LookupPerson{Willy II} would call a Lua function that returns \Person{Wilhelm II. (Kaiser)} ? Or is there already something in place that I overlooked, like \OverwriteIndexEntry{Hraban}{Ramm, Henning Hraban} ? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Alphabet & color
On 7/31/2020 10:10 PM, Marcus Vinicius Mesquita wrote: Ok, after changing the glyph names in colorfont.lfg things run smoothly but for six glyphs: uacute, ucircumflex, udieresis, Uacute, Ucircumflex, Udieresis Have I hit a bug? Some font oddness ... use "uhungarumlaut", "Uhungarumlaut", 0x1DC, 0x144, 0xFA, 0xFB, 0xFC, 0xDA, 0xDB, 0xDC }, Maybe use numbers for all instead. All is revealed by: \usemodule[fonts-complete] \setupbodyfont[6pt] \starttext \ShowCompleteFont{name:IBMPlexSerif}{10pt}{1} \stoptext I'll send you a 'context' way of doing it ... . 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 - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___