Discussion:
New definition of the enumerate environment [follows the \hss thread below]
(too old to reply)
Bob
2005-08-02 15:00:32 UTC
Permalink
This is the complete test code for the task, to play with.
The task consists in reshaping the enumerate environment
so that its items look like normal paragraphs, e.g:

1. sdj fklsd jfksd jflk
sd fjksd fjksld fjksdl fjs.
2. sdjfk sjdfk sdjfklsd
s dkfl sdkfl; sdkfl; dskf;.
...
100. sdfj jdfk lsdfjk l
s jdfl sjdkfl sjdfkl sdjfkl.

Bob


\documentclass{book}

\makeatletter
\newlength{\theindent}\setlength{\theindent}{\parindent}

\newcount\@enumdepth \@enumdepth = 0

\@definecounter{enumi}
\@definecounter{enumii}
\@definecounter{enumiii}

%\def\llap#1{\***@xt@\z@{\hss#1}}

\def\enumerate{%
\ifnum \@enumdepth > 3
\@toodeep
\else
\advance \@enumdepth 1
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter
\list
\csname label\@enumctr\endcsname%
{% Label:
\usecounter\@enumctr%
% \def\makelabel##1{\hss\llap{##1}}%
\def\makelabel##1{.\hspace*{\theindent}.{##1}}%
% \setlength{\labelwidth}{0pt}% auto
\setlength{\labelsep}{1ex}%
% Horizontal spacing:
% \setlength{\leftmargin}{0pt}% default
\setlength{\rightmargin}{0pt}% default
% \setlength{\itemindent}{0pt}% no extra indentation
% \setlength{\listparindent}{0pt}%
% Vertical spacing:
\setlength{\topsep}{\topskip}% space from preceding paragraph
\setlength{\partopsep}{0pt}% no extra space at the top of the
list
\setlength{\parsep}{0pt}% no white line between paragraphs
within an item
\setlength{\itemsep}{0pt}% no white line between items
\setlength{\parskip}{\parsep}%
}%
\fi}
\let\endenumerate =\endlist

\makeatother
% end-local

\begin{document}

Text.

\hspace*{\parindent}Indented text.

\hspace*{2\parindent}Indented text.

\begin{itemize}
\item One sdk lfs dkfl;sk dfls;dkf ls;df 'sdlkf sdkfls djfksdl fjskdlf
;sdkjf sjdfkls f;slkdjf sjdkfl; sdflksd fjskdlf slkdf dlfksd fljsdklf
sdkfj sdlkjf sdjkfls; df jsdkfl;s dflsdkjf sdjfklsd fjdlkf jsdklf.
\item Two asd jkasld jaksd alksdj aksld alksdj jaskdl asldka sjdklas
dlaskd jaskdl alsdkja sjdkla sdlkas djaksld alksdj asjdkla sdlkasdj
jaskdl asdlkaj sd:
\begin{itemize}
\item Three s djfkls;df sldkf sdjffklsd ;fsldkfjs dfjkdslf dslkfjsd
fjkd fdlskfsd hfjsd fsdklf pweijf ja;djmemijexm hflsd fhsdf hsdf hdls
fhjsdf hjdskfl hdjkfh sfhjsl dfh jsdkflhksdf.
\item Four d fjksdlf ;sdkfj sdjfklds f ghd dkjhgf sdgfhs dg fsdff
dkjfhs lf dshfjksd fhjdsfhfuiueh fse neks ksdn cdsmclksdm c;sdkc sac
sdhcksdc sc s'cs 'cs dcsd.
\end{itemize}
\item Five as djkasd lajsd jaskld laksjd jaskld alksdj ajskld alksdj
ajskld alskdj ajsdkla sldka sdlkjaslkd aslkjd:
\begin{enumerate}
\item Six asd jksld jklsad fjklsdf jklsdf jklsdf jkdlf s;ldkjf kdslf
sl;kdjf jkdslf sd;lkfj sdjfkl;sd f dfjksl dfjkls; dfj sa;dljf ksld;f
jskldfj ;lsdf.
\item Seven s djfkls ;dfj;sldkjf skdlf sdkfjs dfjklsd; fjsodf sdhfjksld
fdlf; sjdfkls;df s;dlfkjs djfklds; fjs;ldkfj sdkfl;sdf.
\end{enumerate}
\item Eight
\end{itemize}

