1

I am new to LaTeX. Recently I have taken it up to do some math note taking on my laptop. I have found a template which seems quite useful for this. Nonetheless, after some time spent doing the set up, there seems to be a problem with constant overfulls in certain parts of my text.

This template I am using includes some custom sections like \thm for theorems or \prop for propositions. However, whenever I use \ex or \rmkb for examples and remarks respectively, I always run across overfull hbox. It seems like those are not set up for breaking lines, somehow? I have had no problems with other parts but rather just these two. Could you help me figure out how can I modify them in order to avoid this problem? Below you can find the code where it is defined (sorry for my major lack of knowledge in LaTeX terminology, I have just discovered it a few days ago and I am still learning a lot).

% Remark
\NewDocumentCommand{\rmk}{+m}{
    {\it \color{blue!50!white}#1}
}

\newenvironment{remark}{
    \par
    \vspace{5pt}
    \begin{minipage}{\textwidth}
        {\par\noindent{\textbf{Observación.}}}
        \tcolorbox[blanker,breakable,left=5mm,
        before skip=10pt,after skip=10pt,
        borderline west={1mm}{0pt}{cyan!10!white}]
}{
        \endtcolorbox
    \end{minipage}
    \vspace{5pt}
}

\NewDocumentCommand{\rmkb}{+m}{
    \begin{remark}
        #1
    \end{remark}
}

Similarly here is how \ex is defined,

% Example
\newenvironment{example}{%
    \par
    \vspace{5pt}
    \begin{minipage}{\textwidth}
        \noindent\textbf{Example.}
        \tcolorbox[blanker,breakable,left=5mm,parbox=false,
        before upper={\parindent15pt},
        after skip=10pt,
        borderline west={1mm}{0pt}{cyan!10!white}]
}{%
        \endtcolorbox
    \end{minipage}
    \vspace{5pt}
}

\NewDocumentCommand{\ex}{+m}{
    \begin{example}
        #1
    \end{example}
}

Any help is greatly appreciated! Thank you.

Edit. Here is an image that represents what my problem is.

'Observacion' aka 'Remark' going beyond the margin

Another example. This seems to happen consistently with all 'Remark' boxes.

Second example!

7
  • Hi, and welcome to TeX StackExchange! You don't actually have to do anything about overfull hboxes—even experienced users get such warnings. TeX calculates something known as badness, which (very loosely) corresponds to how ugly a box is. If TeX thinks a box would look more aesthetically pleasing if it had less stuff inside it, it'll raise an overfull warning (again, very loosely). However, for human readers, the overfull-ness is often barely perceptible. As a result, unless you see a problem involving too much stuff with your own eyes, there's no need to worry.
    – gz839918
    Sep 6 at 23:29
  • You may also be interested in this: What are underfull hboxes and vboxes and how can I get rid of them?
    – gz839918
    Sep 6 at 23:33
  • Hello, @gz839918! Thank you for your answer. Perhaps I have not been clear with my problem (most likely), but what I am seeing is that specifically in these examples and remarks sections, the text is going beyond the margin. I thought that is that overfull hbox meant. I'd like to somehow force the margin, because all of the other boxes I use such as theorems or propositions have a certain margin they respect, instead here they go over that shared margen with other sections. Is there anything else I could share which would make the question more clear, maybe? Sep 7 at 18:01
  • Moreover, regarding your linked post, I had read it before but I could not quite get the 'manual route' to work on my end. For example, in the first image I have just edited into the post, if I write res\-petando the output is still respe-tando. I'd much rather have LaTeX completely force the linebreaks in order to maintain the same margins as the above colourful boxes, is there perhaps any way to do that? Sep 7 at 18:10
  • It looks to me like the \noindent needs to precede the remark, i.e., before the minipage. Unless you have set \parindent=0pt, there will be an indent applied before anything that shifts into horizontal mode, like minipage. Sep 7 at 18:11

1 Answer 1

0

Although there's no MWE here, and the document class is unknown, the context makes the problem clear.

Remember that in most document classes, the \parindent is nonzero. And that indent will be applied to anything that follows a paragraph break (whether specified by a blank line or \par).

In this question, a minipage follows \par, so the whole minipage will be indented. So the fix is to precede the \minipage by \noindent. Putting \noindent as the first thing inside the minipage will negate a possible indentation inside the \minipage (usually there isn't any in that position), but it won't back up to before the \minipage; that has already happened, and TeX doesn't go backwards.

Remember: If something has already been processed, you can't go back. TeX is "one-way".

You must log in to answer this question.

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