5

This question is about ConTeXt not LaTeX.

I'd like to have a special section such that A) there is no line break after a section title, and B) paragraphs in the section is narrower and indented like so:

Title   Paragraph 1, Paragraph 2,
        Paragraph 3, Paragraph 4,
        and Paragraph 5

So far I have this:

\setupnarrower[left=4cm]
\definehead[special][section]
\setuphead[special]
    [number=no,
     textstyle=\tfd,
     beforesection={\startnarrower[left]},
     aftersection=\stopnarrower]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

This achieves the second goal but not the first: enter image description here

Ideally, top/cap height of the title (Knuth) and top/cap height of the first paragraph ("Thus, I came ...") are (roughly) vertically aligned, not their baselines. Could anyone suggest a way to achieve this effect?

  • Please make your MWE compilable (including documentclass and all includes needed to acquire your output). – Skillmon Mar 12 '17 at 15:33
  • @Skillmon, Thank you for your comment. I've fixed MWE, so it is now compilable. That said this question is about ConTeXt not about LaTeX. – Seiji Kumagai Mar 12 '17 at 15:55
  • Oh, I missed that point... Sorry but I can't help you with that.then. – Skillmon Mar 12 '17 at 16:09
  • I'm not sure I get how you want things to look. What if the title is long (like five to six words). How do you want it to look then? – mickep Mar 12 '17 at 18:06
  • I am looking for this formatting in a limited use case, and the section titles are always one word in my use case. As such I am not really interested in extending this look to longer titles. – Seiji Kumagai Mar 12 '17 at 20:18
3

Use after={\blank[overlay]}.

\setupnarrower[left=4cm]

\definehead
  [special][section]

\setuphead
  [special]
  [
    number=no,
    after={\blank[overlay]},
    textstyle=\tfd,
    beforesection={\startnarrower[left]},
    aftersection=\stopnarrower,
  ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

enter image description here


To align the top of the line with the top of the title you can use this (dodgy) construction. I tested it with a few different fontsizes and it seems to work but I don’t give any guarantee. Also it breaks gridsnapping.

\setupnarrower[left=4cm]

\definehead
  [special][section]

\setuphead
  [special]
  [
    number=no,
    after={\blank[overlay,halfline]},
    textcommand=\tbox,
    textstyle=\tfd,
    beforesection={\startnarrower[left]},
    aftersection=\stopnarrower,
  ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\stoptext

enter image description here

  • Thank you. Your second approach achieves the desired effect. I am not using grid-based layout, so breaking gridsnapping is not an issue in my use case. – Seiji Kumagai Mar 12 '17 at 20:25
3

Another option is to use description environment:

\definedescription
    [special]
    [
      alternative=left,
      width=4cm,
      headstyle=\tfd,
      headcommand=\tbox,
    ]

\starttext

\startspecial[title=Knuth]
\input knuth
\stopspecial

\startsection[title=Lorem]
\input lorem
\stopsection

\stoptext

which gives

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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