More text.

\begin{enumerate}
\item One asd jkasld jlkasdj kasld aljksd jaskld alskdj ajsdka sdja
sdjkals dlaksd ajskdl asldkja sdjklas dlaksjd asdasdasda asda sd.
\item Two asj dklasd laksjd jskdla dlaksjd sjkdla dlaskjd sjkdlas
dlaksjd jdksla dalksjd jsdkal dlaksjd ajksdasd.
\begin{itemize}
\item Three (nested) jaskld alskdja sdjksld alksjd ajsdkls dalksjd
ajsdklas dlaskdja sdjkasl dlaskdj asjkdlas dasdasd.
\item Four (nested) a sjdkas dlaksjd sdjksd alkjddias djasklnaslx ndc
amc maslkdcmsd caosidc asncsad c.
\end{itemize}
\item Five
\begin{enumerate}
\item Six (nested)
\item Seven (nested)
\end{enumerate}
\item Eight
\end{enumerate}

\end{document}
Bob
2005-08-02 15:19:45 UTC
Permalink
... one step forward. The leftmargin of enumerate behaves
differently depending on the enclosing environment.

Bob


\documentclass{book}

\makeatletter
\newlength{\theindent}\setlength{\theindent}{\parindent}

\newcount\@enumdepth \@enumdepth = 0

\@definecounter{enumi}
\@definecounter{enumii}
\@definecounter{enumiii}

%\def\llap#1{\***@xt@\z@{\hss#1}}

\def\enumerate{%
\ifnum \@enumdepth > 3
\@toodeep
\else
\advance \@enumdepth 1
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter
\list
\csname label\@enumctr\endcsname%
{% Label:
\usecounter\@enumctr%
% \def\makelabel##1{\hss\llap{##1}}%
\def\makelabel##1{\hspace*{\theindent}{##1}}%
\setlength{\labelwidth}{0pt}% auto
\setlength{\labelsep}{1ex}%
% Horizontal spacing:
\setlength{\leftmargin}{0pt}% default
\setlength{\rightmargin}{0pt}% default
\setlength{\itemindent}{0pt}% no extra indentation
\setlength{\listparindent}{0pt}%
% Vertical spacing:
\setlength{\topsep}{\topskip}% space from preceding paragraph
\setlength{\partopsep}{0pt}% no extra space at the top of the
list
\setlength{\parsep}{0pt}% no white line between paragraphs
within an item
\setlength{\itemsep}{0pt}% no white line between items
\setlength{\parskip}{\parsep}%
}%
\fi}
\let\endenumerate =\endlist

\makeatother
% end-local

\begin{document}

Text.

\hspace*{\parindent}Indented text.

\hspace*{2\parindent}Indented text.

\begin{itemize}
\item One sdk lfs dkfl;sk dfls;dkf ls;df 'sdlkf sdkfls djfksdl fjskdlf
;sdkjf sjdfkls f;slkdjf sjdkfl; sdflksd fjskdlf slkdf dlfksd fljsdklf
sdkfj sdlkjf sdjkfls; df jsdkfl;s dflsdkjf sdjfklsd fjdlkf jsdklf.
\item Two asd jkasld jaksd alksdj aksld alksdj jaskdl asldka sjdklas
dlaskd jaskdl alsdkja sjdkla sdlkas djaksld alksdj asjdkla sdlkasdj
jaskdl asdlkaj sd:
\begin{itemize}
\item Three s djfkls;df sldkf sdjffklsd ;fsldkfjs dfjkdslf dslkfjsd
fjkd fdlskfsd hfjsd fsdklf pweijf ja;djmemijexm hflsd fhsdf hsdf hdls
fhjsdf hjdskfl hdjkfh sfhjsl dfh jsdkflhksdf.
\item Four d fjksdlf ;sdkfj sdjfklds f ghd dkjhgf sdgfhs dg fsdff
dkjfhs lf dshfjksd fhjdsfhfuiueh fse neks ksdn cdsmclksdm c;sdkc sac
sdhcksdc sc s'cs 'cs dcsd.
\end{itemize}
\item Five as djkasd lajsd jaskld laksjd jaskld alksdj ajskld alksdj
ajskld alskdj ajsdkla sldka sdlkjaslkd aslkjd:
\begin{enumerate}
\item Six asd jksld jklsad fjklsdf jklsdf jklsdf jkdlf s;ldkjf kdslf
sl;kdjf jkdslf sd;lkfj sdjfkl;sd f dfjksl dfjkls; dfj sa;dljf ksld;f
jskldfj ;lsdf.
\item Seven s djfkls ;dfj;sldkjf skdlf sdkfjs dfjklsd; fjsodf sdhfjksld
fdlf; sjdfkls;df s;dlfkjs djfklds; fjs;ldkfj sdkfl;sdf.
\end{enumerate}
\item Eight
\end{itemize}

