I am aggregating a document class for taking Cornell-styled notes. For this purpose, I am using the tcolorbox package and arrange them into two columns. terms on the left and notes related to these terms on the right. Here is an example:
Now I would like to add the possibility of highlighting certain parts of the notes with text in the "margin" introduced with the term column. Something like this:
Here is the full class as of right now:
\ProvidesClass{cornell}
\LoadClass[a4paper]{article}
\usepackage{tcolorbox}
\tcbuselibrary
{
breakable,% Allows tcolorboxes to break across pages
hooks,% Allows usage of hooks, like having an overlay only for the first part of a broken box
skins,% Used to style the boxes with tikz
xparse% Used to define document environments and commands
}
\usepackage[margin=2cm]{geometry} % Change geometry of pages
\usepackage[parfill]{parskip} % Modify parindent and parskip
\usepackage{enumitem} % Modify itemize spacing
\setitemize
{
itemsep=0pt,
parsep=2pt,
}
\usepackage{bookmark} % Add bookmarks to the resulting PDF
\usepackage{hyperref}
\hypersetup
{
colorlinks = true, % Colour links instead of ugly boxes
urlcolor = blue, % Colour for external hyperlinks
linkcolor = blue, % Colour of internal links
citecolor = red % Colour of citations
}
\date{}
\tcbset
{
colframe=black,
colupper=black,
opacitybacktitle=1,
opacitytext=1,
fonttitle=\large\bfseries\sffamily,
}
\NewTColorBox[]{titlebox}{ o }
{
width=\textwidth,
lowerbox=invisible,
bookmark*={level=0}{@title}
}
\renewcommand{\maketitle}
{
\vspace{-3em}
\begin{titlebox}
\Huge{\sffamily{@title}}
\end{titlebox}
}
\NewTColorBox[]{extra}{ m }
{
width=\textwidth,
title=#1,
bookmark*={rellevel=1}{#1},
}
\NewTColorBox[]{term}{ m }
{
width=.325\textwidth,
}
% A note is a tcolorbox in the right column. It may be associated to a
% term which is provided as an optional argument. If a term is provided
% another left-aligned tcolorbox is created with a bookmark.
% It is also possible to give the note itself a title. In this case the
% note tcolorbox is given the provided title and a bookmark for this
% title is created.
\NewTColorBox[]{note}{ o d<> }
{
enhanced,
breakable,
IfValueT={#1}{bookmark={rellevel=1}{#1}},
IfValueT={#2}{
bookmark={rellevel=2}{#2},
title=#2,
},
enlarge left by=.34\textwidth,
width=.66\textwidth,
parbox=false,% restore main text formatting behavior
overlay unbroken={
\IfNoValueF{#1} {%
\node[anchor=north west, outer sep=0pt, inner sep=0pt] at ([xshift=-.34\textwidth]frame.north west) {
\begin{term}{#1}
#1
\end{term}
};
}{}
},
overlay first app={
\IfNoValueF{#1} {%
\node[anchor=north west, outer sep=0pt, inner sep=0pt] at ([xshift=-.34\textwidth]frame.north west) {
\begin{term}{#1}
#1
\end{term}
};
}{}
}
}
\NewDocumentEnvironment{summary}{}
{
\vfill
\begin{tcolorbox}[
floatplacement=!b,
float,
title=Summary,
bookmark*={level=1}{Summary},
parbox=false,% restore main text formatting behavior
]
}
{
\end{tcolorbox}
}
And here is the sample file:
\documentclass{cornell}
\usepackage{lipsum}
\title{A topic we're taking notes on}
\begin{document}
\maketitle
\begin{extra}{Introduction}
This can be used to introduce what is about to come, like
\begin{enumerate}
\item{What's the first question this section will answer?}
\item{What's the second question?}
\end{enumerate}
\end{extra}
\begin{note}[Some key term]
\begin{itemize}
\item{A cool thing}
\item{Another cool thing}
\item{Not all things are cool}
\end{itemize}
That has another paragraph.
\end{note}
\begin{note}<This is a titled noted with a very long title that should wrap around>
\lipsum[10]
\end{note}
\begin{summary}
A fabulous summary.
With multiple paragraphs.
\end{summary}
\end{document}



overlayedandrememberednode could be used to do that. – Ignasi Feb 04 '21 at 17:07tikzterms? – L. Resch Feb 04 '21 at 18:54\marginparor the\graffitocommand from theclassicthesispackage. See this image for an example. – L. Resch Feb 05 '21 at 08:46