ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: SirColeman via ntg-context <ntg-context@ntg.nl>
To: Ntg Context <ntg-context@ntg.nl>
Cc: SirColeman <realsircoleman@tutanota.com>
Subject: [NTG-context] Two bugs with descriptions in ConTeXt.
Date: Tue, 13 Feb 2024 22:04:53 +0100 (CET)	[thread overview]
Message-ID: <NqZHM5H--3-9@tutanota.com> (raw)


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

             reply	other threads:[~2024-02-13 21:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 21:04 SirColeman via ntg-context [this message]
2024-02-13 21:50 ` [NTG-context] " Wolfgang Schuster
2024-02-13 22:06   ` Sir Coleman via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NqZHM5H--3-9@tutanota.com \
    --to=ntg-context@ntg.nl \
    --cc=realsircoleman@tutanota.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).