[Tex/LaTex] How to put two minipages side-by-side, which use 100 % of the text width

horizontal alignmentkoma-scriptminipagespacing

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}

Best Answer

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.

Related Question