3

I use the package tcolorbox for all my theorems and it works fine. I also use it for my remarks because I want my remarks numbered with the chapter. The tcolorbox for remarks (unlike my other tcolorbox) are without a frame. Here is a MWE and the result:

\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}


\newtcbtheorem[number within=chapter]{rem}{Remarque}{%
    enhanced,breakable,colback=white,
    colframe=white,%sharp corners,
    fonttitle=\bfseries,separator sign dash,
    coltitle=black,boxrule=0pt,
    left=0mm}
    {Remarque}


\begin{document}
\setlength{\parindent}{0mm}

Une première phrase.

\medskip
\begin{rem}{}{}
  texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
\end{rem}

Maintenant une remarque entrée à la main.

\medskip

\textbf{Remarque 13.1}

Voici la deuxième remarque.
\end{document}

enter image description here

As you can see just above:

  • the remark is not perfectly aligned on the left with the rest of the text.
  • the space between the title of the remark and the text of the remark is too big. I would like it to exactly the same as the remark I entered manually (on purpose for this MWE), that is to say baselineskip, I guess

I tried to modify several parameters of the tcolorbox but I didn't succeed.

2 Answers 2

4

As you can see just above:

  • the remark is not perfectly aligned on the left with the rest of the text.

It's caused by the default setting boxsep=1mm. Since boxsep is applied to all sides of a tcolorbox (just checkout the second figure in package manual, sec. 2 "Quick Reference"), depending on your purpose, either boxsep=0mm or left=-1mm does the work.

Edit: I think use of oversize in samcarter's answer is better than mine.

Edit 2: There're also options /tcb/blank and /tcb/blanker that you can have a try.

  • the space between the title of the remark and the text of the remark is too big. I would like it to exactly the same as the remark I entered manually (on purpose for this MWE), that is to say baselineskip, I guess

This is more trickier since setting separations around title and at top won't solve the problem perfectly. My suggestion is to detach the title then reinsert it before upper part of the box:

detach title, before upper=\tcbtitle\newline,

In total,

\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}


\newtcbtheorem[number within=chapter]{rem}{Remarque}{%
    enhanced,breakable,colback=white,
    colframe=white,%sharp corners,
    fonttitle=\bfseries,separator sign dash,
    coltitle=black, boxrule=0pt,
    left=0mm,
    boxsep=0pt,
    detach title, before upper=\tcbtitle\newline,
}{Remarque}


\begin{document}
\setlength{\parindent}{0mm}

Une première phrase.

\medskip
\begin{rem}{}{}
  Voici la deuxième remarque.
  
  texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
\end{rem}

Maintenant une remarque entrée à la main.

\medskip

\textbf{Remarque 13.1}

Voici la deuxième remarque.
\end{document}

enter image description here

5
  • Thank you @muzimuzhi Z. It works fine
    – Didier
    Jun 6 at 9:15
  • In fact, if in my remark, I begin with a \begin{itemize} or {enumerate}, I get an empty line before the first \item. Is there a way to get rid off this first line?
    – Didier
    Jun 26 at 17:46
  • @Didier Try out before upper=\tcbtitle\par? Jun 27 at 5:39
  • Thank you. I’ll try that
    – Didier
    Jun 27 at 16:02
  • It works perfectly fine. Thanks a lot
    – Didier
    Jun 28 at 8:44
3
  • to get the text inside of the tcolorbox to align with the surrounding text, you can use the oversize option

  • there are many ways to adjust the space between the title and the content of the tcolorbox. You could e.g. play with the top parameter


\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}


\newtcbtheorem[number within=chapter]{rem}{Remarque}{%
    enhanced,
    breakable,
    frame hidden,
    interior hidden,
    fonttitle=\bfseries,
    coltitle=black,
    top=-0.8ex,
    oversize
}{Remarque}


\begin{document}
\setlength{\parindent}{0mm}

Une première phrase.

\medskip
\begin{rem}{}{}
  Vexte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte texte
\end{rem}

Maintenant une remarque entrée à la main.

\medskip

\textbf{Remarque 13.1}

Voici la deuxième remarque.
\end{document}

enter image description here

2
  • Thank you @samcarter. It works fine. Just one question: for top=-0.8ex, is it the exact value to have \baselineskip, or is it approximate?
    – Didier
    Jun 6 at 9:17
  • @Didier Approximated. You can fine tune it if you need it to be more precise. Jun 6 at 9:18

You must log in to answer this question.

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