4

The following contextgarden example from http://wiki.contextgarden.net/Description to produce a two-level description using ConTeXt doesn't work for me. The resulting pdf is as if all four items form a flat list rather than a two-level nested list. Moreover, all of the text ends up aligned to the right even though alignment to the left is specified in the ConTeXt code. How can I get the results that the above URL claims?

The ConTeXt code from the above URL is:

\setuppapersize[A5]
\definedescription[descr][
  headstyle=bold, style=normal, align=left, location=hanging, 
  width=broad, margin=1cm]

\starttext
\startdescr{Para}
  This is a shorter item label, and some text that talks about it.
  The text is wrapped into a paragraph, with successive lines indented.

  This is another paragraph under the "Para" item.
  \startdescr{Sub Item}  
    This is a description of an item which is within the "Para" item.
  \stopdescr
  \startdescr{Sub Item} 
    Another Sub Item 
  \stopdescr
\stopdescr
\startdescr{Short}
  A short item that's not part of that really long "Para" item.
\stopdescr

\stoptext

ConTeXt version 2014.01.03 00:40 produces a pdf that is schematically like this:

Para  This is a shorter item label, and some text
        that talks about it.  The text is wrapped
      into a paragprah, with successive lines in-
                                          dented.
              This is another paragraph under the
                                     "Para" item.

      Sub Item  This is a description of an item
                 which is within the "Para" item.

                      Sub Item  Another Sub Item

 Short  A short item that's not part of that re-
                          ally long "Para" item.

Removing the "location=hanging" attribute changes the results to

  Para        This is a shorter item label, and
              some text that talks about it.  The
              text is wrapped into a paragprah,
              with successive lines indented.
              This is another paragraph under
              the "Para" item.

  Sub Item    This is a description of an item which
              is within the "Para" item.

  Sub Item    Another Sub Item

  Short       A short item that's not part of that
              really long "Para" item.

which looks better but still treats the list as if it were flat. What I'm looking for is something similar to this:

Para    This is a shorter item label, and some
    text that talks about it.  The text is
    wrapped into a paragprah, with successive
    lines indented.
    This is another paragraph under the "Para"
    item.

    Sub Item    This is a description of an
        item which is within the "Para" item.

    Sub Item    Another Sub Item

Short    A short item that's not part of that
    really long "Para" item.

1 Answer 1

4

As mentioned on the wiki page, in MkIV, you have to use alternative=hanging. You also probably want align=flushleft rather than align=left (which gives ragged left output, see the FAQ). With these changes, I get:

\setuppapersize[A5]
\definedescription
  [descr]
  [
    headstyle=bold, 
    style=normal,
    align=flushleft,
    alternative=hanging, 
    width=broad,
    margin=1cm,
  ]

\starttext
\startdescr{Para}
  This is a shorter item label, and some text that talks about it.
  The text is wrapped into a paragraph, with successive lines indented.

  This is another paragraph under the "Para" item.
  \startdescr{Sub Item}  
    This is a description of an item which is within the "Para" item.
  \stopdescr
  \startdescr{Sub Item} 
    Another Sub Item 
  \stopdescr
\stopdescr
\startdescr{Short}
  A short item that's not part of that really long "Para" item.
\stopdescr

\stoptext

which gives what you want:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .