TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the following code, the use of the package titlesec modifies dramatically the formatting based on the package marginnote. The package titlesec is needed so as to use this.

Is there one possibility to repair that ?

\documentclass[12pt]{article}
    %\usepackage{titlesec} % << Uncomment to see the changes... >>
    \usepackage{marginnote}
    \usepackage{tikz}

    \reversemarginpar % To put the margin pars on the left
    \renewcommand*{\marginfont}{\sffamily\normalsize}

    \usetikzlibrary{calc}
    \usetikzlibrary{backgrounds}

    \definecolor{colorDateGene}{RGB}{230,120,120}
    \definecolor{colorDateToday}{RGB}{230,230,230}

    \newcommand*{\Date}[4]{%
        \begin{tikzpicture}[
            show background rectangle,
            inner frame sep=0pt,
            text width=1cm,
            align=center
        ]
            \node [fill=colorDateGene]  at (0,0)                                (dayofweek)  {\footnotesize{#1}};
            \node [fill=colorDateToday] at ($(dayofweek)  +(0,-\baselineskip)$) (dayofmonth) {#2};
            \node [fill=colorDateToday] at ($(dayofmonth) +(0,-\baselineskip)$) (month)      {#3};
            \node [fill=colorDateGene]  at ($(month)      +(0,-\baselineskip)$) (dayofmonth) {\footnotesize{#4}};
        \end{tikzpicture}
    }

    \usepackage{lipsum}


\begin{document}

\addcontentsline{toc}{section}{Mon. 28 Nov.}
\section*{One day \marginnote{\Date{Mon}{28}{NOV}{2011}}}

\noindent\lipsum[1]

\addcontentsline{toc}{section}{Wed. 30 Nov.}
\section*{One day \marginnote{\Date{Wed}{30}{NOV}{2011}}}

\noindent\lipsum[1]

\addcontentsline{toc}{section}{Fri. 2nd Dec.}
\section*{One day \marginnote{\Date{Fri}{2nd}{DEC}{2011}}}

\noindent\lipsum[1]

\newpage
\addcontentsline{toc}{section}{Mon. 5 Dec.}
\section*{One day \marginnote{\Date{Fri}{5}{DEC}{2011}}}

\noindent\lipsum[1]

\end{document}
share|improve this question
up vote 2 down vote accepted

As I said in my revised answer to your former question: Instead of putting \marginnote inside \section*, change the vertical positioning of the \marginnote using its second optimal argument.

\section*{One day} \marginnote{\Date{Mon}{28}{NOV}{2011}}[-32pt]
share|improve this answer
    
To obtain the same formatting as the \section header, use \marginnote{\bfseries...}. Why 32pt? – Werner Dec 1 '11 at 0:22
    
@Werner: The OP seems to want a marginnote in \normalfont that is nevertheless vertically aligned witth the sectioning title -- 32pt is a crude aligning attempt, considering the marginnote's box. – lockstep Dec 1 '11 at 0:26
    
Okay - \normalfont in the text has a \baselineskip of 14.5pt, while that of the section heading is 22pt, so I had thought 36.5pt. But your visual attempt is definitely sufficient. – Werner Dec 1 '11 at 0:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.