Added music and installing LaTeX packages
This commit is contained in:
parent
6b46174876
commit
9617c37cdd
@ -93,6 +93,16 @@
|
||||
% Use nice fractions
|
||||
\usepackage{nicefrac}
|
||||
|
||||
% Just for issue #003:
|
||||
\usepackage{wasysym}
|
||||
\usepackage{harmony}
|
||||
\usepackage{musixtex}
|
||||
\usepackage[generate,ps2eps]{abc}
|
||||
\usepackage{mathptmx} %Necessary for abc package to work?
|
||||
|
||||
|
||||
|
||||
|
||||
\author{Kenneth John Odle}
|
||||
\title{
|
||||
{\Huge the codex} \\
|
||||
@ -129,7 +139,7 @@ The picture of a VT100 terminal is courtesy of Jason Scott. It was published at
|
||||
|
||||
\tableofcontents
|
||||
|
||||
\chapter{The Last Salad Days}
|
||||
\chapter{The Final Salad Days}
|
||||
|
||||
\section{College}
|
||||
|
||||
@ -169,6 +179,9 @@ I should mention that I went to college with the goal of becoming high school bi
|
||||
|
||||
Bush II decided to tank the economy for ordinary people so that rich people could get richer.\footnote{This is the second of three "once in a lifetime" recessions I have lived through. Yay, capitalism!}
|
||||
|
||||
|
||||
|
||||
|
||||
\section{Teaching Computers}
|
||||
|
||||
I graduated from college with a B.S. in Biology and a teaching certificate. I could not find a job teaching biology—as it turns out, biology teachers are a dime a dozen.\footnote{This was a huge surprise to me, because all through college, whenever I told someone I was a biology major, they seemed really impressed and said something like "oh gosh, biology—that's really hard." But note—these were non-science people. If you want to study science, but don't want anything too hard, apparently biology is the default.} As it turns out, chemistry teachers are about ten bucks a dozen, and if you majored in physics with a goal of teaching high school science, you would have your choice of any teaching position you wanted.
|
||||
@ -195,12 +208,202 @@ And this worked. My students were not familiar with a ``File'' menu, but they we
|
||||
|
||||
I know that the usual dictum is ``show, don't tell''. But what's really happening here is that by \textit{telling} my students, they were then \textit{showing} themselves, and developing some muscle memory along the way.
|
||||
|
||||
Although I thoroughly enjoyed teaching this class, nothing good can last forever. A new Republican governor was elected and he slashed funding for community education and adult education programs. (A less-educated populace is easier to control, I guess.) I taught this course for a year, had a great time, and would gladly teach it again, even with the miserable wages. Hell, I'd do it now as a volunteer. Knowledge should be shared, not sold.
|
||||
Although I thoroughly enjoyed teaching this class, nothing good can last forever. A new Republican governor was elected and he slashed funding for community education and adult education programs. (A less-educated populace is easier to control, I guess.) I taught this course for a year, had a great time, and would gladly teach it again, even with the miserable wages. Hell, I'd do it now as a volunteer. Knowledge should be shared, not horded and sold.
|
||||
|
||||
|
||||
|
||||
\chapter{Music (\twonotes) in \LaTeX{}}
|
||||
|
||||
\section{Standard Notation}
|
||||
|
||||
I have a couple of guitars in the corner of my living room that I keep intending to dust off and play again someday. Of course, with the way my mind works, I thought I should also brush up on some music theory. Because I am an inveterate note-taker, but also have less-than-ideal penmanship, I thought I should figure out if it's possible to write music (and also guitar tablature) in LaTeX, and if so, how much work is it?
|
||||
|
||||
As it turns out, there are a number of packages that enable you to include music in a LaTeX document.\footnote{For much of this early research, I am highly indebted to Martin Thoma, who has an excellent introduction at \href{https://martin-thoma.com/how-to-write-music-with-latex/}{\texttt{https://martin-thoma.com/how-to-write-music-with-latex/}}.}
|
||||
|
||||
\subsection{wasysym}
|
||||
|
||||
First, there is the \texttt{wasysym} (or Waldi Symbol font) package, which is basically a symbol font for LaTeX. It includes a lot of different symbols, including some interesting circles (\Circle{}, \leftturn{}, \rightturn{}) that I could have used on a different project had I known about this then. It's a symbol font, so when it comes to music, what it offers is rudimentary: you can add an eighth note (\eighthnote), a quarter note (\quarternote), a half note (\halfnote), a whole note (\fullnote), or two joined eighth notes (\twonotes). In math mode, you can also add a natural symbol ($\natural$), a flat symbol ($\flat$), or a sharp symbol ($\sharp$).
|
||||
|
||||
\subsection{harmony}
|
||||
|
||||
There is also the \texttt{harmony} package, which offers up some additional symbols:
|
||||
|
||||
\medskip
|
||||
|
||||
\AAcht ~~~ \Acht ~~~ \AchtBR\AchtBL ~~~ (which is actually two symbols stuck together: \AchtBR ~~ and ~~\AchtBL ) ~~~ \AcPa ~~~ and a whole lot of very tiny notes: ~~~ \Acht ~~~ \Sech ~~~ \Zwdr ~~~ and some very tiny rests: ~~~ \ViPa ~~~ \AcPa ~~~ \SePa ~~~ \ZwPa
|
||||
|
||||
And it also has what I believe is chord notation (although I could be—and probably am—wrong; it has been a \textit{very} long time), some of which can be quite complicated:
|
||||
|
||||
% Define a couple of new commands
|
||||
\def\h#1h{\hspace*{#1em}}
|
||||
\newcommand{\Str}[2][0.5]{\raise#1ex\hbox to #2em{\hrulefill}}
|
||||
\newcommand{\ST}{\h0.03h\Str[0.65]{0.27}\h0.03h}
|
||||
%
|
||||
|
||||
\medskip
|
||||
|
||||
\h0,5h\HH.D..8\Str[0,65]{1,2}7\ST6\ST5.8\ST6\ST4\Str[0,65]{2}3.6\ST5\ST8%
|
||||
\Str[0,65]{3}7.%
|
||||
|
||||
I didn't create that. (I don't even know what it means.) I just copied it verbatim from the \texttt{harmony} guide. In reality, it looks like this:
|
||||
|
||||
\begin{verbatim}
|
||||
%
|
||||
\def\h#1h{\hspace*{#1em}}
|
||||
\newcommand{\Str}[2][0.5]{\raise#1ex\hbox to #2em{\hrulefill}}
|
||||
\newcommand{\ST}{\h0.03h\Str[0.65]{0.27}\h0.03h}
|
||||
%
|
||||
\h0,5h\HH.D..8\Str[0,65]{1,2}7\ST6\ST5.8\ST6\ST4\Str[0,65]{2}3
|
||||
.6\ST5\ST8%
|
||||
\Str[0,65]{3}7.%
|
||||
\end{verbatim}
|
||||
|
||||
What this tells me is that the \texttt{harmony} package is very good at positioning things around other things. I may just have to tuck that in the back of my mind for later. The guide document for \texttt{harmony} is only five or six pages, but there is a lot of information to absorb there.
|
||||
|
||||
\subsection{musixtex}
|
||||
|
||||
And then there is the \texttt{musixtex} package. It makes use of a \texttt{music} environment, with your relevant code (of which there is a lot). I've copied this bit from the \texttt{musixtex} documentation:
|
||||
|
||||
\begin{verbatim}
|
||||
\begin{music}
|
||||
\parindent10mm
|
||||
\instrumentnumber{1} % a single instrument
|
||||
\setname1{Piano} % whose name is Piano
|
||||
\setstaffs1{2} % with two staffs
|
||||
\generalmeter{\meterfrac44} % 4/4 meter chosen
|
||||
\startextract % starting real score
|
||||
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
|
||||
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
|
||||
\zendextract % terminate excerpt
|
||||
\end{music}
|
||||
\end{verbatim}
|
||||
|
||||
which produces this bit of music:
|
||||
|
||||
\begin{music}
|
||||
\parindent10mm
|
||||
\setname1{Piano} % whose name is Piano
|
||||
\instrumentnumber{1} % a single instrument
|
||||
\setstaffs1{2} % with two staffs
|
||||
\generalmeter{\meterfrac44} % 4/4 meter chosen
|
||||
\startextract % starting real score
|
||||
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
|
||||
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
|
||||
\zendextract % terminate excerpt
|
||||
\end{music}
|
||||
|
||||
What strikes me most is that most of that code is not in any way intuitive. The package is well-documented, but at 166 pages, it's going to take some work to become proficient. There's no reason you \textit{couldn't} learn this, but it's not something you're going to do overnight.
|
||||
|
||||
\subsection{ABC}
|
||||
|
||||
The \texttt{abc} package allows you to use the ABC language to create snippets of music directly in your LaTeX document, using the \texttt{abc} environment. Unfortunately, while I can get this to work in standalone documents, I have not been able to figure out how to incorporate into a regular LaTeX document like this one. For example, this bit of code:
|
||||
|
||||
\begin{verbatim}
|
||||
\begin{abc}
|
||||
X:4
|
||||
T:Cronin’s Hornpipe
|
||||
R:hornpipe
|
||||
S:Keenan and Glackin
|
||||
E:7
|
||||
M:C|
|
||||
L:1/8
|
||||
K:G
|
||||
BA|GABc dBde|gage dega|bage dBGB|cABG A2BA|!
|
||||
GABc dBde|gage dega|bage dBAB|G2G2 G2:|!
|
||||
fg|afd^c d2ga|bged e2ga|(3bag (3agf gedB|(3cBA AG AcBA|!
|
||||
GABc dBde|~g3e dega|bage dBAB|G2G2 G2:|!
|
||||
\end{abc}
|
||||
\end{verbatim}
|
||||
|
||||
should produce a lovely little bit of music, but all it produces is this:
|
||||
|
||||
\begin{abc}
|
||||
X:4
|
||||
T:Cronin’s Hornpipe
|
||||
R:hornpipe
|
||||
S:Keenan and Glackin
|
||||
E:7
|
||||
M:C|
|
||||
L:1/8
|
||||
K:G
|
||||
BA|GABc dBde|gage dega|bage dBGB|cABG A2BA|!
|
||||
GABc dBde|gage dega|bage dBAB|G2G2 G2:|!
|
||||
fg|afd^c d2ga|bged e2ga|(3bag (3agf gedB|(3cBA AG AcBA|!
|
||||
GABc dBde|~g3e dega|bage dBAB|G2G2 G2:|!
|
||||
\end{abc}
|
||||
|
||||
\section{Tablature}
|
||||
|
||||
|
||||
\chapter{What's to Like About Linux}
|
||||
|
||||
\section{Open Source}
|
||||
|
||||
This doesn't come up for me every day as I use Linux, but one of my favorite things about Linux is that it's open source. That is, the source code is easily and freely available, provided you know where to look for it. This means two primary things:
|
||||
|
||||
\begin{enumerate}
|
||||
\item I can download the software for free and install and use it on as many machines as I choose to.
|
||||
\item I can download the source code and make whatever changes I like. I can then keep them to myself, or release those changes to the world for other people to use.
|
||||
\end{enumerate}
|
||||
|
||||
We'll look at each of those two things in turn. But first, read the back cover and then come back here.
|
||||
|
||||
\medskip
|
||||
|
||||
\noindent{}Let's start with point \#1.
|
||||
|
||||
\medskip
|
||||
|
||||
The two main commercial alternatives to Linux are macOS (Apple) and Windows (Microsoft).
|
||||
|
||||
macOS is expensive. The only to get it is to buy an Apple product. I admit, Apple products are \textit{gorgeous} and the hardware is usually designed to last for a long time.\footnote{iPhones may be the exception to this.} But it is also \textit{expensive}. I've done a bit of research and the cheapest Macintosh laptop I can buy is easily five times the price of the cheapest Windows laptop I can buy.
|
||||
|
||||
That actually makes Windows sound cheap in comparison. But is it?
|
||||
|
||||
\medskip
|
||||
\hrule
|
||||
\medskip
|
||||
|
||||
\noindent\textbf{Oh look, it's our first diversion.}\texttt{<rant>}
|
||||
|
||||
\begin{multicols}{2}
|
||||
|
||||
We are in Late Stage Capitalism. That is, we have reached a stage of capitalism which is unsustainable on this planet alone. The entire point of capitalism is ``growth'' but when you are limited to an existence on a single planet that has no trade with other planets, that growth is limited by the amount of whatever resources that planet has. And when those resources run out—or it becomes impossible to make a profit by exploiting them—capitalism will collapse, and it will very like take billions of us with it.
|
||||
|
||||
These resources have always been \textit{physical} resources—wood, coal, oil, rare-earth elements, and the labor of the working classes to extract and process them.
|
||||
|
||||
Because those resources are finite, we've seen capitalism go off in other directions to find other resources to exploit. This explains why rich white guys with entirely too much time on their hands want to ride their penis-rockets into space—because asteroids are out there and they're just full of iron, cobalt, and other metals just waiting to be mined.
|
||||
|
||||
But we've also seen capitalism go in a hitherto new direction: the digital direction. Capitalism is no longer interested in just mining iron or coal; it's also interested in mining \textit{data}. Data, it seems, is the one resource we can never run out of.\footnote{When I worked in retail, I was always told to push the extended warranties whenever I could. This was partly because the profit margin on them was incredibly high (extended warranties are basically a legal scam because there are so many terms and conditions you'll never be able to cash in) and ``they're the one inventory item we never run out of.''}
|
||||
|
||||
The primary kind of data they want is information about what we are interested in: what we want to buy, because if they know what we are interested in, they can then sell that information to advertising platforms who will slug your user experience full of advertisements for those exact things.
|
||||
|
||||
Order a ham sandwich for lunch online? That is now data. We know you like both ham and sandwiches. (Okay, this is really an \textit{assumption}, but algorithms are built by people, and they are only as good as the people who built them. In short, algorithms make the same assumptions as the people who built them.)
|
||||
|
||||
Order a ham sandwich on Monday, but order a turkey sandwich on Friday? That is also data. Now I know lots of things about you:
|
||||
|
||||
\begin{enumerate}
|
||||
\item You like sandwiches.
|
||||
\item You sometimes order out for lunch.
|
||||
\item You prefer pork-based products early in the week.
|
||||
\item You prefer poultry-based products later in the week.
|
||||
\end{enumerate}
|
||||
|
||||
That is now four data points that can be sold to companies that will direct advertising at you for those items. And they will combine that data with other things they know about you (where you live, how old you are, your marriage status, your income, etc.) to come up with a list of stuff they think you'll \textit{probably} be interested in and slugs those ads in front of you.
|
||||
|
||||
Of course, they aren't selling that data to a local mom-and-shop sandwich shop down the road that cures their own meats and bakes their own bread according to a 100-year-old family recipe. They're selling that data to multi-million dollar corporations whose success will be built on the corpses of little mom-and-pop shops.\footnote{Oh wait, that's already happening.}
|
||||
|
||||
As a result (because when it comes to both hunger and money, your big huge mammalian brain depends on that little tiny reptilian bit at its core) when you think ``I could really go for a sandwich right about now'' you automatically think of the nearest evil international sandwich shop and not the local mom-and-pop sandwich shop, simply because you saw an ad for the EISS. You \textit{think} you are choosing, but you are not. Like a rat in a Skinner test, you are merely being rewarded for pushing the button that capitalism wants you to push.
|
||||
|
||||
And this is what Windows does. It gathers your data and ``shares'' it with other companies it has paid agreements with.
|
||||
|
||||
\noindent\texttt{</rant>}
|
||||
|
||||
\end{multicols}
|
||||
|
||||
So, Windows may appear to be low-cost or even free when you buy that new computer, but it does have a cost—your privacy. And because advertisers use some pretty sophisticated techniques to get you to buy their stuff, there is an additional cost—your ability to truly choose for yourself.
|
||||
|
||||
|
||||
\chapter{Coda}
|
||||
|
||||
\section{What I Learned About \LaTeX{} While Creating This Issue}
|
||||
@ -227,4 +430,80 @@ The problem is that I always envisioned this zine as being a physical object, no
|
||||
|
||||
But yeah, you should definitely resize your images before including them in any document you intend to distribute digitally. (Thank you, GIMP.) You'll notice that the image of the VT100 terminal on page 5 clocks in at a very sensible 79 kb. That's more like it.
|
||||
|
||||
\subsection{Install \LaTeX{} Packages on Ubuntu}
|
||||
|
||||
\subsubsection{Method 1}
|
||||
|
||||
Every once in a while I run into a package that I want to use with LaTeX that is not installed on my system. Alas, there is no easy way to do this, at least that I found. \textit{Later}, I always thought. I'll figure that out later.
|
||||
|
||||
\textit{Later} became \textit{today} when I wanted to use the \texttt{harmony} package to produce some music symbols but couldn't, because it wasn't installed on my system. It took some doing, but I finally figured it out. Here's what I did:
|
||||
|
||||
First, I downloaded the \texttt{harmony} packaged from \href{https://www.ctan.org/pkg/harmony}{\texttt{https://www.ctan.org \\ /pkg/harmony}} and unpacked the archive. That was easy enough.
|
||||
|
||||
Next, I had to figure out where to put it. I ran this command:
|
||||
|
||||
\begin{verbatim}
|
||||
$ kpsewhich -var-value TEXMFLOCAL
|
||||
\end{verbatim}
|
||||
|
||||
which gave me this location:
|
||||
|
||||
\begin{verbatim}
|
||||
/usr/local/share/texmf
|
||||
\end{verbatim}
|
||||
|
||||
Following the directions I found at \href{https://jvgomez.github.io/pages/manually-install-latex-packages-in-ubuntu.html}{\texttt{https://jvgomez.github.io/page \\ s/manually-install-latex-packages-in-ubuntu.html}} I entered that directory using \texttt{sudo} and created the following directory structure:
|
||||
|
||||
\begin{verbatim}
|
||||
/usr/local/share/texmf/tex/latex/harmony
|
||||
\end{verbatim}
|
||||
|
||||
I then copied my files over from the unpacked \texttt{harmony} files:
|
||||
|
||||
\begin{verbatim}
|
||||
$ sudo cp * /usr/local/share/texmf/tex/latex/harmony
|
||||
\end{verbatim}
|
||||
|
||||
I then had to update the search path to make my system aware of the new package:
|
||||
|
||||
\begin{verbatim}
|
||||
$ sudo mktexlsr
|
||||
\end{verbatim}
|
||||
|
||||
This should have been the end of it, but the \texttt{harmony} packages requires a certain set of fonts to do its work. After a bit of searching, I found them at \href{https://ctan.org/tex-archive/fonts/musixtex-fonts}{\texttt{https://ctan.org/tex-archive/fonts/musixtex-fonts}}.
|
||||
|
||||
Fortunately, that package had a pdf document that described how to install the fonts. I started by copying the ``fonts'' folder over the \texttt{texmf} directory:
|
||||
|
||||
\begin{verbatim}
|
||||
$ cp fonts /usr/local/share/texmf
|
||||
\end{verbatim}
|
||||
|
||||
And then I updated the search path and then the font-map files with these commands:
|
||||
|
||||
\begin{verbatim}
|
||||
$ sudo mktexlsr
|
||||
$ sudo udpmap-user --enable MixedMap musix.map
|
||||
\end{verbatim}
|
||||
|
||||
Like I've said elsewhere, I'm running a recently updated Ubuntu 22.04 system, and this worked for me. It may work for you, it may not. I can't even guarantee that it will work for me next time. (I suspect having a generic folder name like ``fonts'' may cause me issues down the road if I ever want to install some other LaTeX fonts.) But if I got it to work once, I'm pretty sure I can get it to work again. We shall see.
|
||||
|
||||
\subsubsection{Method 2}
|
||||
|
||||
A perhaps easier (and certainly more \textit{portable}) way of installing LaTeX packages is to add them to a local directory along the lines of:
|
||||
|
||||
\begin{verbatim}
|
||||
/home/user/texmf
|
||||
\end{verbatim}
|
||||
|
||||
This is how I installed the \textit{musixtex} package, and it far simpler than what I have described in method 1.
|
||||
|
||||
First, I downloaded the package and unpacked it. Then I copied its contents into my \texttt{texmf} directory, and finally updated the filename database:
|
||||
|
||||
\begin{verbatim}
|
||||
$ cp * ~/texmf
|
||||
$ sudo ~/texmf
|
||||
\end{verbatim}
|
||||
|
||||
Mischief managed!
|
||||
|
||||
\end{document}
|
Loading…
Reference in New Issue
Block a user