2

I want to create a nested list with itemize, with an additional "column" at the right side of the page. I know there are several ways to maketabstops or something similar, but all of them seem to add up with the indentation of the line.

Here is an example of how it should look like, made in MS Word: enter image description here

That's how I am doing it currently in TeX (and it sucks), using the tabto-package:

\tabto{0.865\linewidth} Zeit in h
\vspace{-5mm}
\begin{itemize}
    \item Projekteinrichtung \tabto{0.9\linewidth} \textbf{2}
    \begin{itemize}
        \item VisualStudio-Projekt \tabto{0.895\linewidth} 1,5
        \item SQL-Server \tabto{0.895\linewidth} 0,5
    \end{itemize}
    \item Basis-Oberfläche mit geplanten Funktionen \tabto{0.9\linewidth} \textbf{3}
    \item Funktionslevel 1 umsetzen \tabto{0.9\linewidth} \textbf{35}
    \begin{itemize}
        \item Manuelle Zeiterfassung \tabto{0.895\linewidth} 2
        \item Datenbindung an SQL-Server \tabto{0.895\linewidth} 8
        \item Rechteverwaltung für SQL-Server-Zugriffe \tabto{0.895\linewidth} 10
        \item Projektzuordnung für Zeitabrechnung \tabto{0.895\linewidth} 2
        \item \glqq automatische\grqq\ Erfassung \tabto{0.895\linewidth} 2
        \item Anzeige der eigenen Zeiten \tabto{0.895\linewidth} 3
        \item Manuelles Bearbeiten der eigenen Zeiten \tabto{0.895\linewidth} 5
        \item Export bzw. Druck \tabto{0.895\linewidth} 3
    \end{itemize}
    \item Basisoberfläche durch richtiges UI ersetzen \tabto{0.9\linewidth} \textbf{12}
    \begin{itemize}
        \item Tray-Funktionalität \tabto{0.895\linewidth} 2
        \item praktisches und übersichtliches UI für die Basisansicht \tabto{0.895\linewidth} 5
        \item praktisches und übersichtliches UI für die Liste der Zeiten \tabto{0.895\linewidth} 5
    \end{itemize}
    \item Funktionslevel 2 umsetzen (Stufe 1 der optionalen Anforderungen) \tabto{0.9\linewidth} \textbf{15}
    \begin{itemize}
        \item AutoStart \tabto{0.895\linewidth} 2
        \item Verbessertes Tray-Menü \tabto{0.895\linewidth} 3
        \item Einfache Auswertungen \tabto{0.895\linewidth} 10
    \end{itemize}
    \item Dokumentation abschließen (Erstellung läuft meist parallel ab) \tabto{0.9\linewidth} \textbf{3}
\end{itemize} 

I thought about somehow calculating the real tabstop by subtracting the indentation, but wasn't able to read out the indentation of the current line...

How can I achieve this layout? I would also use tables, as long as I'm able to let it look like a nested list.

1
  • 2
    since the last column is summed values, wouldn't it look more logical with the entries flush right? Commented Mar 15, 2016 at 12:53

2 Answers 2

2

Another possibility --- I think that the macros are self-explanatory. It manages very long lines also.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\newlength\rboxlen\setlength{\rboxlen}{3cm}
\newlength\rspace\setlength{\rspace}{1em}
\newcommand{\splat}[1]{\hfill\rlap{\makebox[\rboxlen][l]{\hspace{\rspace} #1}}}
\newcommand{\splatout}[2][\null]{\hfill\llap{#1}%
         {\makebox[\rboxlen][l]{\hspace{\rspace} #2}}}

\begin{document}

Title \splatout[This will go before:]{Number}
% you need a blank line here

\begin{itemize}[rightmargin=\rboxlen]
    \item Level 1 short \splat{l1-s}
        \begin{itemize}
            \item Level 2 short \splat{l2-s}
            \item Level 2 but this time it is long, 
                so long it will go into the next part of the line, 
                and then some, and then some \splat{l2-l}
            \item Short no splat
        \end{itemize}
    \item Level 1 no splat
    \item Level 1 but this time it is long, 
        so long it will go into the next part of the line, and then some, 
        and then some \splat{l2-l}
\end{itemize}

\splatout[Sum:]{sum}

You can change the spaces with just the \rboxlen and \rspace distance.

Output of the snippet

2

Like this :

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}

\begin{document}
Titre\hfill Somme
\begin{itemize}
\item Level 1 \hfill \makebox[1cm][l]{\textbf{10}}
  \begin{itemize}
  \item Level 2.1 \hfill \makebox[1cm][l]{4}
  \item Level 2.2 \hfill \makebox[1cm][l]{3}
  \item Level 2.3 \hfill \makebox[1cm][l]{3}
  \end{itemize}
\item Level 1.1 \hfill \makebox[1cm][l]{\textbf{10}}
  \begin{itemize}
  \item Level 2.1 \hfill \makebox[1cm][l]{4}
  \item Level 2.2 \hfill \makebox[1cm][l]{3}
  \item Level 2.3 \hfill \makebox[1cm][l]{3}
  \end{itemize}
\end{itemize}
\hfill Somme : \makebox[1cm][l]{20}
\end{document}

enter image description here

8
  • ok, I should have had this idea myself - usign the distance from the right is of course much better ^^ thx a lot Commented Mar 15, 2016 at 8:10
  • but it should be hspace at the end of each line, shouldn't it? Commented Mar 15, 2016 at 8:11
  • 1
    Use newcommand{\splat}[1]{\hfill\makebox[3cm][l]{#1}] and save a lot of typing... and you can change the "last column" size in just one place.
    – Rmano
    Commented Mar 15, 2016 at 8:18
  • still not totally right... vspace creates unwanted space bewteen each line, an with hspace some liens are still broken - I'll edit my question Commented Mar 15, 2016 at 8:18
  • @TheFlow0360 Yes :(
    – flav
    Commented Mar 15, 2016 at 8:19

You must log in to answer this question.

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