# Making more easy the itemized of item with tabulation system

Actually, isn’t not really a question. (Since my examinations get close, I don't really have the time to search for a solution to my problems.)

Rather than using the common \item, I'd like to use simple tabulation, with the possibility to indent. I know it isn't really the spirit of latex, but I want to fuse "Word" document with LaTeX one, to make them more pretty, and there are a lot of "itemized" item. And they ate a lot of time.

I was thinking of the use of special environment, or may be the "WYSIWYG" mode of LaTeX (normally used to show LaTeX code, for example), the verbatim environment (but "what" for the "arrow", or point or what ever that show the element ?).

Please don't mind the underlingment in the picture.

Edit :

Here, I just play a little with the code, and it give this :

The "new" code (originally from Peter Grill) :

\documentclass{article}
\usepackage{pgf}
\usepackage{xstring}
\usepackage{listings}

\newcounter{NumOfContigousSpaces}%
\setcounter{NumOfContigousSpaces}{0}%

\newcommand{\Width}{1}%
\pgfmathtruncatemacro{\BulletType}{\arabic{NumOfContigousSpaces}/4}%
\IfEqCase{\BulletType}{%
{0}{\gdef\Width{1}}
{1}{\gdef\Width{3}$\bullet$\hspace{1em}}
{2}{\gdef\Width{3}$\circ$\hspace{1em}}
{3}{\gdef\Width{3}$\star$\hspace{1em}}
}[\gdef\Width{3}$\bullet$\hspace{1em}]%
#1%
\setcounter{NumOfContigousSpaces}{0}%
}%
\newcommand*{\ProcessSpace}{%
\stepcounter{NumOfContigousSpaces}%
\hspace{4em}%
}%
\lstset{literate=%
{\ }{{{\ProcessSpace}}}1% Count contigous spaces
%--- now handle uppercase chars
}
\begin{document}
\begin{lstlisting}
Not indent one
What a want to indent
Others stuff
And subindent
Again other
And even more subindent
More and more
Another thing
Last one
\end{lstlisting}
\end{document}


