I have two bits of "code" that work perfectly when isolated. The first piece builds a table of marginpar, the second provides certain customizations for the marginpar environment. When I copy both in one document it produces the table of Marginpar but doesnt apply the customizations correctly.
This is the customization (it is not created by myself. Unfortunatelly, I dont remember the source):
\setlength{\marginparwidth}{1.2in} % Veränderung Marginpar
\let\oldmarginpar\marginpar
\renewcommand\marginpar[1]{\-\oldmarginpar[\raggedleft\footnotesize #1]%
{\raggedright\footnotesize #1}}
The ToM code results from a previous question (List marginpars in the/a TOC) and is provided by henrique:
\documentclass{article}
\usepackage{tocloft,blindtext}
\usepackage[english]{babel}
% First we create new list of marginpars with the help of tocloft package:
\newcommand{\listmarginparname}{List of Margin Pars}
\newlistof{marginpar}{lom}{\listmarginparname}
% Then we define a command that increments a counter and writes it in the created list
\newcommand{\mpar}[1]{%
\refstepcounter{marginpar}
\addcontentsline{lom}{marginpar}{#1}}
% Now we have to make \marginpar command to include the counting macro
\newcommand*\origmpar{}
\let\origmpar\marginpar
\renewcommand*\marginpar[1]{\origmpar{#1}\mpar{#1}}
\begin{document}
\listofmarginpar
\section{Two marginpars}
\blindtext \marginpar{First Marginpar Test}
\blindtext \marginpar{Second Marginpar Test}
\section{One marginpar}
\blindtext \marginpar{Third marginpar Test}
\end{document}
My question: Does anyone know how to get this kind of Table of Marginpar without compromising the other customizations?