I work on a tufte like template and want to make section text positioned in the margin, like this:

enter image description here

I fiddled with \@startsection like this:

{ several values }
{ several values }

but the section text, even though positioned right or left, is always in the bounds of textwidth.

I could use marginnote instead of section, but I wonder if this can be solved within the section commands. Mind that I want to use a twoside format, thus positioning left or right should be odd or even depended.

Any thoughts will be appreciated.


I tried this:

.. or ..

How can I use an if statement in order to choose rightmargin or leftmargin?

1 Answer 1


Here is a simple solution with titlesec, ifoddpage and marginnote:

\geometry{top=2.5cm, outer=0.33\paperwidth, inner=2.5cm, bottom=3.5cm, marginparwidth =0.28\paperwidth, marginparsep=10pt}
\usepackage{lipsum, marginnote,ifoddpage}

\titleformat{\section}[runin]{\bfseries\color{Tomato4! 80! }}{}{0pt}%
{\checkoddpage\marginnote{\thesection. #1}[-\baselineskip]}[\leavevmode\hspace*{-\marginparsep}]


\section{First section, long title}


\section{A second section with a longer title}


\section{A third section, with a really much longer title. An incredibly longer title}



enter image description here

  • Thank you for your excellent answer. Yet, using \setlength{\parindent}{0cm} in order to eliminate the horizontal space at the beginning of the paragraphs, works for every paragraph except of the first paragraph of every section. Aug 15, 2016 at 21:31
  • @user3060854: I'be modified the code. The indentation at the beginning of the first paragraph was due to \marginparsep, because the runin shape expects the label and section title to be in front of the body text.
    – Bernard
    Aug 15, 2016 at 22:14
  • I'm sorry to bother you again, but in the second case the opposite happens, thus the first paragraph has a zero indent, and the following paragraphs have a \marginparsep indent. Is possible all paragraphs to have a zero indent? Aug 16, 2016 at 6:19
  • You don't bother me. I didn't understand you wanted a zero \parindent. The following paragraphs indeed have \parindentindent, not \marginparsep. It's not enough to use \setlength{\parindent}{0cm}, because it may happen a paragraph ends at the end of a line. The best to do is to load the parskip package, which sets \parindent to 0ptand \parskip to a non-zero value, and takes care of some technical details.
    – Bernard
    Aug 16, 2016 at 8:57

You must log in to answer this question.

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