More text.

\begin{enumerate}
\item One asd jkasld jlkasdj kasld aljksd jaskld alskdj ajsdka sdja
sdjkals dlaksd ajskdl asldkja sdjklas dlaksjd asdasdasda asda sd.
\item Two asj dklasd laksjd jskdla dlaksjd sjkdla dlaskjd sjkdlas
dlaksjd jdksla dalksjd jsdkal dlaksjd ajksdasd.
\begin{itemize}
\item Three (nested) jaskld alskdja sdjksld alksjd ajsdkls dalksjd
ajsdklas dlaskdja sdjkasl dlaskdj asjkdlas dasdasd.
\item Four (nested) a sjdkas dlaksjd sdjksd alkjddias djasklnaslx ndc
amc maslkdcmsd caosidc asncsad c.
\end{itemize}
\item Five jaskld alskdja sdjksld alksjd ajsdkls dalksjd ajsdklas
dlaskdja sdjkasl dlaskdj asjkdlas dasdasd:
\begin{enumerate}
\item Six (nested)
\item Seven (nested)
\end{enumerate}
\item Eight
\end{enumerate}

\end{document}
Hendrik Maryns
2005-08-02 16:19:23 UTC
Permalink
Post by Bob
This is the complete test code for the task, to play with.
The task consists in reshaping the enumerate environment
1. sdj fklsd jfksd jflk
sd fjksd fjksld fjksdl fjs.
2. sdjfk sjdfk sdjfklsd
s dkfl sdkfl; sdkfl; dskf;.
...
100. sdfj jdfk lsdfjk l
s jdfl sjdkfl sjdfkl sdjfkl.
Without looking at the code, I think you should have a look at the
paralist package.

H.
--
Hendrik Maryns

Interesting websites:
www.lieverleven.be (I cooperate)
www.eu04.com European Referendum Campaign
aouw.org The Art Of Urban Warfare
Bob
2005-08-02 17:24:47 UTC
Permalink
Thank you!
Thank you!
Thank you!
Thank you!
Thank you!
Thank you!

