3

I'm trying to modify the Cornell Notes template to my specific needs.

  1. Is there a way that the red line on the background breaks before and after a section and subsection title?

    I looked through the background documentation and didn't find a option to do that. Is there maybe an option with tikz?

  2. What do I have to change so the red \topic boxes are always aligned with the first blue box?

\documentclass[a4paper]{article} 
\usepackage{tcolorbox}
\tcbuselibrary{skins}

\title{ \vspace{-3em} \begin{tcolorbox}[colframe=white,opacityback=0] \begin{tcolorbox} \Huge\sffamily Cornell Notes on Something
\end{tcolorbox} \end{tcolorbox} \vspace{-3em} }

\date{}

\usepackage{background} \SetBgScale{1} \SetBgAngle{0} \SetBgColor{red} \SetBgContents{\rule[0em]{4pt}{\textheight}} \SetBgHshift{-2.3cm} \SetBgVshift{0cm}

\usepackage{lipsum}% just to generate filler text for the example \usepackage[margin=2cm]{geometry}

\usepackage{tikz} \usepackage{tikzpagenodes}

\parindent=0pt

\usepackage{xparse} \DeclareDocumentCommand\topic{ m m g g g g g} { \begin{tcolorbox}[sidebyside,sidebyside align=top,opacityframe=0,opacityback=0,opacitybacktitle=0, opacitytext=1,lefthand width=.3\textwidth] \begin{tcolorbox}[colback=red!05,colframe=red!25,sidebyside align=top,width=\textwidth,before skip=0pt] #1.\end{tcolorbox}% \tcblower \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth,before skip=0pt] #2 \end{tcolorbox} \IfNoValueF {#3}{ \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth] #3 \end{tcolorbox} } \IfNoValueF {#4}{ \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth] #4 \end{tcolorbox} } \IfNoValueF {#5}{ \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth] #5 \end{tcolorbox} } \IfNoValueF {#6}{ \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth] #6 \end{tcolorbox} } \IfNoValueF {#7}{ \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\textwidth] #7 \end{tcolorbox} } \end{tcolorbox} }

\begin{document} \maketitle

\section{This is a long section title }
\topic{This is a question}%
{The first piece of evidence is mandatory}%
{Now add up to five\ldots}%
{\ldots additional pieces of evidence.}

\section{This is an even longer section title}
\topic{Here's another question.}{\lipsum[1]}%
{\lipsum[2]}%

\end{document}

enter image description here

Simon Dispa
  • 39,141
danik
  • 319
  • Are you really sure about a command with seven argument, five of which are optional? – egreg Nov 05 '21 at 22:30
  • I'm afraid I'm not entirely sure what you mean. Without the five \IfNoValueF commands, it isn't possible to have more than one blue box. – danik Nov 05 '21 at 23:04

1 Answers1

7

UPDATED after a follow up question

I propose a simpler code using the paracol package that meets both requirements.

x

z

Insert the question in the left column using \question {<question text>}

\question ends with \switchcolumn, so the following notes will go automatically to the right column. Insert as many notes as you like in the right column using \note{<note text>}.

When there are multiple questions in the same section, insert \switchcolumn* before the next question to synchronize the columns. A small vertical space can be added to separate the question\notes groups.

\documentclass[a4paper]{article}

\usepackage{paracol} % added <<<<<<<<<<<<<<<<<<<<<

\usepackage{tcolorbox} \tcbuselibrary{skins}

\usepackage{lipsum}% just to generate filler text for the example \usepackage[margin=2cm]{geometry}

\newcommand{\question}[1]{% Ask the question \begin{tcolorbox}[colback=red!05,colframe=red!25,sidebyside align=top,width=\linewidth,before skip=1ex] #1.\end{tcolorbox}% \switchcolumn % now write in the right column
}

\newcommand{\note}[1]{% Add as many notes as you like \begin{tcolorbox}[colback=blue!05,colframe=blue!10,width=\linewidth,before skip=1ex] #1 \end{tcolorbox}
}

\setcolumnwidth{0.50\textwidth/20pt,0.50\textwidth}% column separation =20pt \setlength{\columnseprule}{3pt} % column width \colseprulecolor{red}

\title{% \begin{tcolorbox}[before skip = -\baselineskip, after skip =-\baselineskip] \centering\Huge\sffamily Cornell Notes on Something
\end{tcolorbox} }

\date{} \parindent=0pt

\begin{document}

\maketitle

\section{This is a long section title}

\begin{paracol}{2} \question{This is a question} \note{The first piece of evidence is mandatory} \note{Now add up to five\ldots}% \note{\ldots additional pieces of evidence.} \end{paracol}

\section{This is an even longer section title}

\begin{paracol}{2}
\question{Here's another question.} \note{\lipsum[1]} \note{\lipsum[2]} \end{paracol}

\section{Some subject, several question} \begin{paracol}{2} \question{This is question I}
\note{I The first piece of evidence is mandatory} \note{Now add up to five\ldots}% \note{\ldots additional pieces of evidence.} \vspace*{2ex}

\switchcolumn* % go back to the left column ans synchronize &lt;&lt;&lt;&lt;
\question{Here's  question II.}
\note{II The first piece of evidence is mandatory}
\note{Now add up to five\ldots}%
\note{\ldots additional pieces of evidence.}
\vspace*{2ex}

\switchcolumn* % go back to the left column ans synchronize &lt;&lt;&lt;&lt;
\question{And question III.}

\note{III The first piece of evidence is mandatory}
\note{Now add up to five\ldots}%
\note{\ldots additional pieces of evidence.}
\note{\ldots and more \ldots}
\note{\ldots and more.}

\end{paracol}

\end{document}

Simon Dispa
  • 39,141
  • Thank you very much, this is exactly what I was looking for! I only noticed one small detail. The red box is not perfectly aligned with the first blue box when more than paracol environment is used in the same section. This can be changed by changing before skip=0pt to before skip=6pt in the definition for the question. Probably not the best way to do this, but it works for me. – danik Nov 06 '21 at 12:21
  • 1
    @danik Thank you for your feedback. I updated the answer with your suggestion and further simplified the code. (\switchcolumn is added by \question) – Simon Dispa Nov 06 '21 at 13:19