General ⇒ \caption und \item too wide in self-defined environment
\caption und \item too wide in self-defined environment
I defined myself the following experiment-environment:
% definition of my own ``experiment'' environment
\newcounter{experimentCounter}
\renewcommand{\theexperimentCounter}{\arabic{chapter}.\arabic{section}.
\arabic{experimentCounter}}
\newenvironment{experiment}[3] {%
\setlength{\parindent}{0 pt}%
\sf%
\bigskip%
\stepcounter{experimentCounter}%
\refstepcounter{experimentCounter}%
\textbf{Experiment~\theexperimentCounter~(#1)}%
\setlength{\leftskip}{0.5cm}\setlength{\rightskip}{0.5cm}%
\par%
\textbf{Description:} #2%
\par%
\textbf{Expectation:} #3%
\par%
\textbf{Observation: }}{\normalfont
}
Basically, experiments are typeset a bit more narrow (see leftskip and rightskip). Apart from two excepions, I have no problems with this environment: only figure captions and \items of the itemize environment do not stick to the leftskip and rightskip settings of my environment. Is there a solution to this?
Any help is appreciated.
Cheers,
Raimund
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: \caption und \item too wide in self-defined environment
\setlength{\leftskip}{0.5cm}\setlength{\rightskip}{0.5cm}%
with:
\everypar{\setlength{\leftskip}{0.5cm}\setlength{\rightskip}{0.5cm}}%
Another solution would be to use
\advance \hsize by -0.5cm (check the syntax)\hangindent=0.5cm\hangafter=0
(and perhaps also an \everypar command).
BA
Re: \caption und \item too wide in self-defined environment
thanks for the suggestions, but both solutions did not work:
1)\everypar{...}% simply repeats the left- and rightskip for each paragrph, i.e., with each new paragraph the textwidth shrinks.
2) \advance \hsize by -0.5cm (check the syntax)\hangindent=0.5cm\hangafter=0
This can be used to replace my current \left- and rightskip code, but it behaves just the same for items and captions.
So far I found one solution for items (no very elegant): I simply put a copy of the \left- and rightskips after \begin{itemize}. For some reason this does not appear to work for \caption though...
Cheers,
Raimund
Re: \caption und \item too wide in self-defined environment
B.A.