7

My friend is a grad student in mathematics and describes himself as being "computer-illiterate." He uses LaTeX to write papers but he writes (for example) a set is called $\mathit{regular}$ if [...] where an orthodox LaTeX user would write a set is called \emph{regular} if [...]. I told him to adopt the latter practice and tried to explained the concept of so-called "separation of contents and presentation", by saying things like "this is a widely accepted engineering practice" and "you might as well use plain TeX if you do this", but my explanation was ineffective, but he replied to me that all he cared was the output.

How should I have explained the concept to him? A problem is that he doesn't know software engineering or Web design, from which I could have drawn analogies from. Another problem, I suppose, is that the concept is not as widely practiced in the LaTeX community as in, e.g., Web.

  • 2
    If he cares only about output you should show him \section{A \emph{regular} $\mathit{regular}$ set} or \textsf{\emph{regular} $\mathit{regular}$ set}. Beside this I find the reasoning for a math student quite odd. It is like saying I don't care about mathematical correct calculations as long as I get the right result. – Ulrike Fischer Jan 29 '16 at 22:35
  • 2
    To be honest, I think the best answer to this is: you shouldn't. If your friend doesn't experience any difficulty getting the desired output and has no independent motivation (such as enlightened self-interest) to follow correct practice, nothing you say will make a difference. You tried. Your friend isn't interested. At some point, this will come back to bite because the results will not be what's wanted or the journal will refuse to accept the paper as coded or whatever. Then your explanation will be heard. Until then, its a lost cause. (And the sky will not fall on our heads as a result.) – cfr Jan 29 '16 at 23:57
  • @cfr A (very minor) problem is that now the friend thinks I'm a zealot advocating a nonsensical practice. – Pteromys Jan 30 '16 at 6:27
  • Take his TeX away and force him to use markdown or wikimarkup. – errekak Jan 30 '16 at 7:25
  • 1
    this has got nothing to do with computer literacy. it can be explained in terms of a typewriter: this is really just text, and with a typewriter, you'd use an underline for emphasis. – barbara beeton Jan 30 '16 at 17:54
8

So there's this idea of logical structure, so you set up structures like: a quote, a section head, something emphasised, the title of a work, and so on and so forth. And then, rather than decorating your text as you go, with italicisation, emboldening, enlarging, centering, and so on and so forth, you say: this is a quote, this is a section head, etc. etc.

And then, if you want to change the way quotes look globally, you can do it by editing the definition of the structure (nice and easy) and you can guarantee that all of your quotes will look the same, all of your section heads will look the same, and so on and so forth.

So you learn to plan out your document as a series of logical units and then let the machine deal with the legwork of applying the formatting each and every time. This is good for consistency, it saves you a job, but it also helps you think about the role of what you're writing in your document. I think that should resonate quite well with a mathematician.

Now another benefit of this is not necessarily obvious from simple structures, which might require just an italicisation. Is typing \textit{Harry Potter and the Philosopher's Stone} really any harder or more cumbersome than defining a command for book titles such as:

\newcommand{\work}[1]{\textit{#1}}

And then typing \work{Harry Potter and the Philosopher's Stone}?

Probably not. But if you have a complex structure, such as a section head, you can subsume a whole load of formatting into a single definition, which, ideally, will have a name that means something. So, say I'm writing a speech and I want to typeset optional material in italics and in a smaller font, and with indentation on both sides. I can have

\newenvironment{optional}{\begin{quote}\small\em}{\end{quote}}

And then I can use

\begin{optional}
  Which leads me on nicely ...
\end{optional}

And if I have ten of these, not only is the source code nice and clear (I have called the environment optional, so I know what it does), I've also saved myself tapping out:

\begin{quote}\small\em
\end{quote}

Every time, there's no danger of me forgetting to make it small, and if I suddenly decide I want my optional stuff set in sans-serif, rather than italics, I make one change and it applies globally.

A lot of people don't realise that long, cumbersome commands like \textit{} \textsuperscript{} are not necessarily meant to be used long-form every time, but are the building blocks out of which you construct commands that do exactly what you want for the various structures in your document, which may or may not be slightly quicker to type. The commands are given names which make them easy to remember and make it obvious what they do. This is helpful in constructing commands for yourself, but (even with the best of editors) can be a bit of a pain in multiple body parts if you're typing them out every time you want to do a little formatting.


I'm not much of a mathematician, and I feel like this is a fairly tenuous analogy, but I feel it's not so different to a mathematician defining a notation or assigning something a variable.

So, for example, I might say: Let the line from (2, 3) to (3, 6) be denoted l.

And then I can say, let the gradient of l be denoted m.

So I've defined this object l, and then I go on to use l everywhere in my argument, rather than writing out "the line from (2, 3) to (3, 6)" each time.

So I think this is a bit like me defining a command

\newcommand{\nb}[1]{{\Large \textbf{#1}}} %Command not recommended due to ugliness

And then using \nb{...} throughout my document.

How so? Well, I think of it as like giving LaTeX a definition at the start, and then every time it sees \nb{...} it knows that I mean "large and bold". But I just have to use the shorthand \nb{...}, instead of typing out the full definition each time. So instead of typing out {\Large \textbf{}} each time, I just use \nb{...} which I defined at the beginning.

A bit like, instead of writing out "the line from (2, 3) to (3, 6)" every time, I just use l, which I defined a the beginning. And the reader, like LaTeX, knows to substitute the definition I gave, but I save on the amount of typing/writing I have to do.

|improve this answer|||||
7

The title of the question is wrong if one look at the example given in the question. On could discuss semantical markup by comparing \emph with \textit, but not for \emph versus \mathit. This is misusing mathmode to output something that should be written in textmode and will give a wrong output in quite a number of cases. It is like writing l when one want a 1, or O instead of 0.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\begin{description}
\item[Accents] $\mathit{Poincaré}$ vs. \emph{Poincaré}
\item[Punctuation] $\mathit{Noether's}$ vs. \emph{Noether's}
\item[More punctuation] $\mathit{:?!,}$ vs. \emph{:?!,}
\item[Quotes] $\mathit{``Gauss''}$ vs. \emph{``Gauss''}
\item[other text fonts] {\sffamily $\mathit{regular}$ vs. \emph{regular}},
{\bfseries $\mathit{regular}$ vs. \emph{regular}}
\end{description}

\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.