# How to put two minipages side-by-side, which use 100 % of the text width?

In draft-mode a black marker indicates that the reserved space is too low. This also appears in the following example, but it shouldn't. How can I put two minipages exactly side-by-side?

\documentclass[draft=on]{scrbook}
\usepackage{blindtext}

\begin{document}
\begin{minipage}{.5\textwidth} %
TEXT 1
\end{minipage} %
\begin{minipage}{.5\textwidth} %
TEXT 2
\end{minipage}
\end{document}

• You have captured the letter of the law regarding endline %'s, but unfortunately missed the spirit. May 16, 2013 at 0:38
• @RyanReich You should explain in more details for new users, instead of just pointing it out. Feb 26, 2018 at 0:14
• @paradox I wish I remembered what I meant. Probably that if you're going to use % to remove line breaks, you should do so with code that is sensitive to them. Feb 26, 2018 at 2:07
• @RyanReich This is what I meant : lots of people (me included) know % removes lines breaks but only a few are able to point to a ressource where you can find use-cases where it's necessary. I think this kind of ressources could be helpful to broadcast. Because, like you pointed out, even you could not remember what you meant at the time you answered ;) Mar 11, 2018 at 0:19
• @Paradox That's a reasonable point, but unfortunately, I have been completely out of touch with TeX programming for nearly four years, and I don't know if I could provide any references other than TeX By Topic, or of course The TeXbook, which is not online (but is worth buying). Mar 11, 2018 at 21:01

There are two problems in your input.

1. A new paragraph is started with the first minipage, which adds the indent.
2. There is a space between the two minipages.
\documentclass[draft=on]{scrbook}
\usepackage{blindtext}

\begin{document}
\noindent
\begin{minipage}{.5\textwidth}
TEXT 1
\end{minipage}% This must go next to \end{minipage}
\begin{minipage}{.5\textwidth}
TEXT 2
\end{minipage}
\end{document}


Note that

text %


has a space after "text", while

text%


hasn't. The % you're using in

\begin{minipage}{.5\textwidth} %


does nothing; the end-of-line or spaces after \begin{minipage}{...} are ignored anyway. So typing

\begin{minipage}{.5\textwidth} %

\begin{minipage}{.5\textwidth}%

\begin{minipage}{.5\textwidth}


is just the same.

• No space between \end and \begin, why didn't any one else mention that... Oct 22, 2014 at 8:26
• The space always gets me. Latex shouldn't be that way. May 5, 2017 at 19:55