I'm working on the formatting of a text book.

The following picture shows the first thing I would like to do.

There are two things to achieve :

  1. I would like to "draw" the date using TikZ so as to have later the possibility to make more evoluated formatting.
  2. Then the "draw" must be put in the left margin.

enter image description here

The LaTeX code would be similar to the following one :

\section{Name of the class}

\subsection{Chapter A : Numeric activities}


\subsubsection{For Tuesday Nov. 29}
  • 2
    Please don't ask "How do I achieve this layout", but rather a question about a specific feature that you're struggling with, one problem per question. This way other users who have a similar problem can benefit from your question and the solutions to it (No one's gonna ask for the same layout as you). It's no problem to ask several questions, if you've made some attempt yourself first. It's enormously helpful to see what you've tried so far to figure out what doesn't work. Is it putting something in the margin? Is it the table-layout with the colored cells? ...
    – doncherry
    Nov 28 '11 at 21:40
  • You're right. I've edited my question.
    – projetmbc
    Nov 28 '11 at 21:59

Here is a tikz solution using the marginnote package:

enter image description here


    \begin{tikzpicture}[show background rectangle,inner frame sep=0pt,text width=1.5cm,align=center]
        \node [fill=orange] at (0,0)                                (dayofweek)  {#1};
        \node [fill=white ] at ($(dayofweek)  +(0,-\baselineskip)$) (dayofmonth) {#2};
        \node [fill=white ] at ($(dayofmonth) +(0,-\baselineskip)$) (month)      {#3};
        \node [fill=orange] at ($(month)      +(0,-\baselineskip)$) (dayofmonth) {#4};
\reversemarginpar% to put the margin pars on the left
  • How can I center the text ?
    – projetmbc
    Nov 28 '11 at 22:14
  • Had already updated solution before you asked: use align=center. Nov 28 '11 at 22:15

You can use a simple tabular environment to format the date, and then frame it using a \fbox; the marginnote command (from the homonymous package) lets you place the date as a marginal note. In the following example I illustrate this approach; the \MyDate command has one mandatory argument (the name of the day); the other three values are typeset automatically (of course, you can make all or some of this elements also customizable as arguments of the command):



    \rowcolor{mycolor} #1 \\
    \large\the\day \\
    \large\shortmonthname. \\
    \rowcolor{mycolor} \the\year




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.