I want to show/hide comments when toggeling the code below:

\settoggle{comments}{true} %set true to show all comments, set false to hide all comments
\newcommand{\notemp}[1]{\iftoggle{comments}{\todo[color=yellow]{{[}CORR.:{]} #1}{}}\linebreak}

My problem is that when I set \settoggle{comments}{false}, I get the error in my document:

./chapters/chapter01/chap01.tex:106: LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.106 T
       this is a test comment...

Any suggestions, how to fix this error, but do not break the comments?

I appreciate your replies!


I took \linebreak out and received the following error:

./chapters/chapter02/chap02.tex:786: Undefined control sequence.
\endtcolorbox ->\unskip \tcb@after@box 
                                       \end {tcb@savebox}\tcb@draw@color@box...
l.786 \end{tcolorbox}

I am also using in my lated document the structures:

\begin{tcolorbox}[colback=orange,colframe=black,enhanced jigsaw, arc=3mm,boxsep=4pt,boxrule=0.5pt,breakable]

Any suggestions, how to fix this error and toggle the comments with out?

  • 3
    the error is from \linebreak which you need to put in the conditional section just if you have text, as is you always do \linebreak so get an error that there is no line if you have not added any text before it. – David Carlisle Sep 25 '15 at 7:00
  • @DavidCarlisle Please have a look at my updated answer! – Kare Sep 25 '15 at 11:17
  • 2
    It is impossible to debug code that you can not see. Please always make a small (few line) complete document that demonstrates the problem, so people can reproduce it locally. Also that should be a new question. whatever it is, it is an unrelated problem unconnected to the question title. – David Carlisle Sep 25 '15 at 12:02
  • 1
    For the interested ones: Here's the new question (and it's been solved, in my opinion) tex.stackexchange.com/questions/269501/… – user31729 Sep 25 '15 at 16:52
  • 4
    I'm voting to close this question because it has been reposted at tex.stackexchange.com/questions/269501/… – samcarter is at topanswers.xyz Dec 31 '15 at 18:14