3

How do I remove the unwanted space before the optional argument (set here) and after the theorem-like environment's name (Intuitive idea--- here)?

\documentclass[12pt]{article} \usepackage{amsthm} \usepackage{thmtools} \declaretheoremstyle[ headfont= \sffamily\bfseries, headpunct={\sffamily\bfseries.}, postheadspace=0.5em, notefont=\sffamily\bfseries, bodyfont=\normalfont, notebraces={}{}, numbered=no ]{discuss} \theoremstyle{discuss} \makeatletter % \declaretheorem[ name=Intuitive idea---, preheadhook=\renewcommand{\thmt@space}{}, numbered=no ]{intuit} % \makeatother \begin{document} %\lipsum[1] \begin{intuit}[set] A set is a collection of objects. \end{intuit} \end{document} 

Unwanted space before optional argument

As shown, I tried the method, given at How can I remove the space before a custom theorem-like environment header?, of using preheadhook=\renewcommand{\thmt@space}{}. But that still leaves the space.

2
  • There was a post, now disappeared, that just used name=Intuitive idea---\ignorespaces, in the \declaretheorem. What's wrong with that? Commented Jun 16, 2018 at 19:50
  • It was my post. I deleted it after the @egreg's solution, which looks like more correct. Commented Jun 16, 2018 at 19:54

2 Answers 2

4

You can use headformat:

\documentclass[12pt]{article} \usepackage{amsthm} \usepackage{thmtools} \usepackage{lipsum} \makeatletter \declaretheoremstyle[ headfont=\sffamily\bfseries, headpunct=., postheadspace=0.5em, notefont=\sffamily\bfseries, bodyfont=\normalfont, notebraces={}{}, numbered=no, headformat=\NAME---\NOTE, preheadhook=\renewcommand\thmt@space{}, ]{discuss} \makeatother \declaretheorem[ style=discuss, name=Intuitive idea, numbered=no ]{intuit} \begin{document} \lipsum[1] \begin{intuit}[set] A set is a collection of objects. \end{intuit} \end{document} 

enter image description here

On the other hand, if the argument is always present, it should be a mandatory argument (so that an optional one is still possible).

\documentclass[12pt]{article} \usepackage{amsthm} \usepackage{thmtools} \usepackage{lipsum} \declaretheoremstyle[ headfont=\sffamily\bfseries, headpunct=., postheadspace=0.5em, notefont=\sffamily\bfseries, bodyfont=\normalfont, numbered=no, ]{discuss} \declaretheorem[ style=discuss, name=\protect\INTUIT, numbered=no ]{innerintuit} \newenvironment{intuit}[1] {\newcommand\INTUIT{Intuitive idea---#1}\innerintuit} {\endinnerintuit} \begin{document} \lipsum[1] \begin{intuit}{set} A set is a collection of objects. \end{intuit} \begin{intuit}{set}[Cantor] A set is a collection of objects. \end{intuit} \end{document} 

enter image description here

6
  • Without the note the dash is still there. Is it possible to insert if and only if there is a note? Commented Jun 16, 2018 at 19:51
  • @Sigur: For my own purposes, I'll always have an optional argument with this theorem-like environment. Commented Jun 16, 2018 at 19:54
  • @murray, so, no problem anymore. go ahead with the nice solution. Regards. Commented Jun 16, 2018 at 19:56
  • @murray I added a different implementation: if the optional argument is required, it should be a mandatory one. Commented Jun 16, 2018 at 20:03
  • @egreg: For my purposes, I'll never have both the required optional argument and an additional, actually optional one. But your additional implementation is nonetheless very instructive (the sort of thing I don't get out of just perusing the thmtools documentation)! Commented Jun 16, 2018 at 20:07
0

keytheorems offers noteseparator for precisely this purpose. I've removed the --- from the theorem name and set noteseparator={---}; by default, this is a space.

\documentclass[12pt]{article} \usepackage{keytheorems} \newkeytheoremstyle{discuss}{ headfont=\sffamily\bfseries, headpunct={\sffamily\bfseries.}, postheadspace=0.5em, notefont=\sffamily\bfseries, bodyfont=\normalfont, notebraces={}{}, numbered=no, noteseparator={---}, } \theoremstyle{discuss} \newkeytheorem{intuit}[ name=Intuitive idea, numbered=no ] \begin{document} \begin{intuit} This has no note. \end{intuit} \begin{intuit}[set] A set is a collection of objects. \end{intuit} \end{document} 

intuitions

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.