Here's a way of drawing the left bar suggested by Bernard when a star is appended to the command. It requires defining new courses with \newcourse
rather than \newcommand
, but it involves less typing as an added bonus.
\newcourse{\newcommandname}{<number>}{<title>}{<description>}
sets up a new course. It will create \newcommandname
which will create the regular print of the course and \newcommandname*
which will add a left bar in the margin.
\setlength\courselinewidth{<width>}
controls the width of the line.
The colour and opacity of the line can be set with \coursehighlight[<colour>]{<% opacity>}
. The default colour is black. Below, I show how to set the opacity and colour in a couple of ways, including one which is there just in case you get a colour printer and fancy a change.
Note that this will not work in the case that a page break occurs during the highlighted course, and no attempt is made to prevent or detect this.
Here are three examples:


Code:
\documentclass{article}
\usepackage{xparse,tikz,tikzpagenodes}
\usetikzlibrary{tikzmark,calc}
\usepackage{lipsum}
\newcounter{hcourse}
\setcounter{hcourse}{0}
\newcommand{\course}[3]{\item[MATH #1] \emph{#2}\par #3}
\NewDocumentCommand\newcourse { m m m +m }{%
\NewDocumentCommand #1 { s }{%
\IfBooleanTF ##1 {%
\stepcounter{hcourse}%
\course{\tikzmark{\thehcourse a}#2}{#3}{#4}\tikzmark{\thehcourse b}%
\tikz[remember picture, overlay]{%
\foreach \i in {a,b} \coordinate (\thehcourse \i) at ({pic cs:\thehcourse \i});
\draw [course highlight, line width=\courselinewidth] ($(\thehcourse a -| current page text area.west) + (-1em,\baselineskip)$) coordinate (\thehcourse c) -- ($(\thehcourse b -| \thehcourse c)$);
}%
}{%
\course{#2}{#3}{#4}%
}%
}%
}
\NewDocumentCommand\coursehighlight { O {black} m }{%
\colorlet{course highlight}{#1!#2}}
\newlength\courselinewidth
\setlength\courselinewidth{1pt}
\coursehighlight{75}
\newcourse{\sixten}{610}{A Course Title}{A long description \lipsum[5] Final words.}
\newcourse{\sixtwenty}{620}{Another Course Title}{A shorter description}
\begin{document}
\title{Course Offerings}
\author{}\date{}
\maketitle
\subsubsection*{Fall 2016}
\begin{description}
\sixten
\sixtwenty
\end{description}
\subsubsection*{Spring 2017}
\begin{description}
\sixten*
\sixtwenty
\end{description}
\coursehighlight[gray]{50}
\setlength\courselinewidth{1mm}
\begin{description}
\sixten
\sixtwenty*
\end{description}
In case you get a colour printer\dots
\coursehighlight[blue]{80}
\begin{description}
\sixten*
\sixtwenty
\end{description}
\end{document}
Original Answer (Corrected)
Here's a way of boxing the course when a star is appended to the command. It requires defining new courses with \newcourse
rather than \newcommand
, but it involves less typing as an added bonus.
\documentclass{article}
\usepackage{xparse,tikz,tikzpagenodes}
\usetikzlibrary{tikzmark,calc}
\usepackage{lipsum}
\newcounter{hcourse}
\setcounter{hcourse}{0}
\newcommand{\course}[3]{\item[MATH #1] \emph{#2}\par #3}
\NewDocumentCommand\newcourse { m m m +m }{%
\NewDocumentCommand #1 { s }{%
\IfBooleanTF ##1 {%
\stepcounter{hcourse}%
\course{\tikzmark{\thehcourse a}#2}{#3}{#4}\tikzmark{\thehcourse b}%
\tikz[remember picture, overlay]{%
\foreach \i in {a,b} \coordinate (\thehcourse \i) at ({pic cs:\thehcourse \i});
\draw ($(\thehcourse a -| current page text area.west) + (-1em,\baselineskip)$) rectangle ($(\thehcourse b -| current page text area.east) + (1em,-.5\baselineskip)$);
}%
}{%
\course{#2}{#3}{#4}%
}%
}%
}
\newcourse{\sixten}{610}{A Course Title}{A long description \lipsum[5] Final words.}
\newcourse{\sixtwenty}{620}{Another Course Title}{A shorter description}
\begin{document}
\title{Course Offerings}
\author{}\date{}
\maketitle
\subsubsection*{Fall 2016}
\begin{description}
\sixten
\sixtwenty
\end{description}
\subsubsection*{Spring 2017}
\begin{description}
\sixten*
\sixtwenty
\end{description}
\end{document}

description
because then you are probably passing\item
an argument. Is that right? That's rather different from the\item
case in\itemize
. The point is, you can't make this work just as it is, so something has to give and it matters what can give, for that reason.\underline
is even a standard command. EDIT: Then again...framed
package allows to do that, even in case of page breaks, if I remember well.