2

I'm writing some notes and where I feel it's worth repeating notes that I've taken elsewhere, I'd like to show that those particular notes are old notes that I (hopefully!) already know.

I settled on a light grey italic font.

I thought it would be a good idea to define a new command for the job - after all, is that not the LaTeX way?

Nothing fancy, just:

\newcommand{\existingnotes}[1]{\textit{\textcolor{gray}{#1}}}

The problem is, I'm presenting my notes as bullet points and that's where things get tricky.

This:

\begin{itemize}
  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
  \existingnotes{%
    \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat.%
  }
  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla pariatur.
\end{itemize}

Works:

enter image description here

This:

\begin{itemize}
  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
  \begin{itemize}
    \item Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna
    felis sollicitudin mauris.
  \end{itemize}
  \existingnotes{%
    \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat.%
  }
  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla pariatur.
\end{itemize}

Doesn't:

enter image description here

I'm sure I don't need to explain that if my command is used immediately after a nested itemized list, it introduces excessive vertical space.

Obviously what you want to do is just use some nice switches:

\begin{itemize}
  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
  \begin{itemize}
    \item Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna
    felis sollicitudin mauris.
  \end{itemize}
  {\color{gray}\itshape
    \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat.}
  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla pariatur.
\end{itemize}

This works like a charm:

enter image description here

But I've never seen any advice on how to create a new switch and I'd rather define a nice command instead of hard coding visual formatting.

MWE

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{xcolor}

\newcommand{\existingnotes}[1]{\textit{\textcolor{gray}{#1}}}

\begin{document}

\begin{itemize}
  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
  \begin{itemize}
    \item Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna
    felis sollicitudin mauris.
  \end{itemize}
  \existingnotes{%
    \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat.%
  }
  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla pariatur.
\end{itemize}

\end{document}

Follow-up

This is for essentially "quoting" old notes in a set of new notes.

I would also like to be able to add new notes into old notes, for this I came up with a simple environment to give me light grey, italic font and also to add a bit of an indent on either side, after all it's a quote. And then a command to give me black, upright text for the new notes:

\usepackage{quoting}
\newenvironment{oldnotes}{%
  \begin{quoting}[font=itshape]\color{gray}}{\end{quoting}%
}

\newcommand{\newnotes}[1]{\textnormal{\textcolor{black}{#1}}}

I'd been using this happily, without realising there was a flaw with it. As long as I don't nest itemize environments, this too works well:

\begin{oldnotes}
  \begin{itemize}
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua.
    \newnotes{%
      \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
      nisi ut aliquip ex ea commodo consequat.%
    }
    \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
    dolore eu fugiat nulla pariatur.
  \end{itemize}
\end{oldnotes}

enter image description here

But, of course, it doesn't work with nested itemize environments:

\begin{oldnotes}
  \begin{itemize}
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua.
    \begin{itemize}
      \item Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
      varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
      magna felis sollicitudin mauris.
    \end{itemize}
    \newnotes{%
      \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
      nisi ut aliquip ex ea commodo consequat.%
    }
    \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
    dolore eu fugiat nulla pariatur.
  \end{itemize}
\end{oldnotes}

enter image description here

Can anyone help me improve my definitions?

Bonus marks

Obviously if the oldnotes environment could be made to depend on the \existingnotes command that would be very elegant as then I could change both at the same time if I decide, say, I would like a slightly different shade of grey. Or if I want to use blue :P

2

In your case, define it using the switches within a group:

enter image description here

\documentclass{article}

\usepackage[parfill]{parskip}
\usepackage{xcolor}

\newcommand{\existingnotes}[1]{{\color{gray}\itshape #1}}

\begin{document}

\begin{itemize}
  \item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua.
  \begin{itemize}
    \item Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
    varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna
    felis sollicitudin mauris.
  \end{itemize}
  \existingnotes{%
    \item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat.%
  }
  \item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
  dolore eu fugiat nulla pariatur.
\end{itemize}

\end{document}
  • Thanks, that works excellently. The only downside is I'm not sure how to incorporate your nice new definition of \newcommand{\existingnotes}[1]{{\color{gray}\itshape #1}} into a definition of the oldnotes environment, to keep them in line with each other – Au101 Oct 25 '19 at 3:55
  • Okay, I've gone away and had a little think, I came up with this: \newcommand{\quotednotes}{\color{gray}\itshape} \newcommand{\existingnotes}[1]{{\quotednotes #1}} \newcommand{\newnotes}[1]{{\color{black}\upshape #1}} \usepackage{quoting} \newenvironment{oldnotes}{% \begin{quoting}\quotednotes}{\end{quoting}% } Can I expect any nasty surprises or do you think that will about do it? – Au101 Oct 25 '19 at 4:14
  • @Au101: Using the switches in your way doesn't seem like it would cause an issue. – Werner Oct 25 '19 at 16:09
  • :) Thank you for the professional opinion :P – Au101 Oct 25 '19 at 16:11

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.