{"id":105,"date":"2005-10-15T11:52:58","date_gmt":"2005-10-15T01:52:58","guid":{"rendered":"http:\/\/www.somethinkodd.com\/oddthinking\/?p=105"},"modified":"2005-10-17T22:55:03","modified_gmt":"2005-10-17T12:55:03","slug":"marking-up-sections-and-headings","status":"publish","type":"post","link":"https:\/\/www.somethinkodd.com\/oddthinking\/2005\/10\/15\/marking-up-sections-and-headings\/","title":{"rendered":"Marking Up Sections and Headings"},"content":{"rendered":"<p><!-- UnMarkedDown_2_01132526440--><\/p>\n<p>In a typical document, there is a hierarchy of sections. Each section contains a heading, which is displayed more prominently than the section text. <\/p>\n<p>In this article, I describe three separate issues with the handling of sections and headings in modern typesetting tools. I propose a dull but important change to markup languages to deal with these issues. This proposal is not particularly innovative, but just better engineered.<\/p>\n<p>Then I mention a new problem that I only just noticed, and propose an innovative new feature that would be way cool.<\/p>\n<h3>Issue 1: Section Motility<\/h3>\n<p>During the editing of a document, the section hierarchy can be quite fluid. Sections can be moved around the document, or promoted or demoted in place.<\/p>\n<p>Microsoft Word makes moving these sections relatively easy (especially if you configure a custom toolbar to always display the \u00e2\u20ac\u0153Promote\u00e2\u20ac\u009d, \u00e2\u20ac\u0153Demote\u00e2\u20ac\u009d and \u00e2\u20ac\u0153Demote To Body Text\u00e2\u20ac\u009d icons \u00e2\u20ac\u201c they normally only appear in Outline mode, but are universally useful.)<\/p>\n<p>However, the common markup languages do not make this easy at all: HTML, LaTeX and MarkDown all require you to visit every heading in the text being moved, and correct the heading level. <\/p>\n<p>For example, if I decide to demote a large section of text in HTML, I would need to change all the &lt;H1&gt; tags to &lt;H2&gt;, but first change all the &lt;H2&gt; tags to &lt;H3&gt; etc. In LaTeX, I would need to change all the \\section{} tags to \\subsection{}, etc.<\/p>\n<p>Compare that to bulleted lists, where it is possible to move list items around without renumbering everything. The browser can work out the appropriate bullet level from context.<\/p>\n<h3>Issue 2: Arbitrary Limits<\/h3>\n<p>I once wasted several days\u00e2\u20ac\u2122 development time in producing code that marked up a stack-dump in LaTeX tables. It worked fine in the unit tests, but the first time that I tried a \u00e2\u20ac\u0153substantial\u00e2\u20ac\u009d program (for small values of substantial: it calculated the <a href=\"http:\/\/www.somethinkodd.com\/oddthinking\/2005\/06\/28\/disgusting-code\/\">oddness of 2<\/a>), LaTeX complained that I had blown its limit of sub-sub-sub-tables, and suggested that I modify its source code to increase the arbitrary limit and recompile it.  I declined, and re-wrote the stack dump into raw PostScript. Having arbitrary limits in your software should be avoided; it just means you annoy people at arbitrary times. <\/p>\n<p>I had a problem with tables, but the same applies to sections too: In HTML and LaTeX, there are arbitrary limits to the depth of the section hierarchy.  HTML has &lt;H1&gt; to &lt;H6&gt;. LaTeX runs out of puff after <a href=\"http:\/\/www.tex.ac.uk\/cgi-bin\/texfaq2html?label=subsubsub\">subsubsections<\/a>.  Both of these are perfectly sufficient for 99% of documents, but why introduce any limit at all?<\/p>\n<h3>Issue 3: Body Text\/Heading Associations<\/h3>\n<p>One method to emphasise the hierarchical nature of a document is to modify the style of the text that appears in a section. Here are some examples: deeply nested sections might be indented further to the right; the first word of a chapter might use drop-caps.<\/p>\n<p>This is especially important if you want to be able to be able to add more text to the parent section beneath the text of the sub-section.<\/p>\n<p>None of Word, HTML, LaTeX and MarkDown offers the ability to do this easily.<\/p>\n<h3>A Dull But Important Proposal<\/h3>\n<p>I would propose a markup like so:<\/p>\n<pre><code> &lt;SUBSECTION TITLE=\"Vertebrates\"&gt;\n    &lt;SUBSECTION TITLE=\"Mammals\"&gt;\n        Mammals are warm-blooded and suckle their young. \n        They are often cute and cuddly.\n    &lt;\/SUBSECTION&gt;\n    &lt;SUBSECTION TITLE=\"Reptiles\"&gt;\n        Reptiles are slimy and icky. Ewww! Don\u00e2\u20ac\u2122t cuddle them.\n    &lt;\/SUBSECTION&gt;\n    There are other types of vertebrates, too, \n    but I don\u00e2\u20ac\u2122t want to mention them here.\n &lt;\/SUBSECTION&gt;\n<\/code><\/pre>\n<p>This is a better model than the existing systems, because it fixes all the above issues:<\/p>\n<ul>\n<li>\n<p>Sections have greater <a href=\"http:\/\/www.somethinkodd.com\/oddthinking\/2005\/10\/09\/internal-rules\/\">modifiability<\/a> and motility. This entire section could be placed under a section called \u00e2\u20ac\u0153Animals\u00e2\u20ac\u009d. Then that section could be put under a section called \u00e2\u20ac\u0153Essay On Animals\u00e2\u20ac\u009d. Then that section could be put into a chapter on \u00e2\u20ac\u0153Selected Essays\u00e2\u20ac\u009d. None of these would require any modification to the markup of the original text.<\/p>\n<\/li>\n<li>\n<p>There are no arbitrary limitations to the depth.<\/p>\n<\/li>\n<li>\n<p>Text can be associated with appropriate section, and formatted appropriately. Text, like &#8220;There are other types of verterbrates[&#8230;]&#8221; can be formatted distinctly from &#8220;Reptiles are slimy[&#8230;]&#8221; to make it clear than you have popped up a level.<\/p>\n<\/li>\n<\/ul>\n<p>XML-lawyers may require me to move the TITLE field out to a separate &lt;TITLE&gt; tag because of the sub-tags that are permitted in the heading. I can live with that.<\/p>\n<h3>Issue 4: Heading 1 is too big.<\/h3>\n<p>Like most users, I don\u00e2\u20ac\u2122t want a new style-sheet for every document I write or every article on this blog. I define the rules once, and then use them over and over again.<\/p>\n<p>The hierarchy is defined once, for the largest possible document, and then re-used. So the top-level heading is huge \u00e2\u20ac\u201c it is suitable for chapter headings, and (in printed documents) will often start a new page. The second-level heading is very large, to represent subchapters. The third-level heading is a more comfortable size. The forth level heading is generally not much more than bolding.<\/p>\n<p>When I write a small document, this means the top-level heading dominates the page. I tend to skip straight to the second or third heading.  For example, the sections of this article <em>start<\/em> at &lt;H3&gt;.<\/p>\n<p>Does that sound like the wrong semantics to you?  It does to me. <\/p>\n<h3>An Innovative but Important Proposal<\/h3>\n<p>Rather than me lying to the computer to ensure that the formatting matches the importance, the importance should be inferred from the markup that I have done.<\/p>\n<p>Somewhere in the typesetting (whether it is the web-browser, WordPress, Word, whatever), the typesetter should count the depth of the hierarchy, and build up from there. <\/p>\n<p>If I only have one level of sections, then the top-level heading should merely be bolded.<\/p>\n<p>If I have two level of sections, then the top-level heading should be in 16-point. The second-level heading should merely be bolded.<\/p>\n<p>If I have five levels of sections, then the top-level heading should start a new page, and be in 28-point.<\/p>\n<p>I think this is an important improvement to the notion of stylesheets. Is important enough for me to write a demonstration prototype plugin for WordPress?  That seems rather unlikely.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I describe three separate issues with the handling of Sections and Headings in modern typesetting tools. I propose a dull but important change to markup languages to deal with these issues. This proposal is not particularly innovative, but just better engineered. Then I mention a new problem that I only just noticed, and propose an innovative new feature that would be way cool.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[25,34,27],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-insufficiently-advanced-technology","category-software-development","category-thoughts-from-the-shower"],"_links":{"self":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":0,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.somethinkodd.com\/oddthinking\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}