I'm trying to highlight theorem-like environment (defined using amsthm) utilizing todonotes.

In the preamble I have:


Problem is, that in the body, when having something like:


It yields: enter image description here

I tried to define a theoremstyle as follows:

{-1em} % Space above
{0pt} % Space below
{} % body font
{} % Indent amount
{} % Theorem head font
{:} % Punctuation after theorem head
{.5em} % Space after theorem head
{} % Theorem head spec

Using this style yielded the following box: enter image description here This is better, but still not good enough. Setting the first argument to 40pt for instance does increases this vertical spacing, but I cannot make it go away.

How can I get rid of the empty line at the beginning of the box? I want to have the same spacing as the one at the bottom.

I guess I could tweak the solution provided here for example, but I want to try and use todonotes.

  • 2
    You can try something like \begin{que}\vspace*{-1.5em}#1\end{que} but you need to determine the exact dimension "1.5 em ??" or perhaps someone knows the dimension used in "newtheorem". The problem comes from newtheoremand not from todonotes. It's necessary to give us a complete example. – Alain Matthes May 3 '13 at 7:33
  • @AlainMatthes: I agree, and it seems like the problem is indeed coming from amsthm and newtheorem. I don't see what further details are needed. I'm using newtheorem out of the box of amsthm. – Dror May 3 '13 at 9:40
  • It's preferable to give a complete example (MWE) to see if you get interactions from other packages. Your problem is simple, \newtheorem places extra space before the first line. With amsthm and a style, you can't reduce enough the extra space. I see two possibilities : you can perhaps create a personal environment, or you can study exactly the command \newtheorem to know what space is added before the first line. Another possibility is perhaps to hack \newtheorem. – Alain Matthes May 3 '13 at 9:49
  • 3
    I'm not sure todonotes is the right tool; have a look at mdframed. – egreg May 3 '13 at 10:17

As egreg has said, todonotes is really the wrong tool for this job. You can get exactly the same result if you use the mdframed package, and the line spacing all just works out perfectly when you do. Here is a 'before' and 'after' comparison for you -- first using todonotes and second using mdframed.

enter image description here

And here is the code for generating that.





innertopmargin = \topskip,%
splittopskip = \topskip,%
ntheorem = true,%
skipabove = \baselineskip,%
skipbelow = \baselineskip,%







Another solution using tcolorbox is given at this thread (answer nb 32): https://tex.stackexchange.com/a/204888

It worked for me, contrary to mdframed (because on some previous definitions in my file).

  • The 32 on that answer is not the answer number, but (essentially) the number of up votes the answer has received, so is very likely to change. If you have a solution using tcolorbox instead, it would be better to post it here adapted to the question at hand, rather linking to something in a different context. – Andrew Swann Sep 15 '16 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.