]> git.lyx.org Git - lyx.git/blob - lib/layouts/hanging.module
950148ae1ebaf7df3f435f459d4abb5a216cb3c4
[lyx.git] / lib / layouts / hanging.module
1 #\DeclareLyXModule{Hanging}
2 #DescriptionBegin
3 #Adds an environment for hanging paragraphs. 
4 #Hanging paragraph is a paragraph in which the first line is set to the left margin, but all subsequent lines are indented.
5 #DescriptionEnd
6
7 #Author: Richard Heck
8
9 #Hanging paragraph code adapted from hanging.sty, available at:
10 # http://www.ctan.org/tex-archive/macros/latex/contrib/hanging/
11 #Copyright Peter R. Wilson.
12 #Released under the LaTeX Project Public License.
13
14 Format 11
15
16 Style Hanging
17   LatexType Environment
18   LatexName hangparagraphs
19   Align Block
20   Margin Static
21   LeftMargin "MMMM"
22   ParIndent "-MMMM"
23   Requires      ifthen
24   Preamble
25     \newlength{\lyxhang}
26     \IfFileExists{hanging.sty}{
27       \usepackage{hanging}
28       \newenvironment{hangparagraphs}
29         {%
30           \ifthenelse{\lengthtest{\parindent > 0pt}}%
31             {\setlength{\lyxhang}{\parindent}}%
32             {\setlength{\lyxhang}{2em}}%
33           \par\begin{hangparas}{\lyxhang}{1}%
34         }
35         {\end{hangparas}}
36     }{%else
37       \newenvironment{hangparagraphs}
38         {%
39           \ifthenelse{\lengthtest{\parindent > 0pt}}%
40             {\setlength{\lyxhang}{\parindent}}%
41             {\setlength{\lyxhang}{2em}}%
42           \begin{hangparas}%
43         }
44         {\end{hangparas}}
45       \newcommand{\hangpara}{\hangindent \lyxhang \hangafter 1 \noindent}
46       \newenvironment{hangparas}{\setlength{\parindent}{\z@}
47       \everypar={\hangpara}}{\par}
48     }
49   EndPreamble
50 End