0

Below is a paste of some latex code I am writing. I am still quite new and wanted to try to play around with some modified enumeration environments, as per this post. The following code results in everything after "\item [\textbf{Aufgabe 1}]" being indented in the document. How do I display the output inline with the customized enumeration items? i.e, the output should be similarly indented to "Aufgabe" 1,2, ... , n

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[latin1]{inputenc}

\title{Mathe 3 Uebung 4}
\author{Oscar}
\date{\today}

\begin{document}
\maketitle

\begin{enumerate}

\item [\textbf{Aufgabe 1}] \textit{``lorem ipsum''}

\begin{center}
\begin{tabular}{| l | l  l  l  l  l |}
\hline
$i$ & 1 & 2 & 3 & 4 & 5 \\ \hline
$x_i$ & -2 & 0 & 1 & 4 & 10 \\ \hline
$p_i$ & $\frac{1}{16}$ & $p_2$ & $\frac{1}{4}$ & $\frac{1}{4}$ & $\frac{1} 
{16}$ \\ 
\hline
\end{tabular}
\end{center}

\begin{enumerate}
\item abc
\item bcd
\item cde
\end{enumerate}

\item [\textbf{Aufgabe 2}]
\item [\textbf{Aufgabe 3}]
\item [\textbf{Aufgabe 4}]
\item [\textbf{Aufgabe 5}]

\end{enumerate}

\end{document}
Jackie
  • 115

1 Answers1

2

The problem comes from your long labels which flow into the (text) left margin because enumerate labels are right aligned w.r.t. the list left margin which has a standard value. I suggest you define a dedicated enumerate-like environment with enumitem.

Here is a possibility. I took the opportunity to improve the vertical spacing in your table:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{hyperref}

\title{Mathe 3 Uebung 4}
\author{Oscar}
\date{\today}

\newlist{Aufgaben}{enumerate}{1}
\setlist[Aufgaben]{label =Aufgabe \arabic*, wide = 0pt, font=\bfseries}

\begin{document}
\maketitle

\begin{Aufgaben}
\item \textit{``lorem ipsum''}
\begin{center}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{| l | l l l l l |}
\hline
$i$ & 1 & 2 & 3 & 4 & 5 \\ \hline
$x_i$ & -2 & 0 & 1 & 4 & 10 \\ \hline
$p_i$ & $\frac{1}{16}$ & $p_2$ & $\frac{1}{4}$ & $\frac{1}{4}$ & $\frac{1}
{16}$ \\
\hline
\end{tabular}
\end{center}

\begin{enumerate}
\item abc
\item bcd
\item cde
\end{enumerate}

\item
\item
\item
\item
\end{Aufgaben}

\end{document} 

enter image description here

Bernard
  • 271,350