LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Joel C. Salomon" <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Thu, 20 Aug 2015 23:19:17 -0400
text/plain (47 lines)

The memoir class manual suggests some code for putting section
headings in the margin, which I have adapted (using Expl3 mode for
clarity) thus:

          { \c_jcsres_marginwidth_dim }
          { \raggedleft \leavevmode \jcsres_section_style:n {#1} }
        { \llap { \marginbox{#1} \kern \c_jcsres_marginspace_dim } }
    \setbeforesecskip{ \c_jcsres_section_dim }
    \setsecindent{ 0em }
    \setaftersecskip{ 0em }
    \setsecheadstyle{ \marginhead }

I’m trying to customize this code and I keep getting stuck in not
understanding quite what’s going on. I’m hoping that translating the
`\marginhead` and `\marginbox` functions to use Expl3 features will
make matters explicit enough that I can tweak matters on my own.

If I understand correctly, `\marginbox` creates a 0-height top-aligned
box, the width of the margin (that’s the same dim variable I used in
creating the page layout) with the correctly-styled heading text set
ragged-left; and `\marginhead` places this box the appropirate
distance to the left of the following body text.

What is the cleanest way to do this with Expl3? Specifically, what are
the Expl3 equivalents of `\parbox` and `\llap`, at least in the way
this code uses them?

(I understand that `\raggedleft` would be in a very different layer of
the code [the galley?] and probably doesn’t have a useable Expl3
equivalent yet; and that using `\tex_kern:D` is no clearer than
`\kern`, and that its Expl3ization will probably be in the fonts
module. On the other hand, I see that l3trial/xfont/xfss.dtx includes
a definition for `\mode_leave_vertical:` so perhaps I’ll copy its
definition and use that.)

—Joel C. Salomon