I've added some \hpsace, and put one instead of a simple \space. It makes the word more clear. I don't know what is the {\ } for in the begining of \lstset{literate=% {\ }{{{\ProcessSpace}}}1% Count contigous spaces, but it seems (or may be the "bullet" part), that this is the cause of the first word splitting. When I add an \ in it, no bullet anymore, but the word were correctly put.

Any idea ? (Again, thanks for the answers)

Edit 2 :

Thanks to Peter Grill's code, problem solved.

Note : This system doesn't allow the use of macro inside the list.

-
It is not entirely clear what you're after: Do you want to create a itemize-like structure that is actually done inside a tabular? itemize (or lists in general) is far less complex than tables, so they are much quicker to construct. And what is the "quid"? – Werner May 30 '12 at 23:07
'It is not entirely clear what you're after: Do you want to create a itemize-like structure that is actually done inside a tabular?' Actually, yes, somehow. About the quid, it's from my motherthongue (it's the right word ?), I didn't translate it immediatly, sorry. If you already have used "Word", or Openoffice, or whatever, try to remember the systeme for listing. I'd like to make more or less the same, for the entry. – Julien May 31 '12 at 0:12
Perhaps a picture/image of your desired output would help make your question clearer? It is possible to 'indent' in a table cell in a few different ways. – jon May 31 '12 at 0:42
Possible duplicate: Using indentation to automatically begin and end itemize environments; related: Automatically itemize a paragraph. Please take a look at these and report back if this is what you are after. – Daniel May 31 '12 at 7:01
Also take a look at the easylist package. While it does not support tabs as indentation markers out of the box, it possibly could be extended in that way. Maybe you could also live with marking the indentation by something like +, ++ and so on. – Daniel May 31 '12 at 7:10

Here is something that I think is more promising and even changes the leading character based on spaces. So, using the input as

\begin{lstlisting}[style=MyItemize]
What a want to indent
Others stuff
And subindent
Again other
And even more subindent
And even more subindent
More and more
Another thing
Last one
\end{lstlisting}


yields:

This code uses literate from the listings package to count the number of contiguous spaces. When a non-space character is encountered, and the number of contiguous spaces encountered was more than 4, then a leading character is inserted based on the range of the number of spaces.

## Notes:

• There appears to be a problem with the default case of \IfEqCase, so if more tab stops are required that portion of the code will need to be updated to select an appropriate character. I have extended the code to include a few more levels, but be aware of this in case even more are needed.
• Based on the solution to How to detect a tab character when processing a literate in lstlistings?, this now works with tabs used for indentation as opposed to spaces.

## Code:

\documentclass{article}
\usepackage{pgf}
\usepackage{xstring}
\usepackage{listings}

\newcounter{NumOfContigousSpaces}%
\setcounter{NumOfContigousSpaces}{0}%

\newcommand{\Width}{1}%
\pgfmathtruncatemacro{\BulletType}{\arabic{NumOfContigousSpaces}/4}%
\IfEqCase{\BulletType}{%
{0}{\gdef\Width{1}}
{1}{\gdef\Width{3}$\bullet$ }
{2}{\gdef\Width{3}$\circ$ }
{3}{\gdef\Width{3}$\times$ }
{4}{\gdef\Width{3}$\star$ }
{5}{\gdef\Width{3}$-$ }
}[\gdef\Width{3}$\bullet$ ]%
#1%
\setcounter{NumOfContigousSpaces}{0}%
}%

\newcommand*{\ProcessSpace}{%
\space%
}%
\newcommand*{\ProcessTab}{%
\space\space\space\space%
}%

\lstdefinestyle{MyItemize}{%
basicstyle=\ttfamily,
columns=flexible,
tabsize=4, keepspaces=true,
literate=%
{\ }{{{\ProcessSpace}}}1% Count contigous spaces
{\^^I}{{{\ProcessTab}}}4%
%--- now handle uppercase chars
}%

\begin{document}
\begin{lstlisting}[style=MyItemize]
What a want to indent
Others stuff
And subindent
Again other
And even more subindent
And even more subindent
More and more
Another thing
Last one
\end{lstlisting}
\end{document}

-
The LaTeX for the list is what I want. For the render, adding space between bullet and keeping a "normal" aspect for the text would be better. Are those the problems you mentionned ? About the change of bullet, it isn't necessary. But would it work for enumerate either ? – Julien May 31 '12 at 11:16
@Julien: Yep, this is exactly the point mentioned in "Issues" section. I do not know what the problem is at this time. This could probably be adapted for enumerate as well, but would require more work. Also, not sure what you meant by your comment "The LaTeX for the list is what I want". The code before begin{document} would presumably go in your preamble, so you could just type in the list as shown in the lstlisting environment. – Peter Grill May 31 '12 at 19:16
The LaTeX code between '\begin{document}' and '\end{document}' look excatly like what I want. – Julien May 31 '12 at 20:43
@Julien: Have updated the answer and even used your new MWE code to make it complete. – Peter Grill Jun 1 '12 at 0:24
Have saw it. But Why did you take of the space ? It's more pretty, no ? – Julien Jun 1 '12 at 0:28

Here is a partial solution using FancyVerbFormatLine from the fancyverb package to achieve:

## Further Enhancements:

The following are needed to get the complete desired behavior:

• print the character before the first non-space char, as opposed to the beginning of the line.
• change the character based on the number of spaces.

## Code:

\documentclass{article}
\usepackage{fancyvrb}

\begin{document}
\renewcommand\FancyVerbFormatLine[1]{\textbullet#1}
\begin{Verbatim}
What a want to indent
And subindent
Another thing
\end{Verbatim}
\end{document}

-
Would be perfect if the bullet of the subindent was indented too. – Julien May 31 '12 at 11:10
@Julien: Yep, that is exactly what the first point in the "Further Enhancements" section was referring to. – Peter Grill May 31 '12 at 19:12