[Tex/LaTex] latex courier font, text writes to margin

fontspackages

I have two questions:

1.If I change the font to \ttfamily the text do not stop at margin, without \ttfamily it works fine
2.If I exclude the package "graphicx" I get with pdflatex a4 page with my text, but I just want my page with width=14.5cm and height=10.5. I do not understand, why this package change my papersize?

I hope, someone can help me πŸ™‚

\documentclass[12pt,
          paper=14.5cm:10.5cm,
          ]{scrartcl}
\areaset{13cm}{9cm}

\usepackage{courier}
\usepackage{graphicx}

%---- Kein Zeileneinzug
\parindent0mm

\newcommand{\highlight}[1]{{\color{red}\textbf{#1}}}

\begin{document}

\ttfamily

Sei $M \subseteq G$ eine beliebige Teilmenge einer Gruppe $G$. Mit $\langle M \rangle$         bezeichnen wir die kleinste Untergruppe von $G$ welche $M$ enthlt. $\langle M \rangle $     heit die erzeugte Untergruppe von $M$ in $G$. Falls $\langle M \rangle = G$ gilt, dann sagen wir: $G$ wird von $M$ erzeugt. 

\end{document}

Best Answer

Monospaced fonts usually set up two features:

  1. no hyphenation, and
  2. no stretching or shrinking of the interword spaces.

Courier, selected by \usepackage{courier} is no exception. The reason is that enabling hyphenation or flexible interword space would have undesired effects on listings, which are the main use for monospaced fonts.

Moreover, long texts in a monospaced font are hard to read (and, of course, math fonts will clash with the text font).

However, if you want to experiment, here's a workaround:

\documentclass[
  12pt,
  paper=14.5cm:10.5cm,
  pagesize=auto,
]{scrartcl}
\areaset{13cm}{9cm}
\usepackage[ngerman]{babel}

\renewcommand{\ttdefault}{pcr} % this is what \usepackage{courier} does

% a copy of ot1pcr.fd with changes for the interword spacing
\DeclareFontFamily{OT1}{pcr}{%
  \fontdimen3\font1.67\fontdimen6\font
  \fontdimen4\font1.11\fontdimen6\font
}
\DeclareFontShape{OT1}{pcr}{m}{n}{<-> pcrr7t}{}
\DeclareFontShape{OT1}{pcr}{m}{sc}{<-> pcrrc7t}{}
\DeclareFontShape{OT1}{pcr}{m}{sl}{<-> pcrro7t}{}
\DeclareFontShape{OT1}{pcr}{b}{n}{<-> pcrb7t}{}
\DeclareFontShape{OT1}{pcr}{b}{sc}{<-> pcrbc7t}{}
\DeclareFontShape{OT1}{pcr}{b}{sl}{<-> pcrbo7t}{}
\DeclareFontShape{OT1}{pcr}{m}{it}{<->ssub * pcr/m/sl}{}
\DeclareFontShape{OT1}{pcr}{bx}{n}{<->ssub * pcr/b/n}{}
\DeclareFontShape{OT1}{pcr}{bx}{sc}{<->ssub * pcr/b/sc}{}
\DeclareFontShape{OT1}{pcr}{bx}{sl}{<->ssub * pcr/b/sl}{}
\DeclareFontShape{OT1}{pcr}{b}{it}{<->ssub * pcr/b/sl}{}
\DeclareFontShape{OT1}{pcr}{bx}{it}{<->ssub * pcr/b/it}{}
\DeclareFontShape{OT1}{pcr}{m}{ui}{<->ssub * pcr/m/it}{}
\DeclareFontShape{OT1}{pcr}{b}{ui}{<->ssub * pcr/b/it}{}
\DeclareFontShape{OT1}{pcr}{bx}{ui}{<->ssub * pcr/b/it}{}
%%% end of font declarations

%---- Kein Zeileneinzug
\parindent0mm

\newcommand{\highlight}[1]{{\color{red}\textbf{#1}}}

\begin{document}

\ttfamily

Sei $M \subseteq G$ eine beliebige Teilmenge einer Gruppe $G$. Mit $\langle M \rangle$ bezeichnen wir 
die kleinste Untergruppe von $G$ welche $M$ enthlt. $\langle M \rangle $ heit die erzeugte Untergruppe 
von $M$ in $G$. Falls $\langle M \rangle = G$ gilt, dann sagen wir: $G$ wird von $M$ erzeugt.

\end{document}

The page size problem is solved by giving the pagesize=auto option.

enter image description here

Here's the version for T1 encoded fonts, which is recommended for German.

\documentclass[
  12pt,
  paper=14.5cm:10.5cm,
  pagesize=auto,
]{scrartcl}
\areaset{13cm}{9cm}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\renewcommand{\ttdefault}{pcr}

\DeclareFontFamily{T1}{pcr}{%
  \fontdimen3\font1.67\fontdimen6\font
  \fontdimen4\font1.11\fontdimen6\font
}
\DeclareFontShape{T1}{pcr}{m}{n}{<-> pcrr8t}{}
\DeclareFontShape{T1}{pcr}{m}{sc}{<-> pcrrc8t}{}
\DeclareFontShape{T1}{pcr}{m}{sl}{<-> pcrro8t}{}
\DeclareFontShape{T1}{pcr}{b}{n}{<-> pcrb8t}{}
\DeclareFontShape{T1}{pcr}{b}{sc}{<-> pcrbc8t}{}
\DeclareFontShape{T1}{pcr}{b}{sl}{<-> pcrbo8t}{}
\DeclareFontShape{T1}{pcr}{m}{it}{<->ssub * pcr/m/sl}{}
\DeclareFontShape{T1}{pcr}{bx}{n}{<->ssub * pcr/b/n}{}
\DeclareFontShape{T1}{pcr}{bx}{sc}{<->ssub * pcr/b/sc}{}
\DeclareFontShape{T1}{pcr}{bx}{sl}{<->ssub * pcr/b/sl}{}
\DeclareFontShape{T1}{pcr}{b}{it}{<->ssub * pcr/b/sl}{}
\DeclareFontShape{T1}{pcr}{bx}{it}{<->ssub * pcr/b/it}{}

%---- Kein Zeileneinzug
\parindent0mm

\newcommand{\highlight}[1]{{\color{red}\textbf{#1}}}

\begin{document}

\ttfamily

Sei $M \subseteq G$ eine beliebige Teilmenge einer Gruppe $G$. Mit $\langle M \rangle$ bezeichnen wir 
die kleinste Untergruppe von $G$ welche $M$ enthΓ€lt. $\langle M \rangle $ heit die erzeugte Untergruppe 
von $M$ in $G$. Falls $\langle M \rangle = G$ gilt, dann sagen wir: $G$ wird von $M$ erzeugt.

\end{document}

enter image description here