;-)
p***@gmail.com
2020-04-30 17:54:40 UTC
Permalink
Post by Bob
This is the complete test code for the task, to play with.
The task consists in reshaping the enumerate environment
1. sdj fklsd jfksd jflk
sd fjksd fjksld fjksdl fjs.
2. sdjfk sjdfk sdjfklsd
s dkfl sdkfl; sdkfl; dskf;.
...
100. sdfj jdfk lsdfjk l
s jdfl sjdkfl sjdfkl sdjfkl.
Bob
\documentclass{book}
\makeatletter
\newlength{\theindent}\setlength{\theindent}{\parindent}
\def\enumerate{%
\else
\expandafter
\list
% \def\makelabel##1{\hss\llap{##1}}%
\def\makelabel##1{.\hspace*{\theindent}.{##1}}%
% \setlength{\labelwidth}{0pt}% auto
\setlength{\labelsep}{1ex}%
% \setlength{\leftmargin}{0pt}% default
\setlength{\rightmargin}{0pt}% default
% \setlength{\itemindent}{0pt}% no extra indentation
% \setlength{\listparindent}{0pt}%
\setlength{\topsep}{\topskip}% space from preceding paragraph
\setlength{\partopsep}{0pt}% no extra space at the top of the
list
\setlength{\parsep}{0pt}% no white line between paragraphs
within an item
\setlength{\itemsep}{0pt}% no white line between items
\setlength{\parskip}{\parsep}%
}%
\fi}
\let\endenumerate =\endlist
\makeatother
% end-local
\begin{document}
Text.
\hspace*{\parindent}Indented text.
\hspace*{2\parindent}Indented text.
\begin{itemize}
\item One sdk lfs dkfl;sk dfls;dkf ls;df 'sdlkf sdkfls djfksdl fjskdlf
;sdkjf sjdfkls f;slkdjf sjdkfl; sdflksd fjskdlf slkdf dlfksd fljsdklf
sdkfj sdlkjf sdjkfls; df jsdkfl;s dflsdkjf sdjfklsd fjdlkf jsdklf.
\item Two asd jkasld jaksd alksdj aksld alksdj jaskdl asldka sjdklas
dlaskd jaskdl alsdkja sjdkla sdlkas djaksld alksdj asjdkla sdlkasdj
\begin{itemize}
\item Three s djfkls;df sldkf sdjffklsd ;fsldkfjs dfjkdslf dslkfjsd
fjkd fdlskfsd hfjsd fsdklf pweijf ja;djmemijexm hflsd fhsdf hsdf hdls
fhjsdf hjdskfl hdjkfh sfhjsl dfh jsdkflhksdf.
\item Four d fjksdlf ;sdkfj sdjfklds f ghd dkjhgf sdgfhs dg fsdff
dkjfhs lf dshfjksd fhjdsfhfuiueh fse neks ksdn cdsmclksdm c;sdkc sac
sdhcksdc sc s'cs 'cs dcsd.
\end{itemize}
\item Five as djkasd lajsd jaskld laksjd jaskld alksdj ajskld alksdj
\begin{enumerate}
\item Six asd jksld jklsad fjklsdf jklsdf jklsdf jkdlf s;ldkjf kdslf
sl;kdjf jkdslf sd;lkfj sdjfkl;sd f dfjksl dfjkls; dfj sa;dljf ksld;f
jskldfj ;lsdf.
\item Seven s djfkls ;dfj;sldkjf skdlf sdkfjs dfjklsd; fjsodf sdhfjksld
fdlf; sjdfkls;df s;dlfkjs djfklds; fjs;ldkfj sdkfl;sdf.
\end{enumerate}
\item Eight
\end{itemize}
More text.
\begin{enumerate}
\item One asd jkasld jlkasdj kasld aljksd jaskld alskdj ajsdka sdja
sdjkals dlaksd ajskdl asldkja sdjklas dlaksjd asdasdasda asda sd.
\item Two asj dklasd laksjd jskdla dlaksjd sjkdla dlaskjd sjkdlas
dlaksjd jdksla dalksjd jsdkal dlaksjd ajksdasd.
\begin{itemize}
\item Three (nested) jaskld alskdja sdjksld alksjd ajsdkls dalksjd
ajsdklas dlaskdja sdjkasl dlaskdj asjkdlas dasdasd.
\item Four (nested) a sjdkas dlaksjd sdjksd alkjddias djasklnaslx ndc
amc maslkdcmsd caosidc asncsad c.
\end{itemize}
\item Five
\begin{enumerate}
\item Six (nested)
\item Seven (nested)
\end{enumerate}
\item Eight
\end{enumerate}
\end{document}
Peter Flynn
2020-04-30 21:37:09 UTC
Permalink
Post by Bob
This is the complete test code for the task, to play with.
The task consists in reshaping the enumerate environment
I think you can do this with the enumerate package, eg:

======================================================================
\documentclass{article}
\usepackage{enumitem}
\begin{document}
This is the complete test code for the task, to play with. The task
consists in reshaping the enumerate environment so that its items look
like normal paragraphs, e.g:
\begin{enumerate}[leftmargin=0pt,itemindent=3em,align=left,labelwidth=0pt]
\item sdj fklsd jfksd jflk
sd fjksd fjksld fjksdl fjs.
\item sdjfk sjdfk sdjfklsd
s dkfl sdkfl; sdkfl; dskf;.
\setcounter{enumi}{99}
\item sdfj jdfk lsdfjk l
s jdfl sjdkfl sjdfkl sdjfkl.
\item This is a test of a much longer item which wraps to the next
line, so that we can see that the hung indentation has been
defeated.
\end{enumerate}
\end{document}
=====================================================================

