ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Two bugs with descriptions in ConTeXt.
@ 2024-02-13 21:04 SirColeman via ntg-context
  2024-02-13 21:50 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: SirColeman via ntg-context @ 2024-02-13 21:04 UTC (permalink / raw)
  To: Ntg Context; +Cc: SirColeman


[-- Attachment #1.1: Type: text/plain, Size: 1392 bytes --]

The first bug is that descriptions interfere with the counters, resulting in the peculiar behavior demonstrated in the resulting PDF.

Unless I'm mistaken, I think it happens because the head of the description is evaluated twice, thus incrementing the counter twice---at least, that's the only explanation for how the number is incremented by 2 each time. Further, this issue seems to persist whether we're using macros or writing \incrementcounter directly.

The solution is to either make sure that the head of descriptions is evaluated only once, or document that text placed as the head of descriptions is meant to be evaluated twice, if there's a good reason for doing so. Of course, this silly example of incrementing counters can be subdued by placing the \incrementcounter directly in the after option when customizing descriptions. But it demonstrates the issue.

I've tried to make the examples given be as varied as possible, demonstrating the different ways in which descriptions interact with the counter. 

The second bug is that descriptions, or at least that's my intuitive expectation, shouldn't interfere with the bullets of items. I expect that the bullet stays where it is, and the description is placed next to it. But what happens is that the bullet is shifted to the right, making it overlap with the description's head, which isn't pretty.

ConTeXt version 2024.1.24

[-- Attachment #1.2: Type: text/html, Size: 1997 bytes --]

[-- Attachment #2: descriptions.lmtx --]
[-- Type: application/octet-stream, Size: 1347 bytes --]

\definedescription
  [latexdesc]
  [headstyle=bold, style=normal, alternative=hanging,
    width=broad,  before=, distance=1cm, indenting={big, yes}]

\definecounter[counter]
\setcounter[counter][1]

\def\counterpart{Part \convertedcounter[counter]: \incrementcounter[counter]}

\starttext
\startlatexdesc{\counterpart\ Short}
  The bug is here.
\stoplatexdesc
\startlatexdesc{\counterpart\ Rather longer label}
  The bug is here.
\stoplatexdesc

\startlatexdesc{Part \convertednumber[counter]: Rather longer label}
  Hello there.
\stoplatexdesc

\counterpart

\startlatexdesc{\counterpart\ Rather longer label}
  The bug is here.
\stoplatexdesc

% There's no \incrementcounter!
\def\othercounterpart{Part \convertedcounter[counter]:}
\startlatexdesc{\othercounterpart\ Rather longer label}
  Seems okay.
\stoplatexdesc
\startlatexdesc{\othercounterpart\ Rather longer label}
  Definitely okay!
\stoplatexdesc

% Issue persists despite not using macros.
\startlatexdesc{Part \convertedcounter[counter]: \incrementcounter[counter]
  Rather longer label}
  The bug is here.
\stoplatexdesc
\startlatexdesc{Part \convertedcounter[counter]: \incrementcounter[counter]
  Rather longer label}
  The bug is here.
\stoplatexdesc

\blank[1cm]

\startitemize
\item \startlatexdesc {Hello, \ConTeXt!} \samplefile {knuth} \stoplatexdesc
\stopitemize

\stoptext

[-- Attachment #3: descriptions.pdf --]
[-- Type: application/pdf, Size: 15568 bytes --]

[-- Attachment #4: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-13 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 21:04 [NTG-context] Two bugs with descriptions in ConTeXt SirColeman via ntg-context
2024-02-13 21:50 ` [NTG-context] " Wolfgang Schuster
2024-02-13 22:06   ` Sir Coleman via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).