\documentclass[twoside]{report} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amssymb} \usepackage{makeidx} \usepackage{graphicx} \usepackage[nott]{kpfonts} \usepackage{float} \raggedbottom \usepackage{array} \usepackage{multirow} \usepackage{gensymb} % Just for the degree symbol % Where are our images? \graphicspath{{images/}} % Let's set this as a half-letter sized sheet \usepackage{geometry} \geometry{ paperheight=8.5in, paperwidth=5.5in, % heightrounded, margin=0.5in } % Adjust the top and bottom margins \addtolength{\topmargin}{0.4in} \addtolength{\textheight}{-0.75in} % Set the header style \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[LE,RO]{\textit{the codex}} \fancyhead[RE,LO]{Issue \#004} \cfoot{Page \thepage} \renewcommand{\footrulewidth}{0.5pt} % Include two- or three-column sections \usepackage{multicol} % Stop resetting the footnote count after each chapter \counterwithout{footnote}{chapter} % Let's wrap some images \usepackage{wrapfig} % Use tab stops when we need to (especially in footnotes) \usepackage{tabto} % Define 18 tab stops (at 1/4" intervals) \NumTabs{18} % Make things neater. Thanks /u/-LeopardShark- \usepackage{microtype} % Easy tables \usepackage{tabularray} % Make a nice border and box for the tops of our examples \newcommand\klab[3]{\vspace{#1}\noindent{}\hrulefill\fbox{\texttt{~#2~}}\hrulefill\vspace{#3}} % Add an \hrule with space above and below \newcommand\krule[2]{\vspace{#1}\hrule\vspace{#2}} % Make hrefs easier (must load package hyperref} \newcommand\kref[2]{\href{#1}{{\texttt{#2}}}} % Rotate text in tables easier % https://tex.stackexchange.com/questions/89115/how-to-rotate-text-in-multirow-table \newcommand\krot[3]{\parbox[t]{#1}{\multirow{#2}{*}{\rotatebox[origin=c]{90}{#3}}}} % Use line numbers with code samples % \begin{Verbatim}...\end{Verbatim} <-- Note the capitalization! \usepackage{fancyvrb} % Break lines inside this environment: \usepackage{fvextra} % Control spacing in lists \usepackage{enumitem} % Don't force text to fill page \raggedbottom % Better control over line-spacing \usepackage{setspace} % Use nice fractions \usepackage{nicefrac} % Keep the footnotes at the bottom of the page \usepackage[bottom]{footmisc} % Do we want to include URLs? % Yes, but we also want to hide the big red box it puts around them in the pdf. Thanks /u/0b0101011001001011 \usepackage[hidelinks]{hyperref} % Adjust space between caption and figure % https://tex.stackexchange.com/questions/45990/how-can-i-modify-vertical-space-between-figure-and-caption \setlength{\belowcaptionskip}{4pt} % Just for issue #004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{pifont} \usepackage{qrcode} \usepackage{mhchem} \usepackage{chemformula} \usepackage{chemfig} \usepackage{tikz} \newcommand\kpage[1]{ \begin{tikzpicture} \draw (0,0) rectangle (.8,1.4); \node at (0.4,.7) {{\LARGE #1}}; \end{tikzpicture} %\hspace{-3mm} } %%%% Document Information %%%%% \author{Kenneth John Odle} \title{ {\Huge the codex} \\ {\footnotesize Life with Linux — A Zine \\ \bigskip Typeset in \LaTeX{} \\ Issue \#004} } \date{\begin{small}\today{}\end{small}} % Change the name of the TOC \renewcommand*\contentsname{In This Issue…} \begin{document} \maketitle \section*{Impressum} All contents \copyright2024 Kenneth John Odle Although this is now in your hands, and it's also on the web, so if you really wanted to steal this, I've made it pretty darn easy. I can't imagine why anyone would want to, though. However, you don't need to, because this is licenced under a CC BY-NA-SA 4.0 Creative Commons license. More information is at \kref{https://creativecommons.org/licenses/by-nc-sa/4.0/}{https://creativecommons.org/licenses/by-nc-sa/4.0/} \includegraphics[scale=0.30]{ncsa4-0} \medskip FYI, this is made in \LaTeX \,using the report document class. It then gets exported to a letterhalf (5.5 in x 8.5 in) pdf, which then gets made into a booklet using PDF Booklet, which you can find at \kref{https://pdfbooklet.sourceforge.io/wordpress/}{https://pdfbooklet.sourceforge.io/wordpress/} \medskip The image of Linus Torvalds on the front cover is courtesy JericoDelayah from the WikiMedia Commons. The image is from \kref{https://commons.wikimedia.org/wiki/File:4_RETAT_04_Linus_Torvalds.jpg}{https://commons.wi\\kimedia.org/wiki/File:4\_RETAT\_04\_Linus\_Torvalds.jpg} where you can also find a link to the Creative Commons CC BY-SA 3.0 license there, as well. I'm pushing this to my own git server as I write this. You can find it \href{https://git.kjodle.net/kjodle/the-codex}{here}: \kref{https://git.kjodle.net/kjodle/the-codex}{https://git.kjodle.net/kjodle/the-codex}. New issues will be pushed after they are complete. A list of topics I may cover in the future can be found at \kref{https://git.kjodle.net/kjodle/the-codex/wiki/List-of-Future-Topics}{https://git.kjodle.net/kjodle/the-codex/wiki/List-of-Fu\\ture-Topics}. You can just skip over all the diversions in here if you want. It's just how my mind works. (And yes, there will be politics in this. \textit{You have been warned.}) Also, I use a lot of em-dashes, parentheses, and footnotes because that is also how my mind works. It's just one big long stream of consciousness up in here most days. \medskip \noindent \textbf{Errata:} To err is human, to document those errors is divine. A list of errata can be found at \kref{https://git.kjodle.net/kjodle/the-codex/wiki/Errata}{https://git.kjodle.net/kjodle/the-codex/wiki/Errata}. \medskip \noindent \textbf{Credit where credit is due:} A lot of people have come forth (mostly from Reddit) to help me out in various ways. See the preamble to this document in the source code to see them. One aspect of our society is that nobody \textit{has} to help you. It is wonderful when it happens, and I am grateful for their help. \tableofcontents \chapter{Introduction} \begin{multicols}{2} \begin{small} \noindent{}Well, it's been a while, hasn't it? I'm gratified that this zine has a small but dedicated fan base who have a lot of great things to say about it. The feedback that I have gotten has been nothing short of amazing. I appreciate every single bit of it. It does make me sad, though, that I can't get these out on a more regular basis. When I was younger, I wrote all the time, but as I get older, I find that I write more slowly and often with great difficulty. Part of that is no doubt my current job (which I talk about chapter two) and part of it…well, all the things that go along with just trying to make it in this day and age. And a large part of it is no doubt due that I have short bursts when I get quite a bit done, and then long periods where I get nothing done. One of college professors said that I tend to ``run hot and cold'', some other people have told me that this sounds like bipolar disorder, and others have said that this is a natural part of the creative process for some people. I suppose there isn't any reason that it couldn't be all three. Another reason is that I find I write best when I can work longhand. There is just something about the feel of pen or pencil on paper that really gets my creative gears going. Once they get going, I can usually switch to working digitally without too many problems. \end{small} \end{multicols} \chapter{The Final Salad Days} \section{College, 2008} 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! The rich get richer and everyone else gets poorer.} I decided to go back into teaching (which, thanks to current conservative political policies\footnote{Along with the asshole behavior of parents who approve of those policies.} there will always be a demand for), which meant I needed to go back to college to renew my teaching license. But this is a whole other story for which I have run out of space (not to mention it has very little to do with Linux or even computers), so it will have to go in a different zine if I ever decide to write it down. What I can say is that the first time around, I wanted to get a biology major and an English minor because I wanted to teach biology and English, and I thought (naively) that this was how things worked.\footnote{They don't. Who knew?} But my biology advisor, a man who was many decades if not centuries my senior, advised against that plan. He felt that it would make me unhireable because it would look like I could not make up my mind between biology and English. I did not realize it at the time,\footnote{I may not have realized it until just \textit{now}, when I wrote this.} but he was revealing his prejudice as a Biology professor. He was wrong, ultimately (schools absolutely love it when you can teach more than one subject as it provides for a lot of flexibility in scheduling), but his argument scared me. I was going to go thousands of dollars in debt for this degree (I was not smart enough to get a full scholarship, so I had to make up the difference with grants and loans—lots and lots of loans), and if I couldn't get a job, I wouldn't be able to pay back those loans. I would be sentenced to a life of penury, which is the very thing a college degree was supposed to protect against. So I agreed with him and forgot about getting an English minor. His second argument was that as a prospective biology teacher, I was \textit{required} to get a group science ``minor'', which is in quotation marks because it was actually 36 credit hours, which was the equivalent of a major, rather than the 20 credit hours typical of an actual minor. As a result, I would have little time or energy (or money!) for another minor. So in 2008 I decided to go back to teaching. To do so, I needed to get eight credit hours in ``a teachable subject'' so I decided to take a couple of English classes, as that would both meet the legal requirements and also give me a chance to read and write for credit. As they say, things happened. At first I was taking a couple of English classes. But then I thought, that's eight credit hours. If I take three more I could actually get the full minor. Why not? So a couple of English classes became an English minor, which eventually became an English major. Becoming a biology teacher required that I take a \textit{methods} class, which is a class about…well, basically it's a class about how to \textit{be} a biology teacher. It teaches you how to plan labs and field trips, and how to do things in a safe way so that nobody gets hurt, and covers the specifics of teaching biology that were not covered in your regular education classes. Becoming an English teacher required that I take \textit{two} methods classes: one about teaching literature and one about teaching writing. I remember very little about either class. (And to be honest, I remember more about the graduate class I took in fairy and folk tales, because those tales evolve like living beings—which in a way they are. This was where biology and literature overlapped for me in the Venn diagram of my life.) The one thing I remember very distinctly about the writing methods course was that our capstone project had to be \textit{online}. Oh wow, I thought—I've been creating websites for a while now. But I was worried. I had been hearing about how young people were so good with technology, so comfortable with it, that I was sure whatever I came up with would just blow my feeble old school attempts out of the water. I could not have been more wrong. Our instructor asked how many of us had any experience creating websites. Only three of us raised our hands: a middle-aged woman, a young woman still on Plan A, and myself. Half of the rest of the class had mildly panicked looks on their faces. Our instructor sent the three of us into a small computer lab at the end of the classroom to star making plans while she explained to the rest of the class how to create a web site. Of course, if you leave three students alone in a room, they're not going to get any work done—they're going to sit and talk. It doesn't matter what their ages are—work is just not going to be a priority for them. It simply won't be on the list of things to do. As it turns out, the older woman and I both had experience creating websites from scratch and the younger woman (the one of us who was still on Plan A) had once set up a forum for her gaming community using phpBB. Which is not quite the same thing as setting up a website, but close enough. It's better than nothing. She also spent quite a bit of time talking about "leetspeak" which had somehow passed me by—perhaps because I have never been much of a gamer.\footnote{Everything I read about this makes me feel that is either something that is pretty cool or the most annoying thing in the world. I can't quite make up my mind.} Still, this left some twenty-odd young people on the other side of that door who were utterly clueless about how to create a website, and judging by the looks on many of their faces, were more than a little nervous about the prospect. I mention all of this because what I often heard then was young people are \textit{so} good with computers, that they are \textit{so} comfortable with computers, and why wouldn't they be? After all, they grew up with them. In fact, the term that got bounced around a lot in the education world at the time was ``digital native''. It was just assumed that young people could do anything with computers because they had grown up with them. Well, I had grown up with computers, too, only I did it twenty-five years before these kids did. Only the computers I grew up with did not have GUI or a mouse. They made you think a little bit more than modern computers. But it is not the presence or absence of a mouse or a GUI that means are good with a computer. A lot of kids my age also had Commodor 64s and all they did with them was shove a cartridge in the back and play games. This in no way prepared them to know how to set up a spreadsheet in VisiCalc to balance your checkbook.\footnote{Which was one of the very first things I ever tried to do with a spreadsheet. It is not nearly as easy as one might think.} Again, I blame the educational industrial complex here, which I believe is where the term ``digital native'' came from. (And again, this is a feature, not a bug, of capitalism. The main goal under capitalism is to just extract as much money as you can from the people around you, and it doesn't really matter if you are correct or not. Your only value is determined by how much wealth you bring to the shareholders.) Growing up with a computer in your house doesn't mean that you'll be an expert at anything and everything digital any more than growing up with a car in the driveway means you'll know how to drive it, let alone change the oil or rebuild the carburetor. It's a completely false assumption. So what does it mean to be ``good'' with something? Especially with computers? This experience of being segregated into a little room almost twenty years ago because of something I new while those around me didn't has marked me in some way. It's taken me a long time to actually figure it out, and it boils down into two main concepts. The first is that capitalism (and one of its most pernicious offspring, social media) deliberately blurs the lines between being a \textit{user} of some technology and being the \textit{product} of that technology. (Protip: Do you see ads on your content that you can't control? Does the algorithm tell you whom it shares your content with, or how it determines that? If the answer to those questions is ``no'' then you are not a user, you are a product. I could say more about this. In fact, I already have, and will probably say more in the future.) Second, there really is no such thing as someone who is ``good at computers''. This is like ``being good at sports'' or ``liking Asian food''. The concepts of ``computers'', ``sports'', and ``Asian food'' are really too large to be considered as a single entity. There is really only ``being better at this one particular thing than everyone else in the room''. In fact, the person who is good at computers generally has only three characteristics that make them that way. First, they are not afraid to experiment. They know how to \textit{undo} things, or they know to experiment on a copy of the file. This is easier to do on a computer than in the analog world because the physical costs are so low—it's basically just your time. You can make an unlimited number of copies. But if I'm trying to figure out how long to cut a board to build something, I don't have an endless supply of those boards. Ideally, I would like to make a single cut and get it done in one go and not have to go back to the lumber yard because I cut the board an inch too short. Second, they are good at recognizing patterns. This means that they don't need to reinvent the wheel each time; they can look at a new problem and see if it is similar to an old one and whether it's possible to adapt an older, tried and true solution to this new problem. ``The thing that hath been, it is that which shall be; and that which is done is that which shall be done: and there is no new thing under the sun.''\footnote{Eccleiastes 1:9} Yep, all our new problems are just iterations on our old problems. Third, they are good at searching the web for a solution. This is easier now than it was twenty years ago because the web is simply so much bigger than it was then. There is an art and a science to this, so much so that we used to use the term ``google-fu'' or ``search-fu''\footnote{Like ``kung-fu''. Get it? Sometimes we are tiresome people.} But all this really means is knowing how to construct a search query that does not return superfluous answers. In the old days it was largely knowing how Boolean functions worked. These day, artificial intelligence is probably going to screw this completely up. (Or they already have—I recently saw a screen clip of an AI bot recommending adding half a cup of glue to your gravy to thicken it up. I'm sure this would work, but it would not be the gravy you are looking for.) I can give a couple of examples here. At my old job, we received planning schedules from our customers on a weekly basis. Our material planner would print and enter these into our system and it would give us an idea of how much production we needed to run each week. One of our customers upgraded their planning software and what had been a twelve-page easy to understand report suddenly became a report running to well over a hundred pages that was full of irrelevant information and multiple empty columns. I noticed that this information could be downloaded as a \texttt{.csv} file, though. So I created a spreadsheet that would allow you to import the \texttt{.csv} file, and which would then use VBA to get rid of all the information we didn't need, sort all the data in a way that made sense for our purposes, and then export the entire thing as a pdf file. Because it worked (and worked \textit{well}) I was lauded as a guy who is ``good with computers'' (which largely overlooked all the expertise my coworkers made use of every day as they did their jobs—which were largely computer based). The truth is that I knew absolutely nothing about VBA going into this. I just used those three characteristics—a willingness to experiment, an ability to recognize pattersn, and a determination to search the web until I found the solutions\footnote{Or enough different solutions that I could put bits and pieces of them together until I got to where I needed to be. Every bit of software out there bears more than a passing resemblance to Dr. Frankenstein's creation, once you look beneath the hood.} I was looking for—and created something which worked. But does this make me an expert at Microsoft Excel or at VBA? Hardly. I mean, it did to all those people who saw this spreadsheet in action. But I didn't view myself as someone who was good at Excel or VBA. I just viewed myself as someone with a dogged determination to keep experimenting until I got it right. To me, the idea of someone who is ``good with computers'' is \textit{very} relative and not at all absolute. Proof of this came in the form of an engineer that we hired out of his early retirement. He said he was not good with computers, and he was not. (He was adequate to the task required, though.) But he showed me a trick that I have been using ever since. One of my many frustrations (and indeed pretty much any spreadsheet program) has always been that if you need to edit the data at the end of the cell (where I am most likely to make a mistake) is that it's always a two-step process. Either you click on the cell to select it and then click in the formula bar to move the cursor to the end of that data, or you have to click on the cell to select it, and then click again on the right end of that cell to move the cursor. (If you click in the middle of the cell, then that's where the cursor ends up. Who is in charge of this stuff?) Just writing all that gives me a headache. It's no wonder people so often give the side-eye to not just Excel but to most Microsoft products. (As they should.) But this engineer—who said he was not at all good with computers and then went on to both prove and disprove that assertion—showed me a trick that I use to this day. If you have a cell selected (and I use cursor keys rather than a mouse to navigate around a spreadsheet 90\% of the time) all you need to do is press the F2 key and the cursor will automatically move to the end of the data in that cell, where you can then use your keyboard to do what you need to do. This was sheer genius! And yet I had never heard of it. If I had known this ten years before, it would have saved me so many mouse clicks so much frustration. So in this instance, this engineer, who viewed himself as anything but ``good with computers'' was indeed very good with computers, simply because he knew something I didn't. \vspace{\baselineskip} \noindent{}Here's another example. At my current job we have an Excel form that we use every single day. It basically does three things: 1) It collects any findings we discover in an experiment. 2) It adds those findings to a database so that we have metrics to measure analyst performance by. 3) It generates an email to send to the analyst in question so they make corrections. The VBA that runs this form is absolutely huge—it's at least two orders of magnitude greater in size than any amount of VBA I have ever authored. To my way of thinking the person who is responsible for the maintenance of this form is a \textit{true} VBA expert. My level of expertise comes nowhere near theirs. And yet, they still insist that they are not an expert, that they are just really good at searching for solutions on the web, at recognizing patterns (especially in error messages), and they just keep experimenting until they get it right. (Sound familiar?) But I am still able to do little bits here and there for other people—creating forms that generate a pdf and then automatically attach it to an email, for instance. (I've done this a couple of times for my boss, and the people on the other end have been suitably impressed, so I've added this skill to my resume. Imposter syndrome be damned!) The number one characteristic I've discovered that is shared by all people who are generally viewed as ``good with computers'' is \textit{confidence}. Not knowledge, not skill, not experience. \textit{Confidence}. Although it's true that confidence comes from knowledge, skill, and experience. But I've met a lot of people who have knowledge, skill, and experience\footnote{How can you \textit{not} have experience with computers in 2024, when even Amish people have cell phones? It's because you can either choose to recognize that they are a part of your experience and roll with it, or refuse to acknowledge them and fight a losing battle against them.} but they still lack confidence and thus are not seen, nor do they see themselves, as being good with computers. I've had to coach a lot of people like this over the years and while it's easy to give someone knowledge, or experience, or skill, it's almost impossible to get them to put those three things together into confidence. It's really something they have to gain on their own, and they either do or they don't. Likewise, I've seen people with far less knowledge, far fewer skills, and far less experience who are considered to be ``good with computers'' simply because they are confident. The fact is that sometimes they are good because that confidence gives them the determination they need to do just one more web search (or ten more) or to try just one more thing (or ten more things) to get where they need to be. They start with the attitude that it can be done, and that all they need to do is to keep hacking away at the problem until they find a solution. They don't just sit there and moan and complain. They experiment and innovate. They ask for help in the right way.\footnote{And yes, there is a right way and a wrong way to ask for help. I've written about this before, so perhaps I should write about this in a future issue.} Most importantly, they keep going. And that's what I ultimately like about Linux—it encourages you to keep going. You don't get to a point where things are hidden away behind a proprietary brick wall. Everything is open source, right down to the core, and you can dig as deeply as you like. The only thing that's really holding you back (besides your attitude) is your time and money. But for me to even talk about these things would mean that I would have to do a deep dive into the many faults of capitalism, and that's not what this zine is about, although I do touch on that tangentially (or not so tangentially) from time to time. That is really my biggest disappointment when it comes to computers. They were supposed to be the great equalizer, because everybody would have access to the same information and the same tools. But it hasn't worked out like that at all. We commodified everything. I look around me now and I thoroughly understand the reaction that the Taylor character had at the end of the original \textit{Planet of the Apes} movie: ``You maniacs!'' he yells when he sees the ruins of the Statue of Liberty on the other side of the Forbidden Zone. ``You blew it up! Damn you all to hell!''\footnote{This is an authentically great film by the way. With a script cowritten by Rod Serling and based on a novel by Pierre Boulle (who also wrote \textit{Bridge on the River Kwai}) and directed by Franklin J. Schaffner (who also directed \textit{Patton}) how could it not be? I highly recommend it.} Yep, we blew it all up so we could create value for the shareholder. We're not quite at a ruined-Statue-of-Liberty-on-the-beach point yet, but we are, I fear, very close to the end. We could have done better as a species, but we didn't. As Stephen King says of his generation, ``we had a chance to change the world but opted for the Home Shopping Network Instead''. The optimistic side of me says that it's not too late, while the pessimistic side of me says that it is, that we are past the tipping point, but we just don't realize it yet. I'm just note sure. In the meantime, I'll keep doing what I'm doing. I'll keep writing, I'll keep striving to do better. And I'll keep hoping. \section{Today} I am in a very different place now than I ever thought I would be. I'm not on Plan A or Plan B. In fact, I've pretty much run out of alphabet to describe exactly where I am now. So where am I? I work as a data reviewer for a contract research organization in the pharmaceutical industry. That means that drug companies send us samples of their products, and we test them for things like assay, impurities, appearance, disintegration, etc. People who majored in chemistry run the tests and I sit there and look at their procedures and results and make sure that everything was performed correctly and that the results are, indeed, valid. In theory, I'm an analytical chemist. In practice, I'm a nerdy science accountant who spends his day with his nose buried in Excel spreadsheets. A \textit{lot} of Excel spreadsheets. Except that I also used to design websites, so my spreadsheets are easy on the eyes, color-coded, and logically oriented—that is, they take you through the analytical method in a step-wise, chronological manner. In other words, we look at standard concentrations first, and then our system suitability tests, and then the actual tests. Every cell is also labeled, so it's clear what goes where. My boss admires them and I am justifiably proud of them. After all, these aren't just your ordinary, run-of-the-mill spreadsheets we're talking about here. My spreadsheets are so beautiful that when my boss got a glimpse of them he immediately placed me in charge of mentoring new data reviewers, mostly so that they could see what my spreadsheets look like. And I get it. I worked really hard to make spreadsheets that are understandable not just to me but everybody because we may have a corrective action come up at some point and we need to be sable to see how we arrived at the results that have. So yep, I strive to make all my spreadsheets consistent and understandable to someone who has no familiarity with them. \texttt{tl;dr:} I'm \textit{really} good with Microsoft Excel. But it's not satisfying work.k It pays the bills\footnote{Well, barely, after the recent fit of massive corporate price gouging—I mean, er…inflation.} It's not exactly the hind end of science, but it's close. (I once worked in a lab that did non-clinical testing\footnote{i.e., rats and mice} and believe me, \textit{that} is the hind end of science.\footnote{Science actually has many hind-ends. This is but one of them.}) I'm not really doing science; if anything I'm just a science accountant, making sure the books balance. It's boring—\textit{really }boring—and more than a bit mind-numbing. Considering that my entire job exists to help keep the drug supply safe (well, the \textit{legal} drug supply) safe that statement may sound frightening or even disturbing. But it's not really. You want this job to be boring. When it's not boring, it's generally because something has gone wrong, and and this is one of those industries (like nuclear energy or airplane manufacturing) where you really don't want things to go wrong. \chapter{More Fun with bash} As I get older, I find that I want to spend less time doing repetitive tasks that need to be done, and spend more time doing the stuff I want to do, like writing. As it turns out, Linux can help with that goal. More time writing and drawing and making photographs is a good thing, and something I'm grateful to Linux for. The trick is, you have to be comfortable with the command line. \section{Bash Aliases for \texttt{git}} One of the nice things about Linux is that once you get used to working on the terminal, it makes your life a lot easier. I'm a huge believer in having a workflow so that you are doing things consistently, and so that you can make gradual improvements to that workflow so you can get more done with less.\footnote{Also, having a workflow means that if you are doing something wrong, you are doing consistently doing it wrong the same way. In which case, you only need to figure out a single fix and apply it to each mistake. If you don't have a workflow, you can screw up in many different ways, and have to figure out a lot of different fixes. Making mistakes is a part of life; making consistent mistakes makes fixing them a less miserable task.} Linux makes it easy for you to do that. Back in issue \#2 I talked about using Bash aliases to make your life easier. I've also started using them with \texttt{git} as well. Here's what they look like: \newpage \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Bash aliases for git}] alias gits="git status" alias gita="git add *" alias gitx="git add *.tex" \end{Verbatim} The first one just prints out the status of any git project that I'm working. The second one will automatically add all files (except for invisible files) to the commit. Because I use \LaTeX{} a lot, I also have the third one, which will commit any changed files that end in a \texttt{.tex} extension. I rarely have invisible files in my git repositories except for the .gitignore file, which I rarely change, so I don't need a Bash alias here. I find it easy enough to type \verb+git add .gitignore+ on the rare occasion that I need it. But if I did want to add that file on a regular basis, I could just change that line to: \begin{Verbatim}[] alias gita="git add * .*" \end{Verbatim} or I could just add a separate command for it: \begin{Verbatim}[] alias giti="git add .gitignore" \end{Verbatim} Of course, if I were changing my \textit{.gitignore} file that often, I would start to (quite rightly) question some of the other choices I've been making with my life. \section{Bash Commands for \textit{git}} It would be nice if we could do the same sort of thing for \texttt{git commit}, but we can't, because we need to add some sort of message to our commit. (In other words, it requires an \textit{argument}.) So for that, we need to add a \textit{function} to Bash. As it turns out, this is pretty simple. It looks like this: \begin{Verbatim}[] gitm(){ git commit -m "$1"; } \end{Verbatim} %$ First, we start with our basic function, which is written like any other function: \begin{Verbatim}[] gitm() \end{Verbatim} So, to invoke this function, we'll use \textit{gitm} on the terminal. Now we add whatever commands we want between curly brackets. In this case we're only going to add one, which is the \verb+git commit -m "$1";+ bit. The only thing unique here is that we have a variable (\verb+$1+) which references our first and only argument, which is the commit message we are going to add. Once we have added all the files we need to our commit, we can then create the commit with something like this: \begin{Verbatim}[] gitm "Updated section on bash aliases" \end{Verbatim} which is a \textit{bit} shorter than typing \begin{Verbatim}[] git commit -m "Updated section on bash aliases" \end{Verbatim} Admittedly, this doesn't save us a ton of keystrokes every time we use it, but if we make git commits on a regular basis, over time, this will save us a number of keystrokes. \section{More about Bash commands} As it turns out, you can add more than a single command to a Bash function. For example, you can use this \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Bash function with multiple commands}] cdl() { cd "$1" && ls -ahl; } \end{Verbatim} % $ This will change to whichever directory we specify with the \verb+$1+ placeholder, and then present a directory listing which shows all files, with human-readable sizes, in a long format. That may not be highly useful, but it's enough to give you an idea of how powerful this using bash aliases and Bash functions can be. As an example, I like to write rough drafts in longhand, on notebook paper. I find that I am more creative that way. The problem is that I intensely dislike being surrounded by piles of paper. (ADHD means that if I can't see something, it no longer exists. So my brain will only really see whatever is on top of the pile.) So whenever I finish up a rough draft, I scan it to a ``Drafts'' folder, where it goes into a subfolder labeled for whatever projects it belongs to.\footnote{Yep, there is a subfolder labeled ``the codex'' with drafts for this zine.} So that I can see everything, I use the \texttt{tree} command to create a file which lists every single scan in that ``Drafts'' folder. So far, so good, but running the same \texttt{tree} command consistently is not something my brain is set up to do. So I added this function to my \texttt{.bashrc} file: \begin{Verbatim}[breaklines=true] drafts(){ tree $HOME/Drafts/ -R --prune > $HOME/Drafts/list.txt; } \end{Verbatim} What that command does is go to that ``Drafts'' folder, runs the \texttt{tree} command with the \texttt{-R} (recursive) and \texttt{--prune} (to ignore empty directories) options and then sends the standard output to a file called \texttt{list.txt}. I print out the \texttt{list.txt} file whenever I am searching for something to write up, and I can see in an instant what rough drafts I can work on. My ADHD brain is pretty happy with this arrangement, as nothing gets buried in a pile of files, and I don't have a ton of paper sitting around. For what it's worth, I also have a backup script (as I mentioned in issue \#2) just for this folder. And I added that command to the top of that backup script, so that before anything gets backed up to my cloud, that \texttt{list.txt} file gets updated and uploaded as well. \section{Reloading the \texttt{.bashrc} File} For any of these things to work, you need to reload your \texttt{.bashrc} file after you edit it. You can log out of your user profile and then log in again, or you can just go to the command line and type \begin{Verbatim}[] source ~/.bashrc \end{Verbatim} And of course, there is also a shorthand version: \begin{Verbatim}[] . ~/.bashrc \end{Verbatim} \chapter{The Right Ways vs The Wrong Ways} A lot of us grew up hearing that ``there's a right way to do things and a wrong way to do things.'' I don't disagree that there is always a \textit{wrong} way to do things, but like house maintenance, working on computers quickly teaches you that there are a \textit{lot} of wrong ways to do things. Experience has shown me that not all wrong ways are wrong in the same way or to the same degree, and that the same is true of right ways. There may be multiple right ways to get something done, but some require less work and some require more work. It is not just a black-and-white issue. In the past few years, I've started thinking of things less in terms of a particular ``right way'' opposed to a particular ``wrong way'', and started thinking in terms of a spectrum of choices, some of which are obviously wrong (but wrong to varying degrees) and some of which are right because they work, but you have to take different roads to get there. What I have tried to do here is to create a hierarchy of ``rightness'' and ``wrongness'' as a way to organize my thinking on this subject; I can then jump in and discuss why things fall the way they do. No doubt, other people might have more distinctions or fewer in their hierarchy, or might have things in a separate order, or might have different reasons. And, as we shall see, sometimes it's beneficial to do something the wrong way. \newpage % Move this list to a new page. \begin{itemize}[noitemsep] \item \textbf{Very Wrong} \begin{itemize}[noitemsep] \item It doesn't work and it breaks things in weird places. \item It doesn't work and it breaks almost everything. \item It doesn't work but it only breaks a few local things. \end{itemize} \item \textbf{Wrong} \begin{itemize}[noitemsep] \item It works, but it breaks things in weird places. \item It works, but it breaks almost everything else. \item It works, but it still manages to break a few local things. \end{itemize} \item \textbf{Wrong\textit{ish}} \begin{itemize}[noitemsep] \item It works in this specific instance, but not in all instances. \item It works, but it's far more work than it should be. \end{itemize} \item \textbf{Right\textit{ish}} \begin{itemize}[noitemsep] \item It works, but you have no idea why. \item It works, but it requires you to rework some other pieces. \item It works, but it's a bit of a kludge. \end{itemize} \item \textbf{Right} \begin{itemize}[noitemsep] \item It works, and is considered a best practice. \end{itemize} \item \textbf{Genius} \begin{itemize}[noitemsep] \item It's a true hack. \end{itemize} \end{itemize} \section{Very Wrong Ways} Very wrongs ways are very wrong because not only do they not work, they take other things down with them. \paragraph{It doesn't work and it breaks things in weird places.} You may wonder why this is worse than ``It doesn't work and it breaks almost everything else'' but for me the answer is simple: it can be terribly difficult to find those weird places. When I say ``weird'' I mean that they may be obscure places that nobody looks, they may be distant from the current situation and apparently unconnected,\footnote{But nothing is \textit{truly} disconnected from anything else.}, or they may be things that you don't have to rely on very often, so you may not discover that they are broken until days, weeks, or even months later. \paragraph{It doesn't work and it breaks almost everything else.} This is bad, but it is not bad as the previous example, because it has two advantages. First, because almost everything is breaking, those breaks are pretty obvious. Second, because almost everything is breaking, this provides you an opportunity to look at the overall structure of your project and examine how all the different parts are connected. There may be connections that you weren't aware of. You may realize that some things are connected that shouldn't be or that some things aren't connected that should be. Sometimes it takes a real disaster to point out the strengths and weaknesses of your system. \paragraph{It doesn't work and it still manages to break a few local things.} No complaints here. You have to undo what you did and maybe fix a few things, but you probably don't have a whole lot more to think about here. \section{Wrong Ways} Wrong ways may work, but they break other things along the way. As we shall see, this is not always a bad thing. \paragraph{It works, but it breaks things in weird places.} Again, the main issue here is that those weird places may not be obvious at first. You might use this technique, and it looks like it's working fine, but suddenly there is a person in Germany whose toilet no longer flushes properly. Or it works fine for you now, but in ten months \textit{your} toilet no longer flushes properly. And because these two things are so separated in place (in the former case) or time (in the latter case) it can be difficult to connect the two things, and we might end up spending a lot of time going down rabbit holes when the real solution is right in front of us the entire time. We waste time and effort. \paragraph{It works, but it breaks almost everything else.} This is almost exactly like ``It doesn't work and it breaks almost everything else'' except that your solution \textit{does} work. You just need to look at your overall system and figure out why everything else is going into meltdown mode. \paragraph{It works, but it still manages to break a few local things.} Even though this is listed as a wrong way---you are still breaking things, after all---this is not always a bad outcome to experience. It's possible that those few things that are breaking are breaking because they are weak. If you strengthen those items and then apply this technique, it turns out that this isn't actually wrong after all, it only seemed wrong at the time. In the end, you have a much better project that is much less fragile overall. \section{Wrong\textit{ish} Ways} \paragraph{It works in this specific instance, but not in all instances.} It works, so why is this way still wrong? Because it's not \textit{universal} for all similar situations. If it works in \textit{this one particular instance} but not similar instances, and you don't know why, then there is something about this particular instance that you are not aware of. This is not a bad thing if you're willing to chase down that unknown thing; it's potentially disastrous if you are not. \paragraph{It works, but it's far more work than it should be.} This is often a case of not having the right tools, or having the right tools but not knowing how to use them. If you need to dig a ditch, a shovel will work, but a backhoe works much better. All that time you spent working with a shovel is time you could have spent doing something else. \section{Right\textit{ish} Ways} \paragraph{It works, but you have no idea why.} I was very tempted to put this in the wrong\textit{ish} section, and in some cases it may certainly belong there. Quite frankly, you should know why a technique works. Not knowing why can be dangerous, because you assume too much about this particular technique. That may cause you to be a bit overconfident with it, and use it in a situation that doesn't really warrant its use. \paragraph{It works, but it requires you to rework some other parts of the project.} I admit, I was at a lost as to where to put this one. And I guess it depends if you are using a kludge or a best practice, so I'm going to assume you are using a best practice. In which case, this shows you places that you were possibly \textit{not} using something which is a best practice, and now you need to make those things better. \paragraph{It works, but it's a bit of a kludge.} A kludge is not always a bad thing (sometimes you have to work with what you have) but they are at best, inelegant, and at worst weighty and ugly. But they work for now, they don't break things, and they will last until you learn or can afford a better way. (I created a bit of a kludge when I couldn't figure out how to indent a bibliography entry.\footnote{You can see it in action in this commit for a different project: \kref{https://git.kjodle.net/kjodle/Notes-on-Python/commit/d4f93ec00f1e1078b1cfcb3aacd3481eb82bb0cd}{https://git.kjodle.net/kjodle/Notes-on-Python/commit/d4f93ec00f1e1078b1cfcb3a\\acd3481eb82bb0cd}.} Does it work? Yes. Am I happy with it? Not entirely. I'm 75\% sure there is a better way to do this, but I haven't found it yet. But it works for now, and I've marked it as a kludge, so I know this is something that I can come back to later. At least I made this less weighty and hid its heft and inelegance by turning it into a macro.) \section{Right Ways} \paragraph{It works, and is considered a best practice.} A best practice is one that has generally been accepted as the best way to do things not because it is perfect, but because it produces results that are better than the results achieved by other methods. This is a good thing. A best practice is a best practice because it's proven itself. It's not perfect (hence it's a ``best practice'' not a ``perfect practice''), but you can count on it to get the job done. And because it is a best practice, when things go pear-shaped, it's probably because of something you've done, but if it isn't, there will most likely be a lot of people who are \textit{very} interested in helping you. Unfortunately, sometimes a best practice is arrived at that for no other reason than ``that's how we've always done it and nothing has exploded yet.'' That's not great, but still, have a fire extinguisher handy. \section{Genius Ways} \paragraph{It's a true hack.} As I said way back in the first issue, I define a hack as ``an appropriate application of ingenuity''\footnote{See \kref{http://www.catb.org/~esr/jargon/html/meaning-of-hack.html}{http://www.catb.org/~esr/jargon/html/meaning-of-hack.html} for more information.}. These are rare, often false (it only resembles a hack; like the wizard in \textit{The Wizard of Oz}, it's based on smoke and mirrors), and even more often small.\footnote{You can usually identify a false hack by how large it is.} If you find one, enjoy it, preserve it, and help to disseminate it. \chapter{Not Another PDF Scanner} Way back in issue \#1 of this zine\footnote{Which is only three issues ago, but considering that I published it in 2021, it seems \textit{like} a long time ago. I really need to get my act together and get these out on a more regular basis.} I talked about a workflow for scanning documents because I am trying to be as digital as possible. In that article ``A Scanner Darkly, but with a workflow'' I mentioned that I used one piece of commercial software (VueScan) because it did what no FOSS\footnote{Free and Open Source} software could do: work with my printer and also sort pages effectively when my scanner's ADF\footnote{Automatic Document Feeder} does not duplex (i.e., it does not flip pages over to scan the other side). And while it is great software, and I did not mind paying the \$100 for a one-year subscription to it (the software company behind it is pretty much a father and son team), I didn't like being dependent on it. The reasoning is simple. If a company decides to stop producing a product, that's it; you're done. I used to have a great plugin on my WordPress sites that added social media sharing icons to each post. The company that made it got bought out by Oracle. You might think this is a great thing, because Oracle is a big huge company with a lot of resources. But often, when big huge companies buy small independent companies, they are only interested in one or two of their products, and let the rest go. And this is exactly what happened. Oracle suddenly decided they weren't going to support this plugin and it just stopped working. The company's webpage for the plugin redirected to an Oracle page that basically said ``fuck off'' and little more. No explanation, no recommendations of similar plugins, nothing. At least when FOSS software projects get abandoned or the original developers get better paying jobs delivering pizza, there is always the chance that someone else will take over the project. Better yet, you—yes, \textit{you}—can donate money to the project to help support it. I first found out about NAPS2\footnote{\kref{https://www.naps2.com/}{https://www.naps2.com/}} because I had downloaded a book from the Internet Archive\footnote{\textit{Inherit the Stars} by James P. Hogan, which you can read at \kref{https://archive.org/details/inheritstars00jame}{https://archive.org/deta\\ils/inheritstars00jame}} and the pages were very, very yellowed. (It had been scanned from a pulp paperback printed on cheap paper with a high acid content. How seldom we plan for the future!) I was looking for a way to lighten the background of the pages so that it would be easier to read. My usual solution for this would be to open the pdf in GIMP, opening each page as a separate layer. I could then figure out the settings for one page, convert that into a script (GIMP is scriptable!), apply that script to every single layer, and export the entire thing as a pdf, remembering to tick the box that says to export layers as pages, and also to do it in reverse order. That's not a huge amount of work, but still—it's work. Surely, there has to be a more automated way to do this, no? I searched and I searched, and I was rewarded for that search. Someone mentioned that a program called NAPS2 had this very feature. The name didn't hurt at all—at this point in my life, I am very much in favor of naps, unlike the five year old version of me. \section{Interleaving} Even better, NAPS2 had an ``interleave'' feature, which meant that I didn't need to use \texttt{pdftk} to do that.\footnote{To be fair, this is a feature which VueScan also eventually added at some point.} So scanning longer two-sided documents suddenly became a lot easier. The only problem was that NAPS2 offered \textit{four} versions of this command: interleave, deinterleave, alternate interleave, and alternate deinterleave. (These are very neatly contained under the ``Reorder'' icon in the main menu.) I knew one of those was what I needed; I just needed to figure out which. I'm a scientist, so I experimented. I took five sheets of paper, wrote the odd numbers 1-9 on the front side and the corresponding even numbers 2-10 on the back side. If you flipped through them, you would see something like what you see in figure \ref{naps2-orig} \begin{figure}[h] \caption{The document as originally drawn} \label{naps2-orig} \centering \kpage{1}\kpage{2}\kpage{3}\kpage{4}\kpage{5}\kpage{6}\kpage{7}\kpage{8}\kpage{9}\kpage{10} \end{figure} Because I wrote on both sides of each side of paper (in order to emulate a double-sided original), I scanned the pages, and then flipped them over and scanned the other sides. And because I am scanning these upside down, the even numbers end up in reverse order. So I ended up with a pdf that looked like figure \ref{naps2-scan}. \begin{figure}[h] \caption{The document as originally scanned} \label{naps2-scan} \centering \kpage{1}\kpage{3}\kpage{5}\kpage{7}\kpage{9}\kpage{10}\kpage{8}\kpage{6}\kpage{4}\kpage{2} \end{figure} That's progress, but it's not the progress I wanted to make. I tried all the different options available under the ``Reorder'' icon, and finally figured out that ``Alternate Interleave'' would produce the final pdf that I want, which you can see in figure \ref{naps2-final}. \begin{figure}[h] \caption{The document after applying ``Alternate Interleave''} \label{naps2-final} \centering \kpage{1}\kpage{2}\kpage{3}\kpage{4}\kpage{5}\kpage{6}\kpage{7}\kpage{8}\kpage{9}\kpage{10} \end{figure} If that looks like the original document, it is definitely not an accident; it is by design. Print that out and you get something close to the original.\footnote{I say ``close'' because a scan is never the equivalent of the original. It is a reflection, an imitation. But it is not the same. Every time we copy an analog object, we lose something. Replicative failure is a thing.} \section{Adjusting the Image Quality of a Scanned Book} I originally downloaded NAPS2 because I wanted to clean up a scanned book I had downloaded from the Internet Archive. It was an old pulp paperback, published in 1977 on cheap paper not much better than newsprint, and it was \textit{extremely} yellowed. The way I would normally handle this would be the GIMP method I described earlier. But that's a lot of work for a book I just want to read and be done with. (No archivist work for me here.) The workflow for this is fairly simple. First you import your pdf using the ``Import'' button. Then you select all the pages and click the ``Image'' button. The options are pretty limited: you can adjust the brightness and contrast, adjust the hue and saturation, or you can sharpen. It also has an image called ``Document Correction'' which is great if you are scanning in a lot of hand written notes and need to add a lot of contrast. (This doesn't work so greatly in the case of a badly yellowed book, unfortunately.) You're probably not going to get a perfect book back, because the options are pretty limited. The trade-off is that you pick your settings once, and then NAPS2 handles all the work while you go get yourself a cup of coffee—or take a nap. \section{Adjusting Images} Even though NAPS2 was designed to be a pdf scanner, it also has the ability to save individual scans as images. Even more importantly, because each scanned page is basically an image, you can also edit each page as an image by double clicking on it, where you get editing options like crop and rotate, in addition to the ones I mentioned earlier. This is pretty handy if you're scanning something like a manual that has different sized pages, or is printed on large sheets and folded into a box so that you have to scan it in sections,\footnote{Every piece of furniture I've ever assembled has instructions like this, but I've run into quite a few manuals that are miniature versions of this, like the earbuds I wear on my daily walk.} or a package that has care instructions. And if you're wondering why I keep banging on about manuals, it's because I do keep them. For years, I kept them all in a large three ring binder filled with page protectors that I could slip them into. It was big and awkward, and I didn't dare grab it the wrong way, or I'd have manuals all over the floor. At some point, I realized that most manuals are available in convenient pdf form from the manufacturer's website, so I started just downloading those, making sure the pdf was identical (or identical \textit{enough}) to the original, and then tossing the original in the recycling. But for those that aren't—yep, I scan them. \medskip \paragraph{Summary:} In short, NAPS2 is everything I need in a document scanner. It gives me some of the editing features of GIMP, has a simple interface to use (you can create different profile for each kind of scanning you do) and it just plain works. I recommend it. \chapter{Chemistry in \LaTeX{}} I used to be a science teacher, and back in the day, typesetting anything for chemistry was not all that easy. Well, it would have been if I had known anything at all about \LaTeX{}, but alas, I did not. I do now, though. As it turns out, people have written a number of different packages over the years to help with this. Let's take a look at three of them. \section{Package \texttt{mhchem}} The \texttt{mhchem} package is useful for typesetting chemical equations and reactions and has a fairly intuitive interface, making use of a \texttt{ce} environment. For example, to typeset this equation: \vspace{\baselineskip} \noindent{}\ce{CO2 + C -> 2 CO} \vspace{\baselineskip} we would simply use this markup: \begin{Verbatim}[] \ce{CO2 + C -> 2 CO} \end{Verbatim} As you can see, numbers placed after a letter are automatically formatted as a subscript. To format them as a superscript, we just use a caret (\texttt{\^}) before the number. For example, \verb|\ce{CrO4^2-}| produces \ce{CrO4^2-}. Pretty nifty, huh? Note that the superscripts and subscripts are not stacked; this is the preferred method according to the IUPAC\footnote{International Union of Pure and Applied Chemistry} Green Book. But if you want them to be stacked, \texttt{mhchem} has this option: \begin{Verbatim}[] \mhchemoptions{layout=stacked} \end{Verbatim} \mhchemoptions{layout=stacked} which will give us stacked superscripts: \vspace{\baselineskip} \noindent{}\ce{CrO4^2-} \vspace{\baselineskip} \mhchemoptions{layout=staggered-flat} It also does a pretty nice job of rendering fractions. \verb|\ce{1/2H2O}| gives us \ce{1/2H2O}. That's not the preferred way according to IUPAC, however. To accomplish that, you should use \verb|\ce{(1/2)H2O}| which gives us \ce{(1/2)H2O}. You can also do some fancier things. Here's another example from the manual: \begin{Verbatim}[] \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} \end{Verbatim} which will give us: \vspace{\baselineskip} \noindent{}\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} \vspace{\baselineskip} If you need something fairly straightforward, the \texttt{mhchem} package is for you. It has a simple, intuitive interface and it does a great job. \section{Package \texttt{chemformula}} The \texttt{chemformula} package is similar to \texttt{mhchem} in many respects, but is stricter about how certain items are input. In return, it has more options to customize the output. Again, it's pretty intuitive. To write the chemical formula for copper(II) sulfate pentahydrate, we would use code like this: \begin{Verbatim}[] \ch{CuSO4 * 5 H20} \end{Verbatim} which produces \vspace{\baselineskip} \noindent{}\ch{CuSO4 * 5 H2O} \vspace{\baselineskip} The most notable difference between \texttt{chemformula} and \texttt{mhchem} is that \texttt{chemformula} can distinguish between different types of input, which are separated by a space. That means that in our example above, there are four parts: the copper sulfate part, the asterisk part (which \texttt{chemformula} renders as a dot), the ``5'' part, and the H2O part. \texttt{chemformula} can then detect whether each input is a formula, a stoichiometric factor, an arrow, etc., and format them accordingly. You can also use math mode in \texttt{chemformula}. For example, this code: \begin{Verbatim}[] \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \end{Verbatim} will give us this reaction: \vspace{\baselineskip} \noindent{}\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \vspace{\baselineskip} We can also write the names of substances underneath them by using a ! and two pairs of parentheses. This code: \begin{Verbatim}[] \ch{!( sodium )( $2n$ Na ) + !( chlorine )( $n$ Cl2 ) -> !( s odium\ chloride )( $2n$ NaCl )} \end{Verbatim} gives us this example: \vspace{\baselineskip} \noindent{}\ch{!( sodium )( $2n$ Na ) + !( chlorine )( $n$ Cl2 ) -> !( sodium\ chloride )( $2n$ NaCl )} \vspace{\baselineskip} Notice that we had to use spaces inside the parentheses so that the package will know how to format these separate types of input. Also, because a space delineates different inputs, in order to get that space in ``sodium chloride'' we had to escape the space with a backward slash. Again, there are lots of options to customize the output. Here's one with fractions: \begin{Verbatim}[] \ch{3/2} (vertical fraction) \quad \ch[frac-style=xfrac]{3/2} (diagonal fraction) \end{Verbatim} which gives us: \vspace{\baselineskip} \noindent{}\ch{3/2} (vertical fraction) \quad \noindent{}\ch[frac-style=xfrac]{3/2} (diagonal fraction) \vspace{\baselineskip} Like I said, this one operates a lot like \texttt{mhchem}. If \texttt{mhchem} works for you, there's no need to look further. But if you need more control over the appearance of your formulas and equations, \texttt{chemformula} will give you a lot of that control. Like I said earlier, if your needs are simple, \texttt{mhchem} is a good choice. But if you need more control over your output, then \texttt{chemformula} will do a great job for you. It's slightly less intuitive, but it is well-documented, and the trade-off is a much higher degree of control. \section{Package \texttt{chemfig}} If you need to draw chemical structures, then \texttt{chemfig} is the package for you. It uses a \texttt{chemfig} environment, and loads \texttt{tikz} if it hasn't already been loaded.\footnote{See issue \#2, \S{} 7.2 for some basics about drawing with \texttt{tikz}.} You can pass a set of parameters to that environment to change the appearance of individual molecules. \subsection{Basic Syntax} The syntax is remarkably simple. You start with the first atom in a molecule and work outwards from there. For example, take a look at this at this drawing of acetic acid: \vspace{\baselineskip} \noindent{}\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)} \vspace{\baselineskip} which is created using this code: \begin{Verbatim}[] \chemfig{H_3C-C(=[:30]O)(-[:-30]OH)} \end{Verbatim} It's pretty easy to see what's happening inside the \texttt{chemfig} enivronment. \begin{enumerate}[left=0pt, noitemsep] \item First we create the \chemfig{H_3C-} using \verb|H_3C-|. \item We then add the second carbon atom \texttt{C}. \item From this atom, we branch by placing each branch inside parentheses. \item We then angle those branches relative to the \textit{x}-axis by placing the angle inside square brackets after a colon. In this case, we are specifying 30\textdegree{} angles. \end{enumerate} We can also predefined angles of angles of 45\textdegree{} by omitting the colon, so that this code: \begin{Verbatim}[] \chemfig{H_3C-C(=[1]O)(-[7]OH)} \end{Verbatim} produces this figure: \vspace{\baselineskip} \noindent{}\chemfig{H_3C-C(=[1]O)(-[7]OH)} \vspace{\baselineskip} Notice that angles are always specified with regard to the horizontal, regardless of where they start. In other words, [1] = $1 * 45\degree = 45\degree$ and [7] = $7 * 45\degree = 315\degree$. \subsection{Ring Structures } We can also create ring structures pretty easily by using an asterisk at the beginning of our definition. I've created some examples below, where the syntax should be fairly easy to understand. (And notice the use of \texttt{[,0.75]} to change the length of the line of the bond to the functional groups.) Note that rings always begin with the atom in the southwest corner, which I've labeled here: \vspace{\baselineskip} \chemfig{SW*6(-=-=-=)} \paragraph{Benzene with double and single bonds:} \begin{Verbatim}[] \chemfig{*6(-=-=-=)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{*6(-=-=-=)} \vspace{\baselineskip} \paragraph{Benzene with a ring inside:} \begin{Verbatim}[] \chemfig{**6(------)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{**6(------)} \vspace{\baselineskip} \paragraph{Phenol with double and single bonds:} \begin{Verbatim}[] \chemfig{*6(-=-=(-[,0.75]OH)-=)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{*6(-=-=(-[,0.75]OH)-=)} \vspace{\baselineskip} \paragraph{Phenol with a ring inside:} \begin{Verbatim}[] \chemfig{**6(----(-[,0.75]OH)--)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{**6(----(-[,0.75]OH)--)} \vspace{\baselineskip} \paragraph{Cumene with a ring inside:} \begin{Verbatim}[] \chemfig{**6(----(-[:150,0.75]H_3C)(-[:30,0.75]CH3)--)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{**6(----(-[:150,0.75]H_3C)(-[:30,0.75]CH3)--)} \vspace{\baselineskip} \subsection{More complicated structures} Once you understand the basics, it's fairly straightforward to construct even more complicated structures. Here are some examples. \paragraph{Glucose:} \begin{Verbatim}[] \chemfig{?(-[:190]OH)-[:-50](-[:170]OH)-[:10](-[:-55,0.7]OH) -[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{?(-[:190]OH)-[:-50](-[:170]OH)-[:10](-[:-55,0.7]OH) -[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)} \vspace{\baselineskip} \paragraph{Xylene:} (Or as IUPAC would say: 1,3-dimethylbenzene.) \begin{Verbatim}[] \chemfig{*6(-=(-OH)-=(-OH)-=)} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{*6(-=(-OH)-=(-OH)-=)} \vspace{\baselineskip} \paragraph{Guanine:} \begin{Verbatim}[] \chemfig{*6((-H_2N)=N-*5(-\chembelow{N}{H}-=N-)=-(=O)-HN-[,,2])} \end{Verbatim} \vspace{\baselineskip} \noindent{}\chemfig{*6((-H_2N)=N-*5(-\chembelow{N}{H}-=N-)=-(=O)-HN-[,,2])} \vspace{\baselineskip} Note the use of \texttt{chembelow} to place the third hydrogen atom directly below the nitrogen atom, as we typically don't show the single bonds to hydrogen atoms in cases like this. You can even use \texttt{chemfigure} to show reactions, using a \texttt{scheme}. Here's the Fischer indole synthesis that I took right from the gallery in the manual: \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Fischer indole synthesis:}] \setchemfig{atom style={scale=0.75}} \schemestart \chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)} \+ \chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1} \arrow(.mid east--.mid west){->[\chemfig{H^+}]} \chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)} \schemestop \setchemfig{atom style={scale=1}} \end{Verbatim} \vspace{\baselineskip} \noindent{}\setchemfig{atom style={scale=0.75}} \schemestart \chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)} \+ \chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1} \arrow(.mid east--.mid west){->[\chemfig{H^+}]} \chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)} \schemestop \setchemfig{atom style={scale=1}} \vspace{\baselineskip} \vspace{\baselineskip} Notice the use of \texttt{setchemfig} to scale the reaction to 75\% so it would fit on the page, and then its use again to reset the scale back to 100\%. (Although the latter is a moot point, as we are done now.) \chapter{Coda} \section{What I Learned About \LaTeX{} While Creating This Issue} \subsection{Page Count using \texttt{detex}} \subsection{How to Create Macros} \subsection{How to Get More Font Sizes} One of the things that has bugged me for some time about this zine is that I was not creating the cover in \LaTeX{}. The reason for that was simple: I didn't know how. But we're now at the fourth issue, and so it was time to finally figure it out.\footnote{So if this cover looks a little different than previous covers, this is the reason why. But they will look like this going forward.} One of the issues that I encountered is that your standard document classes give you a limited number of font sizes, and I needed the title to be fairly large. Larger than I could get with the \verb|\begin{Huge}•\end{Huge}| command, anyway. As it turns out, if you are using Type 1 fonts, you can just use the \texttt{fontsize} command to make this work. This is what I used for the front cover: \begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{fontsize example}] {\fontsize{50}{60}\selectfont \textbf{the codex}} \end{Verbatim} The first number (50) represents the font size, while the second one (60) specifies the line spacing, which is generally irrelevant if you are only using this on a single line of text.\footnote{I found this at \kref{https://tex.stackexchange.com/a/716/245702}{https://tex.stackexchange.com/a/716/245702}.} \subsection{Adding Space at the Top of a Page} Another issue that I ran into when creating the cover in \LaTeX{} is that I needed space at the top of the page, before the text. Normally, I use something like \verb|\vspace{50mm}| for something like that, but any \verb|\vspace| is automatically deleted at the top of a page. The solution is to use it with an asterisk, like this: \verb|\vspace*{50mm}|. \section{What I learned About \LaTeX{} While Creating Something Else} \end{document}