2

I am using the ntheorem package for hypotheses and subhyotheses (i.e. H1a, H1b, etc.), with the latter being unimportant for my problem. Just as an info for you to understand why I cannot simply use the amsthm package.

My code gives me H 1 instead of H1 as output, and I want to remove that space between "H" and "1". Find a screenshot attached. Thank you!!

Here is my MWE:

\documentclass{scrreprt}

\usepackage{ntheorem}
\newtheorem{hyp}{H}     %I tried \newtheorem{hyp}{H\ignorespaces} - not working

\begin{document}

\begin{hyp}
The higher the mountain the harder the hike.
\end{hyp}

\end{document}

enter image description here

3
  • 3
    You will need to define your own theorem style. The default, you show here, is called plain, look in ntheorem.sty for the code for plain, copy it and adjust accordingly.
    – daleif
    May 17, 2017 at 16:00
  • Thanks, that worked perfect! If you wanna give that as an answer instead of a comment I can put that question on "solved".
    – Paul
    May 17, 2017 at 16:24
  • 3
    I don't collect point, why don't you write one yourself, good exercise (plus I'm on a tablet, so interacting with the site is rather slow)
    – daleif
    May 17, 2017 at 16:25

1 Answer 1

4

Thanks to daleif's helpful comment I was able to solve the question by creating a \newtheoremstyle, based on the default style "plain" found in ntheorem.sty.

Plain style:

\newtheoremstyle{plain}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
  {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3)\theorem@separator]}

One can see that the space occurs because of the space in ##1\ ##2, so changing ##1\ ##2 to ##1##2 solved my problem.

This leads to the following corrected MWE:

\documentclass{scrreprt}

\usepackage{ntheorem} 

\makeatletter %
\newtheoremstyle{hypotheses}%
  {\item[\hskip\labelsep \theorem@headerfont ##1##2\theorem@separator]}%
  {\item[\hskip\labelsep \theorem@headerfont ##1##2\ (##3)\theorem@separator]}
\makeatother

\theoremstyle{hypotheses}
\newtheorem{hyp}{H} 

\begin{document}

\begin{hyp}
The higher the mountain the harder the hike.
\end{hyp}

\end{document}

with the output:

enter image description here

Hope this might help some of you in the future as well.

1
  • 1
    Btw you should probably name the plain style you show plain, and not hypotheses, more instructive give your explanation after it.
    – daleif
    May 17, 2017 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .