开发者

LaTeX: typesetting chapter and section number in margin

I'm trying to typeset something in LaTeX and I would like to know if I'm doing it right. The basic idea is that section number hangs in the left margin. The number takes the height of the header+2 lines for a chapter heading, +1 line for section heading, and has the same height as the header for subse开发者_如何学运维ctions, and is aligned to the top of the heading. See the following image to get an idea of what I'm talking about:

http://img62.imageshack.us/img62/8404/bladld.png

My approach is using titlesec and doing something like this:

\titleformat{\chapter}%
            {\Huge\bfseries\sffamily}% format
            {\vbox to 16pt{\llap{% label
               \fontsize{3em}{0}\selectfont{\thechapter}%
               \hskip 9pt%
            }}}%
            {0pt}% horizontal sep
            {}% before

\titlespacing*{\chapter}%
              {0pt}% left
              {-2em}% before
              {0pt}% after

But this solution has some hacks that I would rather avoid. The \vbox height for instance, is found by trial and error. Visually, it looks almost right...


Try using the memoir document class. That has a ton of options for doing exactly this kind of thing, and it's much neater...

There's a hangnum style and for sections, there's a \hangsecnum option, but that only puts the number in the margin: it doesn't make it bigger. Memoir is also fabulously documented. So I expect all everything you need will be there. The code for hangnum is on p.88 of the fantastic memoir manual. So from there and from later examples you should get all the pointers you need to get what you want...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