{"id":6101,"date":"2012-03-12T06:00:39","date_gmt":"2012-03-12T13:00:39","guid":{"rendered":"http:\/\/dabacon.org\/pontiff\/?p=6101"},"modified":"2012-03-12T06:00:39","modified_gmt":"2012-03-12T13:00:39","slug":"the-nine-circles-of-latex-hell","status":"publish","type":"post","link":"https:\/\/dabacon.org\/pontiff\/2012\/03\/12\/the-nine-circles-of-latex-hell\/","title":{"rendered":"The Nine Circles of LaTeX Hell"},"content":{"rendered":"<figure id=\"attachment_6165\" aria-describedby=\"caption-attachment-6165\" style=\"width: 300px\" class=\"wp-caption alignright\"><a href=\"https:\/\/i0.wp.com\/dabacon.org\/pontiff\/wp-content\/uploads\/2012\/03\/gustave_dore_dante_burning_graves.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6165\" title=\"gustave_dore_dante_burning_graves\" src=\"https:\/\/i0.wp.com\/dabacon.org\/pontiff\/wp-content\/uploads\/2012\/03\/gustave_dore_dante_burning_graves-300x209.jpg?resize=300%2C209&#038;ssl=1\" alt=\"This guy had an overfull hbox\" width=\"300\" height=\"209\" \/><\/a><figcaption id=\"caption-attachment-6165\" class=\"wp-caption-text\">This guy had an overfull hbox<\/figcaption><\/figure>\n<div align=\"justify\">\nPoorly written LaTeX is like a rash. No, you won&#8217;t die from it, but it needlessly complicates your life and makes it difficult to focus on pertinent matters. The victims of this unfortunate blight can be both the readers, as in the case of bad typography, or yourself and your coauthors, as in the case of bad coding practice.<br \/>\nToday, in an effort to combat this particular scourge (and in keeping with the theme of this blog&#8217;s title), I will be your Virgil on a tour through the nine circles of LaTeX hell. My intention is not to shock or frighten you, dear Reader. I hope, like Dante before me, to promote a more virtuous lifestyle by displaying the wages of sin. However, unlike Dante I will refrain from pointing out all the famous people that reside in these various levels of hell. (I&#8217;m guessing Dante already had tenure when he wrote <em>The Inferno.<\/em>)<br \/>\nThe infractions will be minor at first, becoming progressively more heinous, until we reach utter depravity at the ninth level.\u00a0Let us now\u00a0descend\u00a0the steep and savage path.<\/p>\n<h3 style=\"padding-left: 30px\">1) Using <code>{\\it ...}<\/code> and <code>{\\bf ...}<\/code>, etc.<\/h3>\n<p>Admittedly, this point is a quibble at best, but let me tell you why to use\u00a0<code>\\textit{...}<\/code> and <code>\\textbf{...}<\/code> instead.\u00a0First, <code>\\it<\/code> and <code>\\bf<\/code> don&#8217;t perform correctly under composition (in fact, they reset all font attributes), so <code>{\\it {\\bf ...}}<\/code> does not produce bold italics as you might expect. Second, it fails to correct the spacing for italicized letters. Compare $latex \\text{{\\it test}text}$ to $latex \\text{\\textit{test}text}$ and notice how crowded the former is.<\/p>\n<h3 style=\"padding-left: 30px\">2) Using <code>\\def<\/code><\/h3>\n<p><code>\\def<\/code> is a plain TeX command that writes macros without first checking if there was a preexisting macro. Hence it will overwrite something without producing an error message. This one can be dangerous if you have coauthors: maybe you use <code>\\E<\/code> to mean $latex \\mathbb{E}$, while your coauthor uses it to mean $latex \\mathcal{E}$. If you are writing different sections of the paper, then you might introduce some very confusing typos. Use <code>\\newcommand<\/code> or <code>\\renewcommand<\/code> instead.<\/p>\n<h3 style=\"padding-left: 30px\">3) Using <code>$$...$$<\/code><\/h3>\n<div>\nThis one is another plain TeX command. It messes up vertical spacing within formulas, making them inconsistent, and it causes <code>fleqn<\/code> to stop working. Moreover, it is syntactically harder to parse since you can&#8217;t detect an unmatched pair as easily. Using\u00a0<code>[...]<\/code> avoids these issues.\n<\/div>\n<h3 style=\"padding-left: 30px\">4) Using the <code>eqnarray<\/code> environment<\/h3>\n<p>If you don&#8217;t believe me that <code>eqnarray<\/code> is bad news, then ask Lars Madson, the author of &#8220;Avoid <code>eqnarray<\/code>!&#8221;,\u00a0a\u00a0<a href=\"http:\/\/tug.org\/pracjourn\/2006-4\/madsen\/madsen.pdf\">10 page treatise<\/a>\u00a0on the subject. It handles spacing in an inconsistent manner and will overwrite the equation numbers for long equations.\u00a0You should use the amsmath package with the <code>align<\/code> environment instead.<br \/>\n<em>Now we begin reaching the inner circles of LaTeX hell, where the crimes become noticeably more sinister.<\/em><\/p>\n<h3 style=\"padding-left: 30px\">5) Using standard size parentheses around display size fractions<\/h3>\n<p>Consider the following abomination:\u00a0$latex (\\displaystyle \\frac{1+x}{2})^n (\\frac{x^k}{1+x^2})^m = (\\int_{-\\infty}^{\\infty} \\mathrm{e}^{-u^2}\\mathrm{d}u )^2.$<br \/>\nGo on, stare at this for one minute and see if you don&#8217;t want to tear your eyes out. Now you know how your reader feels when you are too lazy to use <code>\\left<\/code> and <code>\\right<\/code>.<\/p>\n<h3 style=\"padding-left: 30px\">6) Not using bibtex<\/h3>\n<p>Manually\u00a0writing your bibliography makes it more likely that you will make a mistake and adds a huge\u00a0unnecessary\u00a0workload to yourself and your coauthors. If you don&#8217;t already use bibtex, then make the switch today.<\/p>\n<h3 style=\"padding-left: 30px\">7) Using text in math mode<\/h3>\n<p>Writing $latex H_{effective}$ is horrendous, but even\u00a0$latex H_{eff}$ is an affront.\u00a0The broken ligature makes these examples particularly bad. There are lots of ways to avoid this, like using <code>\\text<\/code> or <code>\\mathrm<\/code>, which lead to the much more elegant and legible\u00a0$latex H_{\\text{eff}}$. Don&#8217;t use <code>\\mbox<\/code>, though, because it doesn&#8217;t get the font size right:\u00a0$latex H_{\\mbox{eff}}$.<\/p>\n<h3 style=\"padding-left: 30px\">8 ) Using a greater-than sign for a ket<\/h3>\n<p>At this level of hell in Dante&#8217;s <em>Inferno<\/em>, some of the accursed are being whipped by demons for all eternity. This seems to be about the right level of punishment for people who use the obscenity $latex |\\psi&gt;$.<\/p>\n<h3 style=\"padding-left: 30px\">9) Not using TeX or LaTeX<\/h3>\n<p>This one is so bad, it tops Scott&#8217;s <a href=\"http:\/\/www.scottaaronson.com\/blog\/?p=304\">list<\/a> of signs\u00a0that a claimed mathematical breakthrough is wrong.\u00a0If you are typing up your results in Microsoft Word using Comic Sans font, then perhaps you should be <a href=\"https:\/\/www.youtube.com\/watch?v=Fy3rjQGc6lA\">filling out TPS reports<\/a>\u00a0instead of writing scientific papers.\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Poorly written LaTeX is like a rash. No, you won&#8217;t die from it, but it needlessly complicates your life and makes it difficult to focus on pertinent matters. The victims of this unfortunate blight can be both the readers, as in the case of bad typography, or yourself and your coauthors, as in the case &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/dabacon.org\/pontiff\/2012\/03\/12\/the-nine-circles-of-latex-hell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Nine Circles of LaTeX Hell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[50,73],"tags":[],"class_list":["post-6101","post","type-post","status-publish","format-standard","hentry","category-off-the-deep-end","category-scientific-publishing"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/posts\/6101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/comments?post=6101"}],"version-history":[{"count":1,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/posts\/6101\/revisions"}],"predecessor-version":[{"id":11960,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/posts\/6101\/revisions\/11960"}],"wp:attachment":[{"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/media?parent=6101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/categories?post=6101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dabacon.org\/pontiff\/wp-json\/wp\/v2\/tags?post=6101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}