Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wanted to create linguex examples where the free translation line has a hanging indent of 21.3 big points. I found that use of the hanging package, which is simple enough, does not work (second example in code). Reading the relevant section of the TeXbook (after three days) yielded a less simple solution which does work (first example in code). Why does use of the hanging package fail?

\tracingmacros=1
\documentclass{article}
\usepackage{hanging}
\usepackage{linguex}
\usepackage{lipsum}

\begin{document}

\ex .
\gll    Mundus vult decipi      \\
        world want deceive      \\
\glt    \dimen0=\the\textwidth
        \dimen1=\the\textwidth
        \dimen2=21.3bp
        \advance\dimen0 by -\the\labelwidth
        \advance\dimen1 by -\the\labelwidth
        \advance\dimen1 by -\dimen2
        \advance\dimen2 by \the\labelwidth
        \parshape=2 \the\labelwidth \dimen0 \dimen2 \dimen1
        \lipsum[2]



\ex .
\gll    Mundus vult decipi      \\
        world want deceive      \\
\glt    \hangpara{21.3bp}{2}\lipsum[2]

\end{document}

Output of the above code is as follows: enter image description here

share|improve this question
1  
The glossing macros (defined in cgloss4e.sty) are essentially lists, and so the indentation for them is set before the text of the paragraph is encountered. The \hangpara macro uses the TeX macros \hangindent and \hangafter underlyingly, not the more general \parshape command. I don't know why the TeX \parshape command is able to override everything, but it clearly is. –  Alan Munn Nov 16 '13 at 5:18
    
@AlanMunn If both \parshape and \hangindent are non zero, then the former wins. In a list environment the declaration \everypar{\parshape1\leftmargin\linewidth} is executed (not the real truth, but a good approximation to it). –  egreg Nov 16 '13 at 17:00
add comment

1 Answer

up vote 3 down vote accepted

As Alan Munn says in his comment, linguex basically uses list environments; inside a list environment at every paragraph start an instruction \parshape1 is executed, which wins over setting \hangindent. So any setting to \hangindent is ignored. You can use a list yourself: the setting is not difficult at all:

\documentclass{article}
\usepackage{linguex}
\usepackage{lipsum}

\begin{document}

\ex .
\gll  Mundus vult decipi \\
      world want deceive \\
\glt  \begin{list}{}{%
        \leftmargin=21.3pt
        \itemindent=-\leftmargin}
      \item[]\lipsum*[2]
      \end{list}

\end{document}

You probably want to define your own environment for this:

\newcommand{myindentedpar}[1][21.3pt]
 {\begin{list}{}{\leftmargin=#1 \itemindent=-\leftmargin}\item[]}
 {\end{list}}

so the above can be specified as

\glt  \begin{myindentedpar}
      \lipsum*[2]
      \end{myindentedpar}

A different amount of indentation can be specified in the optional argument

\begin{myindentedpar}[30pt]
\lipsum*[2]
\end{myindentedpar}

Here's the result with 21.3pt:

enter image description here

share|improve this answer
    
great answer. thanks! –  jlovegren Nov 16 '13 at 18:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.