{"id":148,"date":"2011-12-19T18:42:24","date_gmt":"2011-12-19T18:42:24","guid":{"rendered":"http:\/\/patternweaver.com\/blog\/?p=148"},"modified":"2011-12-19T18:42:24","modified_gmt":"2011-12-19T18:42:24","slug":"xelatex-section-modifications","status":"publish","type":"post","link":"http:\/\/patternweaver.com\/blog\/2011\/12\/xelatex-section-modifications\/","title":{"rendered":"XeLaTeX Section Modifications"},"content":{"rendered":"<p>Back in college I was working in a group project where we produced a document which was quite large, as well as deep&#8230; and we had a need for a subsubsubsection. One of the group members, Ruslan Hristov (who was also the project leader where I worked on <a href=\"http:\/\/www.skio.usg.edu\/?p=research\/bio\/veritylab\/ip\">Skipper<\/a>) cobbled together an early version of this, which I have kept since, modifying it as needed. It works as you would expect.<\/p>\n<div id=\"gist1498316\" class=\"gist\">\n    <div class=\"gist-file\">\n      <div class=\"gist-data\">\n        <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n  <div id=\"file-subsubsubsection-tex\" class=\"file\">\n    \n\n  <div class=\"blob-wrapper data type-tex\">\n      <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC1\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\makeatletter<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L2\" class=\"blob-num js-line-number\" data-line-number=\"2\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC2\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\newcounter<\/span>{subsubsubsection}[subsubsection]<\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L3\" class=\"blob-num js-line-number\" data-line-number=\"3\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC3\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\def\\subsubsubsectionmark<\/span>#1{} <span class=\"pl-c\">% Just list the number<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L4\" class=\"blob-num js-line-number\" data-line-number=\"4\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC4\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\def\\thesubsubsubsection<\/span> {<span class=\"pl-c1\">\\thesubsubsection<\/span>.<span class=\"pl-c1\">\\arabic<\/span>{subsubsubsection}}<\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L5\" class=\"blob-num js-line-number\" data-line-number=\"5\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC5\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\def\\subsubsubsection<\/span>{<\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L6\" class=\"blob-num js-line-number\" data-line-number=\"6\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC6\" class=\"blob-code blob-code-inner js-file-line\">    <span class=\"pl-c1\">\\vspace<\/span>{0.1in}<\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L7\" class=\"blob-num js-line-number\" data-line-number=\"7\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC7\" class=\"blob-code blob-code-inner js-file-line\">    <span class=\"pl-c1\">\\@startsection<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L8\" class=\"blob-num js-line-number\" data-line-number=\"8\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC8\" class=\"blob-code blob-code-inner js-file-line\">        {subsubsubsection}                    <span class=\"pl-c\">% NAME<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L9\" class=\"blob-num js-line-number\" data-line-number=\"9\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC9\" class=\"blob-code blob-code-inner js-file-line\">        {4}                                   <span class=\"pl-c\">% LEVEL<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L10\" class=\"blob-num js-line-number\" data-line-number=\"10\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC10\" class=\"blob-code blob-code-inner js-file-line\">        {<span class=\"pl-c1\">\\z@<\/span>}                                 <span class=\"pl-c\">% INDENT<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L11\" class=\"blob-num js-line-number\" data-line-number=\"11\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC11\" class=\"blob-code blob-code-inner js-file-line\">        {-3.25ex<span class=\"pl-c1\">\\@plus<\/span> -0.1ex <span class=\"pl-c1\">\\@minus<\/span> -.2ex}  <span class=\"pl-c\">% BEFORESKIP<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L12\" class=\"blob-num js-line-number\" data-line-number=\"12\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC12\" class=\"blob-code blob-code-inner js-file-line\">        {0.2ex <span class=\"pl-c1\">\\@plus<\/span> .01ex}                  <span class=\"pl-c\">% AFTERSKIP<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L13\" class=\"blob-num js-line-number\" data-line-number=\"13\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC13\" class=\"blob-code blob-code-inner js-file-line\">        {<span class=\"pl-c1\">\\normalsize\\bf<\/span>}   <span class=\"pl-c\">% STYLE<\/span><\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L14\" class=\"blob-num js-line-number\" data-line-number=\"14\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC14\" class=\"blob-code blob-code-inner js-file-line\">}<\/td>\n      <\/tr>\n      <tr>\n        <td id=\"file-subsubsubsection-tex-L15\" class=\"blob-num js-line-number\" data-line-number=\"15\"><\/td>\n        <td id=\"file-subsubsubsection-tex-LC15\" class=\"blob-code blob-code-inner js-file-line\"><span class=\"pl-c1\">\\def\\l@subsubsubsection<\/span>{<span class=\"pl-c1\">\\@dottedtocline<\/span>{4}{4.8em}{4.2em}} <span class=\"pl-c\">% TOC Entry<\/span><\/td>\n      <\/tr>\n<\/table>\n\n  <\/div>\n\n  <\/div>\n  \n<\/div>\n\n      <\/div>\n      <div class=\"gist-meta\">\n        <a href=\"https:\/\/gist.github.com\/khrome\/1498316\/raw\/0e4bcfe9daabb9172e1eb173b9abea74a20d95af\/subsubsubsection.tex\" style=\"float:right\">view raw<\/a>\n        <a href=\"https:\/\/gist.github.com\/khrome\/1498316#file-subsubsubsection-tex\">subsubsubsection.tex<\/a>\n        hosted with &#10084; by <a href=\"https:\/\/github.com\">GitHub<\/a>\n      <\/div>\n    <\/div>\n<\/div>\n\n<p>This is also an opportune time to show how I add custom fonts to all of my sections using XeLaTeX&#8217;s <b>excellent<\/b> font rendering capabilities. Much of this code is originally from Manas Tungare&#8217;s original scripts.<\/p>\n<script src=\"https:\/\/gist.github.com\/1498316.js?file=xelatex_fonts.tex\"><\/script><noscript><pre><code class=\"language-tex tex\">\\RequirePackage[cm-default]{fontspec}\n\\RequirePackage{xunicode}\n\\RequirePackage{xltxtra}\n\n\\defaultfontfeatures{Scale=MatchLowercase}\n\n\\def\\@makechapterhead#1{%\n  \\vspace*{50\\p@}%\n  {\\parindent \\z@ \\raggedright \\sffamily\n    \\ifnum \\c@secnumdepth &gt;\\m@ne\n        \\large \\bfseries \\@chapapp\\space \\thechapter\n        \\par\\nobreak\n        \\vskip 10\\p@\n    \\fi\n    \\interlinepenalty\\@M\n    \\Huge \\bfseries #1\\par\\nobreak\n    \\vskip 20\\p@\n  }}\n\n\\def\\@makeschapterhead#1{%\n  \\vspace*{50\\p@}%\n  {\\parindent \\z@ \\raggedright\n    \\sffamily\n    \\interlinepenalty\\@M\n    \\Huge\\bfseries  #1\\par\\nobreak\n    \\vskip 20\\p@\n  }}\n\n\\renewcommand\\section{\\@startsection {section}{1}{\\z@}%\n    {-3.5ex \\@plus -0.1ex \\@minus -.2ex}%\n    {0.2ex \\@plus.01ex}%\n    {\\sffamily\\large\\bfseries}}\n\\renewcommand\\subsection{\\@startsection{subsection}{2}{\\z@}%\n    {-3.25ex\\@plus -0.1ex \\@minus -.2ex}%\n    {0.2ex \\@plus .01ex}%\n    {\\sffamily\\normalsize\\bfseries}}\n\\renewcommand\\subsubsection{\\@startsection{subsubsection}{3}{\\z@}%\n    {-3.25ex\\@plus -0.1ex \\@minus -.2ex}%\n    {0.2ex \\@plus .01ex}%\n    {\\sffamily\\MakeUppercase\\small\\bfseries}}\n\\renewcommand\\subsubsubsection{\\@startsection{subsubsubsection}{4}{\\z@}%\n    {-3.25ex\\@plus -0.1ex \\@minus -.2ex}%\n    {0.2ex \\@plus .01ex}%\n    {\\sffamily\\MakeUppercase\\small\\bfseries}}<\/code><\/pre><\/noscript>\n<p>Then you need to set your fonts:<\/p>\n<script src=\"https:\/\/gist.github.com\/1498316.js?file=font_styles.tex\"><\/script><noscript><pre><code class=\"language-tex tex\">\\setsansfont[Mapping=tex-text,Scale=1.1]{Scrawler}\n\\setmainfont[Mapping=tex-text,Scale=1.0]{Lucida Grande}\n\\setmonofont{Courier}<\/code><\/pre><\/noscript>\n<p>Now you have extended section depth and custom styling, and can forget you even changed anything.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back in college I was working in a group project where we produced a document which was quite large, as well as deep&#8230; and we had a need for a subsubsubsection. One of the group members, Ruslan Hristov (who was also the project leader where I worked on Skipper) cobbled together an early version of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-xelatex"],"_links":{"self":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":0,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"wp:attachment":[{"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/patternweaver.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}