For my purposes I would like to have (free-standing) section numbers in the margins and no section headings---just the section text---immediately following (i.e., on the same line as) the section number. The following gets me close to what I would like


but it leaves about an inch of horizontal space after the sec number/margin before my text begins. Larger and smaller values of the third command increase the space horizontally or vertically. Is there a way to have the section body immediately follow the section number on the same line using memoir?

1 Answer 1


Here's a definition of \hangsection that provides what you're after:

enter image description here

\documentclass{memoir}% http://ctan.org/pkg/memoir
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
  \savebox{\@tempboxa}{\normalfont\ }%
\chapter{A chapter}

Since you're using untitled sections, it seems easiest to define a function that avoids using \section{} all the time. This function, \hangsection, measures the width of a space in \normalfont, and unskips exactly that amount.

  • Thanks for your quick reply and great idea -- that is exactly what I want! However, in copying and pasting your sample, I get exactly the same output as before--roughly an inch of blank horizontal space between number and text. I've tried it with latex and xelatex (which is what I use in general) and get the same result. ?! What else to tell you? I'm running texlive on ubuntu 12.04.... Thanks for your help.
    – camatkara
    Commented Jun 25, 2012 at 22:44
  • @camatkara: What you can do is post a small yet complete minimal example of something that duplicates your output. As you can see, my example is minimal in the sense that it doesn't have any extra packages that you might load. That's about the only way we can get on the same page, if you know what I mean.
    – Werner
    Commented Jun 25, 2012 at 22:51
  • Well the problem is I literally just copied and pasted your doc into a new file and tried it out, and still got the extra inch of space. Is it possible I've somehow globally altered my Memoir settings?
    – camatkara
    Commented Jun 25, 2012 at 22:54
  • @camatkara: Since I obtain the same results using TeX Live 2009 (on ScribTeX) and 2011 (on my own computer), I can't tell what the problem is. What version of memoir are you using? I'm using 2011/03/06 v3.6j. To find out yours, add \listfiles to your preamble and check your .log file.
    – Werner
    Commented Jun 25, 2012 at 23:00
  • Thanks @Werner. Strangely I am also using TeX Live 2009 (Memoir: 2009/09/21 v1.61803398b) but get the extra inch of horizontal space. I just looked into upgrades, and there are none for my distribution (Ubuntu 12.04) at the moment, though it sounds like it shouldn't matter since your 2009 version works fine. I will try adding an image of the output I get from your sample file above to the OP, so you can see my issue.
    – camatkara
    Commented Jun 25, 2012 at 23:18

You must log in to answer this question.

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