# Format Name of Video codecs

I'm currently writing my Masterthesis for a german University. I used a few different codecs in my work (like H.264). What is the correct/sensible way to write them in my Latex Document? Examples of my Problems follow:

• Does Latex know the correct ending of the sentence? (dot in H.264 might be treated like ending)

I also used H.264 and H.265. I also ...

• Should i use ~ to stick two words together?

I also used DivX~Mpeg-4. I also ...

• Are Codec Names special? Should they be treated differently from normal words?

I also used \texttt{H.264}.


I realize that my Question is a bit broad. Hopefully there are definite answers at least to Point 1 and 2. I hope there is "normal" way for Question 3 (i have no guidelines)

• If someone knows better tags, please edit. I couldn't come up with better ones. proper-name/proper-noun might be good but unfortunately doesn't exist yet. – Sebastian Schmitz May 14 '14 at 14:06
• The special ending (I don;t even think the english is using this anymore) is AFAIK only <lowercase letter> plus space. So no worries there. For DivX Mpeg 4 I'd use ~. – daleif May 14 '14 at 14:14
• @SebastianSchmitz: You should define a command to contain whatever you choose (say \newcommand{\Htwosizefour}{\texttt{H.264}}) and use that in your document: I also used \Htwosixfour{} and \Htwosixfive. I also ... That way, if you change your mind later, you only have to change a single macro. See Consistent typography. – Werner May 14 '14 at 14:19
• In addition to what Werner said, I default to Wikipedia for notation of acronyms: H.264/MPEG-4 AVC. But in the interest of simplicity, I'd have the first usage be something like "I also used H.264/MPEG-4~AVC, which will be abbreviated as H.264 for the rest of the paper, ..." – Mike Renfro May 14 '14 at 14:20
• The dot (.) has special handling only when it is preceded by a capital letter and followed by space. And even then it has no special handling if \frenchspacing is in use. – morbusg May 14 '14 at 14:54

• Yes!: a dot in beetween no spaces does not mark a new sentence,
• No!: "DivX Mpeg-4" forms a closed unit and should not be separated but there is a better way - using \mbox - shown in the example, and
• Yes!: mark-up is an important typographical feature.

In addition to the third point you have to remember that LaTeX is meant to use logical mark-up. So, as the comments say you should define something like \newcommand{\Htwosixfour}{\texttt{H.264}}. Or even better:

\newcommand{\markcodec}{\texttt}
\newcommand{\Htwosixfour}{\markcodec{H.264}}


This gives you the possibility to change the mark-up for all codec macros by redefining only one macro, which can be crucial if you are dealing with many codecs. For instance, if for some reasons you want to have no mark-up at all in the end you would say

\newcommand{\markcodec}{\relax}


You should also make use of the xspace package which is specially designed for those kinds of macros: \newcommand{\Htwosixfour}{\markcodec{H.264}\xspace}.

In the complete example additionally I defined a wrapper for this whole process in order to not be repetative while defining the control words for your codecs.

\documentclass{article}
\usepackage{xspace}

\newcommand{\markcodec}{\texttt}
\newcommand{\NewCodecMarkup}[2]{%
\providecommand#1{}
\def#1{\mbox{\markcodec{#2}}\xspace}
}

\NewCodecMarkup{\Htwosixfour}{H.264}
\NewCodecMarkup{\DivXmpegfour}{DivX\,Mpeg-4}
%\newcommand\Htwosixfour{\markcodec{H.264}\xspace}
%\newcommand\DivXmpegfour{\markcodec{DivX\nobreakspace Mpeg-4}\xspace}

\begin{document}
I used \Htwosixfour and \DivXmpegfour.
\end{document}


## Update

You could also use this light-weight method (thank you egreg!):

\documentclass{article}

\newcommand{\codec}[1]{\mbox{\ttfamily #1}}

\begin{document}
I used \codec{H.264} and \codec{DivX\,Mpeg-4}.
\end{document}


Now, it is a matter of taste if you want write \Htwosixfour or \codec{H.264}. It's up to you to decide. If you are an indecisive person (:-)) and want to use both methods at the same time you could declare

\newcommand{\codec}[1]{\mbox{\ttfamily #1}}
\newcommand{\NewCodecMarkup}[2]{%
\providecommand#1{}
\def#1{\codec{#2}\xspace}
}

• I'd prefer a \codec macro: \newcommand{\codec}[1]{\mbox{\ttfamily #1}} that also solves the problems with spaces and hyphens. Spaces won't participate to stretching or shrinking on the line, but perhaps “DivX Mpeg-4” might be input as \codec{DivX\,Mpeg-4} with just a thin space. – egreg Dec 3 '14 at 22:35
• Good! I like especially the idea of boxing the codec name. And I'll add a note on the \codec{...} approach. – Ruben Dec 4 '14 at 17:48