Schlagwort-Archiv: LaTeX

LaTeX Tips and Tricks for Particle Physicists

During the course of writing my thesis I spent quite some time into getting the \(\LaTeX\) stuff right. LaTeX is such a great language1, generating amazing output, and enabling so many cool typesetting possibilities. How could one not!?
I thought it would be nice sharing my meta-research with others. So I held a talk at my institute to show the most important packages and concepts, I drew on while writing my document.

It tackles writing units in LaTeX and writing particle names. It highlights a few other, smaller packages, but also introduces BibLaTeX and glossaries in more detail. The great engine that is latexmk is introduced as well. It is also the first presentation I did in LaTeX Beamer!

You probably want to use the PDF linked after the embed since you can click all the links easily there.

Local PDF

  1. Markup language. Programming language. Whatever. 

LaTeX Package for a Nice PANDA with Bar on P

In my \(\LaTeX\) documents, I wanted to have nicely set PANDA names with the bar on top of the P.

Not so simple, though. I found the \overline to be too large, but the \bar to be too short. So I took to the great community that is StackExchange to find a solution. And, sure enough, someone was able to help me.
Based on egreg’s code, I assembled a proper LaTeX package1, making it more convenient for others to use as well.

Today, I gave the package a small Github repository.

  1. With options and stuff! 

LaTeX Package for Creating a List of Certain Figures

For an internal PANDA note, I need to tag certain figures to be worthy and available for a public release. Since I’m at it, I’d like to collect all of those figures into an according list. Automatically.

I came up with a \(\LaTeX\) package which provides the tagging mechanism and uses this for generating the list of plots for release by \listoffigures.

I put the package up to Github. Take a look over there for all the details:

A nicer LaTeX vector without esvect (with TikZ)

I was using esvect to draw nicer vector arrows over characters and whole words. Unfortunately, it uses a whole math alphabet to provide the arrows. What a waste of that precious resource (there are only 16 math alphabet slots available).

So, here’s a TikZ command giving pretty much the same result.
The 0.45 is probably a bit too thick. But it’s alright for me.

esvect - TikZ comparison
Left: esvect. Right: TikZ.

Greatly inspired by this TeX.SE answer by Gonzalo Medina.

Writing Quantities and Variables the Correct Way

I researched on how to write units, constants and quantities, and variables the proper way. There’s a lot of information out in the interwebs. And, of course, not everything is correct.

In 2010, a new ISO standard was published, the ISO 80000-2, describing mathematical signs and symbols. You can buy it here (buying a ISO paper, it’s strange, right?).
There’s a LaTeX package called isomath implementing this standard for your favorite typesetting tool.

Following some notes from it on upright-edness and italic-ity.

  • Units are to be written upright (roman). Capital, when they are based on names (K for Kelvin), small when not (m for meter). See more on that at Andrés blog.
  • Variables are to be written in italics (slanted), independently if the character is latin or greek. x = 12, α = 1.
  • Mathematical constants are to be written upright. Physical ›constants‹ in italics.
    π is upright, so is i as in i2 = -1.
    In italics is the speed of light, c, the Avogadro constant, NA.
  • Well-known functions are upright, like sin x or exp x.
    And this means, yes, also the the e in e2x is upright, as it’s both a function and a mathematical constant.
  • Indices of variables are upright when they are descriptive. See the Avogadro constant above.
  • Differential operators are upright, but not the variables/quantities they differentiate (for). dx/dt.
  • Particle name abbreviations are upright. Independently if it’s a latin letter (the electron’s e) or a greek one (the pion’s π).

While we are at it: The correct way to describe axes in plots is to state the measured variable (e.g. ρ), state a slash as a division sign (/) and then the unit of the variable (e.g. MPa) – ρ/MPa1. The order of variable and unit can be interchanged if the value given is reciprocal, e.g. 1/ρ would lead to a description of MPa/ρ. Writing square brackets for the unit is not correct (as in [MPa]).

Ressources I used to compile this list, sorted by importance:

  1. Think about it: Every quantity ρ on the axis is divided by the unit, hence the number essentially loses its dimension, as shown on the axis.