我正在尝试修改康奈尔笔记模板满足我的具体需求。
有没有办法让背景上的红线在章节和小节标题之前和之后断开?
我查看了背景文档,没有找到可以执行此操作的选项。tikz 是否有选项?
我必须进行哪些更改才能使红色
\topic
框始终与第一个蓝色框对齐?
\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}
答案1
更新在后续问题之后
paracol
我建议使用能够满足两个要求的包来编写更简单的代码。
使用左栏插入问题\question {<question text>}
\question
以 结尾\switchcolumn
,因此后面的注释将自动移至右列。使用 在右列中插入任意数量的注释\note{<note text>}
。
当同一节中有多个问题时,\switchcolumn*
在下一个问题之前插入以同步列。可以添加一个小的垂直空间来分隔问题\注释组。
\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 <<<<
\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 <<<<
\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}