Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I find it very useful to keep outlines in omnioutliner because you get the outline and table functionality in one. I would like to write a macro that converts the outline document to a LaTeX table for exporting.

The first column is a nested outline and there are multiple columns to the right.

Here is a picture of an example:

screenshot

I don't have a minimum working example that works as every time I try to do this i get errors. Here is an example of just the nested itemize. I don't know how to set this up in a table as in the picture above.

\documentclass{article}

\begin{document}

\begin{itemize}
  \item hello
  \item world
  \begin{itemize}
    \item nested hello
    \item nested world 
  \end{itemize}
\end{itemize}

\end{document} 

I would like to be able to have columns to the right of the outline to fill with data

Any advice on how to begin or pointers on how to represent this in LaTeX?

Thanks.

share|improve this question
    
Your example does compile perfectly on my computer, as it's supposed to. Furthermore, this looks to me like it does what you want: tex.stackexchange.com/questions/11541/… –  hugovdberg Mar 12 at 18:10
    
I don't see any of the examples with a nested table, where each item is in a different row: so that the table is lined up as in the picture above. –  Stephen Lien Mar 14 at 14:55
    
If you have the Mac version of OmniOutliner, I know there are some scripts which go OO -> LaTeX directly. (Or were, for older versions of OO.) Not sure about iOS. –  alexwlchan Mar 14 at 15:18

1 Answer 1

up vote 1 down vote accepted

Since you essentially want a table with a counter in the first column you could try something like below. Instead of either the enumerate or tabular environment you declare a new environment enumtab, and itemize by the \enum, \subenum, and \subsubenum items.

The indentation of the sublevels can be controlled by setting the length of \enumindent, the space reserved for the counter is controlled by the length of \enumcounterwidth.

This can probably be optimized a little further, but should at least give you something to begin with.

\documentclass{scrartcl}

\newcounter{items}
\newcounter{subitems}
\newcounter{subsubitems}
\newlength{\enumindent}
\newlength{\enumcounterwidth}
\setlength{\enumindent}{1pc}
\setlength{\enumcounterwidth}{1.4pc}

\newcommand{\enum}{
  \stepcounter{items}\setcounter{subitems}{0}%
  \makebox[\enumcounterwidth][l]{\arabic{items}.}
 }
\newcommand{\subenum}{
  \stepcounter{subitems}\setcounter{subsubitems}{0}%
  \hspace{\enumindent}\makebox[\enumcounterwidth][l]{\arabic{subitems}.}
 }
\newcommand{\subsubenum}{
  \stepcounter{subsubitems}%
  \hspace{2\enumindent}\makebox[\enumcounterwidth][l]{\arabic{subsubitems}.}
 }

\newenvironment{enumtab}[1]{
  \setcounter{items}{0}
  \setcounter{subitems}{0}
  \setcounter{subsubitems}{0}

  \begin{tabular}{#1}
 }{
  \end{tabular}
 }

\begin{document}
\begin{enumtab}{ll}\hline
  Column 1       & Column 2\\\hline
  \enum Cell 1/1  & Cell 1/2\\
  \enum Cell 2/1  & Cell 2/2\\
  \subenum Cell 2.1/1  & Cell 2.1/2\\
  \subenum Cell 2.2/1  & Cell 2.2/2\\
  \subsubenum Cell 2.2.1/1  & Cell 2.2.1/2\\
  \subenum Cell 2.3/1  & Cell 2.3/2\\
  \subsubenum Cell 2.3.1/1  & Cell 2.3.1/2\\
  \enum Cell 3/1  & Cell 3/2\\
  \subenum Cell 3.1/1  & Cell 3.1/2\\
  \enum Cell 4/1  & Cell 4/2\\
  \enum Cell 5/1  & Cell 5/2\\
  \enum Cell 6/1  & Cell 6/2\\
  \enum Cell 7/1  & Cell 7/2\\
  \enum Cell 8/1  & Cell 8/2\\
  \enum Cell 9/1  & Cell 9/2\\
  No enumerate   & No enumerate\\
  \enum Cell 10/1  & Cell 10/2\\
  \enum Cell 11/1  & Cell 11/2\\
  \enum Cell 12/1  & Cell 12/2\\
  \enum Cell 13/1  & Cell 13/2\\
  \enum Cell 14/1  & Cell 14/2\\
  \enum Cell 15/1  & Cell 15/2\\\hline
\end{enumtab}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.