Peter
Post by Bob
1. sdj fklsd jfksd jflk
sd fjksd fjksld fjksdl fjs.
2. sdjfk sjdfk sdjfklsd
s dkfl sdkfl; sdkfl; dskf;.
...
100. sdfj jdfk lsdfjk l
s jdfl sjdkfl sjdfkl sdjfkl.
Bob
\documentclass{book}
\makeatletter
\newlength{\theindent}\setlength{\theindent}{\parindent}
\def\enumerate{%
\else
\expandafter
\list
% \def\makelabel##1{\hss\llap{##1}}%
\def\makelabel##1{.\hspace*{\theindent}.{##1}}%
% \setlength{\labelwidth}{0pt}% auto
\setlength{\labelsep}{1ex}%
% \setlength{\leftmargin}{0pt}% default
\setlength{\rightmargin}{0pt}% default
% \setlength{\itemindent}{0pt}% no extra indentation
% \setlength{\listparindent}{0pt}%
\setlength{\topsep}{\topskip}% space from preceding paragraph
\setlength{\partopsep}{0pt}% no extra space at the top of the
list
\setlength{\parsep}{0pt}% no white line between paragraphs
within an item
\setlength{\itemsep}{0pt}% no white line between items
\setlength{\parskip}{\parsep}%
}%
\fi}
\let\endenumerate =\endlist
\makeatother
% end-local
\begin{document}
Text.
\hspace*{\parindent}Indented text.
\hspace*{2\parindent}Indented text.
\begin{itemize}
\item One sdk lfs dkfl;sk dfls;dkf ls;df 'sdlkf sdkfls djfksdl fjskdlf
;sdkjf sjdfkls f;slkdjf sjdkfl; sdflksd fjskdlf slkdf dlfksd fljsdklf
sdkfj sdlkjf sdjkfls; df jsdkfl;s dflsdkjf sdjfklsd fjdlkf jsdklf.
\item Two asd jkasld jaksd alksdj aksld alksdj jaskdl asldka sjdklas
dlaskd jaskdl alsdkja sjdkla sdlkas djaksld alksdj asjdkla sdlkasdj
\begin{itemize}
\item Three s djfkls;df sldkf sdjffklsd ;fsldkfjs dfjkdslf dslkfjsd
fjkd fdlskfsd hfjsd fsdklf pweijf ja;djmemijexm hflsd fhsdf hsdf hdls
fhjsdf hjdskfl hdjkfh sfhjsl dfh jsdkflhksdf.
\item Four d fjksdlf ;sdkfj sdjfklds f ghd dkjhgf sdgfhs dg fsdff
dkjfhs lf dshfjksd fhjdsfhfuiueh fse neks ksdn cdsmclksdm c;sdkc sac
sdhcksdc sc s'cs 'cs dcsd.
\end{itemize}
\item Five as djkasd lajsd jaskld laksjd jaskld alksdj ajskld alksdj
\begin{enumerate}
\item Six asd jksld jklsad fjklsdf jklsdf jklsdf jkdlf s;ldkjf kdslf
sl;kdjf jkdslf sd;lkfj sdjfkl;sd f dfjksl dfjkls; dfj sa;dljf ksld;f
jskldfj ;lsdf.
\item Seven s djfkls ;dfj;sldkjf skdlf sdkfjs dfjklsd; fjsodf sdhfjksld
fdlf; sjdfkls;df s;dlfkjs djfklds; fjs;ldkfj sdkfl;sdf.
\end{enumerate}
\item Eight
\end{itemize}
More text.
\begin{enumerate}
\item One asd jkasld jlkasdj kasld aljksd jaskld alskdj ajsdka sdja
sdjkals dlaksd ajskdl asldkja sdjklas dlaksjd asdasdasda asda sd.
\item Two asj dklasd laksjd jskdla dlaksjd sjkdla dlaskjd sjkdlas
dlaksjd jdksla dalksjd jsdkal dlaksjd ajksdasd.
\begin{itemize}
\item Three (nested) jaskld alskdja sdjksld alksjd ajsdkls dalksjd
ajsdklas dlaskdja sdjkasl dlaskdj asjkdlas dasdasd.
\item Four (nested) a sjdkas dlaksjd sdjksd alkjddias djasklnaslx ndc
amc maslkdcmsd caosidc asncsad c.
\end{itemize}
\item Five
\begin{enumerate}
\item Six (nested)
\item Seven (nested)
\end{enumerate}
\item Eight
\end{enumerate}
\end{document}
Peter Flynn
2020-04-30 21:38:06 UTC
Permalink
So quite why you're reposting a 15-year-old thread is a mystery.

Peter

Loading...