0

Sorry if it seems basic but I just switched over from LaTeX. It seems the in-line math affects the spacing after the enumeration environment head named 'Example'. How do I offset this?

\defineenumeration[example][
   text=Example,
   before={\blank[medium]},
   after={\blank[medium]},
   alternative=serried,
   right=.,
   distance=0.5em,
   width=broad,
   headstyle=bold,
   titlestyle=bold,
]
\starttext
  \startexample
    Let $R$ be a ring and $M_n(R)$ be a collection of all $n\times n$ matrices with entries in 
    $R$. Then $M_n(R)$ is a ring. In particular, $M_n(\mathbb{Z})$, $M_n(\mathbb{R})$ and 
    $M_n(\mathbb{C})$ are all rings. Note that these rings are not generally commutative.
  \stopexample

\startexample $\mathbb{Z}, \mathbb{Q}, \mathbb{R}$ and $\mathbb{C}$ are all rings. They satisfy all the axioms. $\mathbb{Z}$ is an integral domain and $\mathbb{Q}, \mathbb{R}$ and $\mathbb{C}$ are fields. \stopexample \stoptext

1 Answers1

1

Use width=fit and set spacing after the title as zero (thanks for Wolfgang Schuster for the remark):

%\setuppapersize[A6]
\defineenumeration[example][
   text=Example,
   before={\blank[medium]},
   after={\blank[medium]},
   alternative=serried,
   right=.,
   distance=0.5em,
   width=fit,
   stretch=0,
   shrink=0,
   headstyle=bold,
   titlestyle=bold,
]
\starttext
\startexample
Let $R$ be a ring and $M_n(R)$ be a collection of all $n\times n$ matrices with entries in  $R$. Then $M_n(R)$ is a ring. In particular, $M_n(\mathbb{Z})$, $M_n(\mathbb{R})$ and $M_n(\mathbb{C})$ are all rings. Note that these rings are not generally commutative.
\stopexample

\startexample $\mathbb{Z}, \mathbb{Q}, \mathbb{R}$ and $\mathbb{C}$ are all rings. They satisfy all the axioms. $\mathbb{Z}$ is an integral domain and $\mathbb{Q}, \mathbb{R}$ and $\mathbb{C}$ are fields. \stopexample \stoptext

enter image description here

  • Thanks. there is still a lit bit more space when I tried it as compared to the first example. Any idea why? – Spirit_bird May 31 '21 at 06:43
  • ConTeXt uses flexible spacing after the enumeration title, to disable it add stretch=0 and shrink=0 to the settings. – Wolfgang Schuster May 31 '21 at 06:52
  • Yeah. Turns out I had some space and characters before the text began from my previous attempts to 'hack' my problem. Please answer this question for me as well thanks https://tex.stackexchange.com/questions/599350/space-after-proof-environment-name-not-right-in-context – Spirit_bird May 31 '21 at 07:09