
O pacote de contornos reinicia a numeração do item após uma entrada \0, que é uma entrada do tipo parágrafo. A documentação do pacote de contornos fornece código de preâmbulo para evitar a reinicialização. Também uso \usepackage[inline]{enumitem}\setlist{nosep}
para reduzir o espaçamento vertical entre os itens do contorno. O código do preâmbulo para evitar a reinicialização do contador de estrutura de tópicos não é composto com o espaçamento reduzido do nível do item após o comando \0. Os níveis inferiores dos itens foram compostos com o espaçamento correto. Meu exemplo demonstra isso. Eu gostaria de remover o espaçamento extra. Acabei de notar que o código abaixo também rotula o primeiro e o segundo níveis com números inteiros, o que não é bom. Talvez uma solução melhor para o meu problema específico seja evitar o código de preâmbulo extra e remover o comando \renewcommand{\outlinei}{cenumerate}
e redefinir o contador do item seguindo um comando \0 manualmente. Eu não fui capaz de fazer isso.
\usepackage{outlines}
\usepackage[inline]{enumitem}
\setlist{nosep}
% The following code comes from the outlines package manual
\newcounter{cenum}
\newcounter{cenumsaved}
\setcounter{cenumsaved}{0}
\newcommand{\labelcenum}{\arabic{cenum}.}
\newenvironment{cenumerate}%
{\begin{list}{\labelcenum}{\usecounter{cenum}}%
\setcounter{cenum}{\value{cenumsaved}}}%
{\setcounter{cenumsaved}{\value{cenum}}%
\end{list}}
\begin{document}
\renewcommand{\outlinei}{cenumerate} % Comment this command to see the change in spacing
\begin{outline}[enumerate]
\1 First item - notice the extra spacing after this item
\2 First subitem
\2 Second subitem
\0 Some text
\1 Second item - notice the extra spacing before and after this item
\2 First subitem
\2 Second subitem
\1 Third item - notice the extra spacing before and after this item
\2 First subitem
\2 Second subitem
\end{outline}
\end{document}
Responder1
Algo assim?
\documentclass{article}
\usepackage{outlines}
\newcounter{cenumi}
\newcounter{cenumisaved}
\setcounter{cenumisaved}{0}
\newcommand{\labelcenumi}{\arabic{cenumi}.}
\newenvironment{cenumeratei}%
{\begin{list}{\labelcenumi}{\usecounter{cenumi}\partopsep=0pt\topsep=0pt\itemsep=0pt\parsep=0pt}%
\setcounter{cenumi}{\value{cenumisaved}}}%
{\setcounter{cenumisaved}{\value{cenumi}}%
\end{list}}
\newcounter{cenumii}
\setcounter{cenumii}{0}
\newcommand{\labelcenumii}{(\alph{cenumii})}
\newenvironment{cenumerateii}%
{\begin{list}{\labelcenumii}{\usecounter{cenumii}\partopsep=0pt\topsep=0pt\itemsep=0pt\parsep=0pt}%
}%
{%
\end{list}}
\begin{document}
\renewcommand{\outlinei}{cenumeratei}
\renewcommand{\outlineii}{cenumerateii}
\begin{outline}
\1 First item - notice the extra spacing after this item
\2 First subitem
\2 Second subitem
\0 Some text
\1 Second item - notice the extra spacing before and after this item
\2 First subitem
\2 Second subitem
\1 Third item - notice the extra spacing before and after this item
\2 First subitem
\2 Second subitem
\end{outline}
\end{document}
Talvez o código não esteja otimizado. Funciona apenas para dois níveis (mas facilmente expansível para 3 ou 4 níveis).
Responder2
Aceitei a solução postada acima por quark67 e mais tarde percebi que as referências cruzadas para itens aninhados listavam apenas o item pai. Por exemplo, uma referência cruzada ao item 1(a) reduzida à referência ao item 1. Enviei à DP Story uma nota pessoal sobre este assunto. Don criou uma solução diferente, postada abaixo, que respeita todas as referências cruzadas e adiciona mais flexibilidade. A solução de Don permite restaurar o contador de itens em qualquer nível anterior aninhado, seguindo o comando \0 com um comando \n, onde n é o nível a ser continuado. Um ambiente de estrutura de tópicos não pode começar com um comando \0, portanto o texto que precede uma estrutura de tópicos deve ser inserido antes desse ambiente.
\documentclass{article}
\usepackage{outlines}
\usepackage{enumitem}
\usepackage{calc} % dps
\setlist{noitemsep}
\setlist{nolistsep}
\makeatletter
\newif\if@needsRsm\@needsRsmfalse
\def\resumeToDefault{%
\global\let\resume@ti\@empty
\global\let\resume@tii\@empty
\global\let\resume@tiii\@empty
\global\let\resume@tiv\@empty
}
\resumeToDefault
\def\ol@csarg#1#2{\expandafter#1\csname#2\endcsname}
% Executed at \0
\def\setPrevLevel{\global\@needsRsmtrue % dps
\xdef\@prevLevel{\@curLevel}}
\def\@prevLevel{0}
% Placed within \curLevel, which is expanded at the beginning of \1, \2, \3, \4
\def\resumeIfNeeded#1{\if@needsRsm\def\@next{\expandafter
\resumeAt\expandafter{\csname#1\endcsname}}\else\let\@next\relax\fi\@next}
% Expanded within each level: \1, \2, \3, \4
\def\curLevel#1{\def\@curLevel{#1}\resumeIfNeeded{#1}}
% dps modify outline package: \ol@z (insert \item[] so we can use \0 at any level
\renewcommand{\ol@z}{%
\ol@commands%
{}% 0
{\ol@inci}% 1
{\ol@inci\item[]\ol@incii}% 2
{\ol@inci\item[]\ol@incii\item[]\ol@inciii}% 3
{\ol@inci\item[]\ol@incii\item[]\ol@inciii\item[]\ol@inciiii}}% 4
% dps modify outline package: outline env (add \olsave, \curLevel)
\renewenvironment{outline}[1][]{%
\ifthenelse{\equal{#1}{}}{}{\renewcommand{\ol@type}{#1}}%
\ol@z%
\newcommand{\0}{\olsave\setPrevLevel\ol@toz\ol@z}% dps incorporate \olsave into level \0
\newcommand{\1}{\curLevel{1}\ol@toi\ol@i\resume@ti\item}%
\newcommand{\2}{\curLevel{2}\ol@toii\ol@ii\resume@tii\item}%
\newcommand{\3}{\curLevel{3}\ol@toiii\ol@iii\resume@tiii\item}%
\newcommand{\4}{\curLevel{4}\ol@toiiii\ol@iiii\resume@tiv\item}%
}{%
\ol@toz\ol@exit%
}
\def\UD#1{\noexpand\setcounter{enum#1}{\@nameuse{s@veAt#1}}%
\global\noexpand\ol@csarg\let{resume@t\@roman\@tempcnta}\noexpand\@empty}
\newcommand\resumeAt[1]{\global\@needsRsmfalse\begingroup\resumeToDefault
\edef\r@t{\expandafter\@roman\expandafter\@gobble\string#1}%
\edef\n@t{\expandafter\@gobble\string#1}%
% When we are resuming at a higher level then the previous level,
% we zero all counters out below (new environment starting)
\ifnum\n@t>\@prevLevel\relax
\zeroOutBelow{\@prevLevel}\olsave\fi
\@tempcnta=0\relax\toks@={}%
\@whilenum\@tempcnta<\n@t\relax\do{\advance\@tempcnta\@ne
\edef\x{\UD{\@roman\@tempcnta}}%
\toks2=\expandafter{\x}\edef\y{\the\toks@\the\toks2 }%
\toks@=\expandafter{\y}%
}%
\edef\x{\noexpand\ol@csarg\noexpand
\xdef{resume@t\r@t}{\noexpand\the\noexpand\toks@}}\x
\endgroup\ignorespaces
}
\def\zeroOutBelow#1{\begingroup
\@tempcnta#1\relax
\@whilenum\@tempcnta<4\relax\do{%
\advance\@tempcnta\@ne
\setcounter{enum\@roman\@tempcnta}{0}}%
\endgroup
}
\def\olsave{\@tfor\n:={i}{ii}{iii}{iv}\do{%
\ol@csarg\xdef{s@veAt\n}{\the\value{enum\n}}}% do
}
\makeatother
\begin{document}
We begin the outline here
\begin{outline}[enumerate]
\1 First item
\2 First subitem
\3\label{cr} Item with label
\4 Fourth level
\4 Fourth level, again
\0 This is another comment
\2 Second subitem
\0 Some text here, let's make it long to see what happens when we wrap around to the next line.
\1 Second item
\2 \textbf{See item} \ref{cr}
\3 The above reference reads``See item 1''
\4 Let's not forget level 4
\4 Another level 4
\0 Hello world!
\2 Second subitem
\2 Second subitem
\0 Make my day!
\1 A third top level
\2 Level 2 item
\3 Level 3 item
\0 Let's break the outline here with a comment
\3 Level 3 item
\0 Do we continue as expected ?
\3 Level 3 for testing
% \4 More four to follow
\0 Now test level 4 in the same way
\4 Level 4
\4 Level 4, again
\0 Back to level 1
\1 back to level 1
\2 Another important point
\end{outline}
\end{document}