% \iffalse meta-comment % % Copyright (C) 2013 by Ben Vitecek % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any later % version. The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % % and version 1.3 or later is part of all distributions of % LaTeX version 2008-05-04 or later. % % \fi % % \iffalse %<*driver> \documentclass{ltxdoc} \usepackage{iitem} \usepackage[ngerman,english]{babel} \usepackage[T1]{fontenc} \usepackage[applemac]{inputenc} \usepackage{paralist, xcolor, listings,ragged2e} \usepackage{lmodern} \usepackage{microtype} \usepackage[colorlinks=true, linkcolor=blue!70!black]{hyperref} \lstset{% basicstyle=\small\sffamily, language=[LaTeX]TeX, breaklines=true, frame=single, %framexleftmargin=8mm, framexrightmargin=0mm, %xleftmargin=0mm, prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}}, backgroundcolor=\color{green!5}, texcsstyle=*\color{blue}, rulecolor=\color{red}, morekeywords={\iitem, \iiitem, \ivtem}, keywordstyle=\color[rgb]{0,0,1}, % keywords commentstyle=\color[rgb]{1,0,0}, % comments stringstyle=\color[rgb]{0.627,0.926,0.941}, % strings columns=fullflexible , literate={\{ }{\textcolor{green!70!black}{\{}}1 {\}}{\textcolor{green!70!black}{\}}}1 {\%}{\textcolor{green!5}{}}1 {]}{\textcolor{black}{]}}1 {\ }{\textcolor{blue}{\ }}1 }% \EnableCrossrefs \CodelineIndex \RecordChanges \makeatletter \g@addto@macro\@marginparreset{\Huge\RaggedLeft\vspace{-0.5ex}} \makeatother \begin{document} \DocInput{iitem.dtx} \end{document} % % \fi % % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % %\changes {v1.0} {2013/01/19} {Initial version} % % % % \GetFileInfo{iitem.sty} % %\DoNotIndex {\begin{tikzpicture},\end{tikzpicture}} %\DoNotIndex {\verb, \DeclareRobustCommandx} %\DoNotIndex {=\verb} %\DoNotIndex {\verb||} %\DoNotIndex {\draw,\fill,\DeclareRobustCommand, \colorlet,\shade} %\DoNotIndex {\xspace,\begin,\end} % % % % %\title{Package \textsf{iitem}\thanks{This document corresponds to \textsf{iitem}~\fileversion, dated~\filedate.}} %\author{Ben Vitecek \\ \texttt{b.vitecek@gmx.at}} %\maketitle % % % \begin{abstract} % It was always a bit annoying to write \lstinline|\begin{itemize}| inside \lstinline|\begin{itemize}| to go a step deeper. Using this package you can just write \lstinline|\iitem|, \lstinline|\iiitem| and \lstinline|\ivtem|. Of course you can also use \verb|description|, \verb|enumerate|, etc. {\color{red}But\marginpar{!!!} they are not usable in \verb|\footnote{}|, \verb|\marginpar{}| (I think they are named ``fragile'') etc. commands!} % \end{abstract} % % \tableofcontents % % \section{Interesting Part} % \lstset{deletekeywords={iitem}} % First of all, include this package via: %\begin{lstlisting} %\usepackage{iitem}\end{lstlisting} % % \lstset{morekeywords={iitem}} % % This package offers three new commands: \lstinline|\iitem|, \lstinline|\iiitem| and \lstinline|\ivtem|. \bigskip % %\noindent Instead of writing ~ %\begin{minipage}{0.24\textwidth} % \begin{lstlisting} %\begin{itemize} % \item 1 % \begin{itemize} % \item 2 % \end{itemize} %\end{itemize}\end{lstlisting} %\end{minipage}\quad %you can just write ~ %\begin{minipage}{0.22\textwidth} % \begin{lstlisting} %\begin{itemize} %\item 1 %\iitem 2 %\end{itemize}\end{lstlisting} %\end{minipage} % % But there \emph{has to be} an \verb|\item| at the beginning of the list (it's the default behavior of lists). And they \emph{don't} work in \verb|\footnote{}| etc. %\bigskip % %Of course it also works with \verb|enumerate|, \verb|description|, and several others (e.g. compactitem, \dots{} from \verb|paralist|). \bigskip % %\begin{minipage}{0.49\textwidth} %\begin{lstlisting} %\begin{enumerate} % \item First % \iitem Second % \iitem Second two % \iiitem Third % \iiitem Third two % \iitem Second three % \iiitem Third % \ivtem Fourth % \ivtem Fourth four % \iitem Second four % \ivtem Fourth % \end{enumerate}\end{lstlisting} %\end{minipage}\hfill% %\begin{minipage}{0.49\textwidth} % \begin{enumerate} % \item First % \iitem Second % \iitem Second two % \iiitem Third % \iiitem Third two % \iitem Second three % \iiitem Third % \ivtem Fourth % \ivtem Fourth two %\iitem Second four % \ivtem Fourth % \end{enumerate} %\end{minipage}\bigskip\bigskip % % % % \section{What doesn't work} % I am bad at explaining so here is an example: % %\begin{minipage}{0.49\textwidth} %\begin{lstlisting} %\begin{enumerate} % \item Using the ``normal'' item, % you can make paragraphs and the text %is still caught by the item. % \iitem Using the new commands, this doesn't work anymore. %If you make a paragraph, the text isn't caught anymore. %\iiitem So it's the best, if you write a long sentence after an iitem, iiitem and ivtem that you write the sentence in a long line. % \end{enumerate}\end{lstlisting} %\end{minipage}\hfill% %\begin{minipage}{0.49\textwidth} %\begin{enumerate} % \item Using the ``normal'' item, % you can make paragraphs and the text %is still caught by the item. % \iitem Using the new commands, this doesn't work anymore. %If you make a paragraph, the text isn't caught anymore. %\iiitem So it's the best, if you write a long sentence after an iitem, iiitem and ivtem that you write the sentence in a long line. %\end{enumerate} %\end{minipage}\bigskip % % \section{Any ideas?} % Like I said before you cannot use them in \verb|\footnote{}| etc. % If anyone has the knowledge of how this behavior can be changed, he or she might write an email to me (I don't have the knowledge to do it). % % \section{Code (in german)} % In der ersten Zeile steht immer dasselbe: Was brauche ich, wie hei§t das Paket. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{iitem} [2013/03/31 v1.0 Go a step deeper in lists using the new commands ``iitem'', ``iiitem'' and ``ivtem''.] % \end{macrocode} %\begin{macro}{\Pseudo@item} % Unsere Befehle werden dadurch definiert, dass Umgebungen um ein \verb|\item| in der Mitte gebaut werden. % Nun muss aber in jeder Liste ein \verb|\item| vorhanden sein. % Um dieses Problem zu lšsen, definiere ich dieses \verb|\Pseudo@item|. % Es ist eigentlich nichts anderes, als ein unsichtbares \verb|\item|. % \begin{macrocode} \def\Pseudo@item{{{% \@inmatherr\item \@ifnextchar [\@item{\@item[]} }}} % \end{macrocode} %\end{macro} %\begin{macro}{iitemcounter} %\begin{macro}{iiitemcounter} %\begin{macro}{ivtemcounter} % Damit die Nummerierung bei \verb|enumerate| richtig funktioniert, brauchen wir diese drei ZŠhler. % \begin{macrocode} \newcounter{iitemcounter} \newcounter{iiitemcounter} \newcounter{ivtemcounter} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} %\begin{macro}{\item} % Ich hoffe, ich mach keinen Blšdsinn \dots{} % Zuerst sage ich ihm, dass \verb|\AltesItem| \verb|\item| ist. % Dann definiere ich \verb|\item| um: Wir brauchen diese Konstruktion, damit die Nummerierung funktioniert. % Die ZŠhler werden auf Null gesetzt, wenn ein \verb|\item| auf der obersten Ebene geschrieben wird. % \begin{macrocode} \let\AltesItem\item \renewcommand{\item}{% \if@nmbrlist% \ifnum% \@enumdepth=1% \setcounter{iitemcounter}{0}% \setcounter{iiitemcounter}{0}% \setcounter{ivtemcounter}{0}% \fi% \fi% \AltesItem} % \end{macrocode} %\end{macro} % \begin{macro}{\iitem@line@command} % Eigentlich habe ich ja keine Ahnung von \LaTeX{} Code und dem Programmieren damit. %Aber zum GlŸck fand ich folgenden Code auf dieser Internetseite: \href{http://tex.stackexchange.com/questions/10426/def-taking-rest-of-the-line-as-argument}{http://tex.stackexchange.com/questions/10426/def-taking-rest-of-the-line-as-argument}. % Ich habe den Code genommen, den Namen geŠndert und hier ist er: % \begin{macrocode} \newcommand*{\iitem@line@command}[2]{% \newcommand*{#1}{% \begingroup% \escapechar=`\\% \catcode\endlinechar=\active% \csname\string#1\endcsname% }% \begingroup% \escapechar=`\\% \lccode`\~=\endlinechar% \lowercase{% \expandafter\endgroup \expandafter\def\csname\string#1\endcsname##1~% }{\endgroup#2\space}% } % \end{macrocode} %\end{macro} % \begin{macro}{\iitem} % Wir definieren \verb|\iitem|. % Als erstes setzen wir \verb|\partopsep0pt| damit die AbstŠnde nicht zu gro§ sind. % Danach kommt die Umgebung: ich benutze das Makro \verb|\@currenvir|, dieses hat die Umgebung, die gerade aktiv, ist gespeichert (z.B.~itemize, enumerate, description, etc.). % Wenn ich einfach \verb|\begin{\@currenvir}| hinschreiben wŸrde, wŸrde \LaTeX{} zuerst \verb|\begin{| ausfŸhren, dann auf \verb|\@currenvir| sto§en und versuchen, dieses als Umgebung zu aktivieren. % Da dies aber nicht funktioniert, brauchen wir \verb|\exapndafter|: Mit dem Ersten, springen wir zum Zweiten, und mit diesem, sagen wir, dass \LaTeX{} \verb|\@currenvir| aktivieren soll, sprich \verb|\@currenvir| wird zu der gerade aktiven Umgebung. % Dann kommt \verb|\begin{|. \LaTeX{} liest also z.B.~\verb|\begin{itemize}| statt \verb|\begin{\@currenvir}| % % Noch da? Als nŠchstes prŸfen wir, ob es eine Nummernliste ist, wenn ja, sagen wir das der merkwŸrdige \verb|\@listctr| Befehl auf \verb|\theiitemcounter| gesetzt wird, damit kommt die richtige Nummerierung zustande (hoffentlich). % Danach schreiben wir \verb|\item| hin, schlie§en die Umgebung und erhšhen \verb|iitemcounter| um eins, und setzen \verb|iiitemcounter| auf 0. % \begin{macrocode} \iitem@line@command{\iitem}{\partopsep0pt% \expandafter\begin\expandafter{\@currenvir}% \if@nmbrlist\setcounter{\@listctr}{\theiitemcounter}\fi% \item #1% \expandafter\end\expandafter{\@currenvir}% \stepcounter{iitemcounter}% \setcounter{iiitemcounter}{0}\setcounter{ivtemcounter}{0}} % \end{macrocode} %\end{macro} % \begin{macro}{\iiitem} % Eigentlich dasselbe wie vorher. % Nur kommt hier \verb|\Pseudo@item| ins Spiel. % Wenn wir diesen Befehl nicht einfŸgen, meldet \LaTeX{} einen Fehler, da ein \verb|\item| fehlt (missing item). Der Rest ist mehr oder weniger derselbe. % \begin{macrocode} \iitem@line@command{\iiitem}{\partopsep0pt% \expandafter\begin\expandafter{\@currenvir}\Pseudo@item% \expandafter\begin\expandafter{\@currenvir}% \if@nmbrlist\setcounter{\@listctr}{\theiiitemcounter}\fi% \item #1 \expandafter\end\expandafter{\@currenvir}% \expandafter\end\expandafter{\@currenvir}% \stepcounter{iiitemcounter}\setcounter{ivtemcounter}{0}} % \end{macrocode} %\end{macro} % \begin{macro}{\ivtem} % Selbe wie vorher. % \begin{macrocode} \iitem@line@command{\ivtem}{\partopsep0pt% \expandafter\begin\expandafter{\@currenvir}\Pseudo@item% \expandafter\begin\expandafter{\@currenvir}\Pseudo@item% \expandafter\begin\expandafter{\@currenvir}% \if@nmbrlist \setcounter{\@listctr}{\theivtemcounter}\fi% \item #1% \expandafter\end\expandafter{\@currenvir}% \expandafter\end\expandafter{\@currenvir}% \expandafter\end\expandafter{\@currenvir}% \stepcounter{ivtemcounter}} % \end{macrocode} %\end{macro} % Well that's it. Happy \TeX ing. %\PrintChanges \PrintIndex