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