I would like to be able to control the nesting level of an item (so that I can align the text with text that is at a deeper level of nesting.) I have been able to read the value of \@itemdepth
counter. I was not able to change it. Is it possible to change the value of \@itemdepth
from my file and if so, how would I do it? Or is there a better way to do what I want to do? Thanks for any help you can provide.
A sample of the code I would like to get working. I am new to LaTeX and the code likely has several errors in it. Any help would be appreciated.
\documentclass{article}
\usepackage{amssymb, amsmath}
\usepackage{ifthen}
\makeatletter % needed to access \@itemdepth
\newcounter{hangparsindentedlevel}
\newenvironment{hangpars}[1][0]{%
\begin{list}{}{%
\setcounter {hangparsindentedlevel}{\@itemdepth}%
\ifthenelse {#1 > 0} { %
\setcounter {\@itemdepth}{#1}%
}%
{%
\relax%
}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\listparindent}{-\leftmargin}%
\setlength{\partopsep}{0in} \setlength{\parskip}{0in} \setlength{\topsep}{0in}%
}%
\item{}%
}%
{\end{list}}%
\makeatother
\begin{document}
\begin{hangpars}[0]
test text 1. test text 1. test text 1. test text 1. test text 1. test text 1. test text 1. test text 1. test text 1. test text 1.
\begin{hangpars}[2]
test text 2. test text 2. test text 2. test text 2. test text 2. test text 2. test text 2. test text 2. test text 2. test text 2.
\end{hangpars}
test text 3. test text 3. test text 3. test text 3. test text 3. test text 3. test text 3. test text 3. test text 3. test text 3.
\end{hangpars}
\end{document}
The output I was hoping for would have the firt line of the paragraph with test text 1 starting at the left most edge and all subsequent lines of the paragraph would be indented one level.
The first line of the paragraph with test text 2 (with the hangpars[2]) would start indented two levels from the left edge and all subsequent lines of the paragraph would be indented three levels.
The last paragraph would be formated as the first paragraph was.
test text 1. test text 1. test text 1. test text 1. test text 1.
test text 1. test text 1. test text 1. test text 1.
test text 1.
test text 2. test text 2. test text 2. test text 2.
test text 2. test text 2. test text 2. test
text 2. test text 2.
test text 3. test text 3. test text 3. test text 3. test text 3.
test text 3. test text 3. test text 3. test text 3.
test text 3.