General ⇒ A new env. like description items
A new env. like description items
Let's say I wanted to make a new environment that looks like a description list item, that is, the first line is not indented, but the rest of the lines are. How can I do that?
And, just out of curiosity, could I make an environment that would indent every two lines?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
A new env. like description items
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: A new env. like description items
Oh, maybe I wasn't clear enough... I dont want to make some kind of list, I want to make an env that looks kind of like a description item, but that has nothing to do with some kind of list.
A new env. like description items
Code: Select all
\parindent=0pt
\hangindent=24pt
\hangafter=1
Text...
A new env. like description items
Yes, with the \parshape command you can use every possible combination of indentations:tufflax wrote:And, just out of curiosity, could I make an environment that would indent every two lines?
Code: Select all
\newcommand*\AltIndentParShape[2]{%
\ifnum#1>0 %
0pt \linewidth \dimexpr(#2) \dimexpr\linewidth-(#2) %
\expandafter\AltIndentParShape\expandafter{\number\numexpr#1-2}{#2}%
\fi
}
\newenvironment{AlternatingIndent}[2]{%
\everypar{\parshape#1 \AltIndentParShape{#1}{#2}}%
}{}
Code: Select all
\begin{AlternatingIndent}{100}{6pt+12pt}
... Text ...
\end{AlternatingIndent}