File indexing completed on 2024-11-24 04:34:43
0001 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 0002 <html> 0003 <!-- This document is an unofficial reference manual for LaTeX, a 0004 document preparation system, version of November 2018. 0005 0006 This manual was originally translated from LATEX.HLP v1.0a in the 0007 VMS Help Library. The pre-translation version was written by 0008 George D. Greenwade of Sam Houston State University. The 0009 LaTeX 2.09 version was written by Stephen Gilmore. The 0010 LaTeX2e version was adapted from this by Torsten Martinsen. Karl 0011 Berry made further updates and additions, and gratefully acknowledges 0012 using Hypertext Help with LaTeX, by Sheldon Green, and 0013 LaTeX Command Summary (for LaTeX 2.09) by 0014 L. Botway and C. Biemesderfer (published by the TeX Users 0015 Group as TeXniques number 10), as reference material. We also 0016 gratefully acknowledge additional material appearing in 0017 latex2e-reference by Martin Herbert Dietze. (From these references no 0018 text was directly copied.) 0019 0020 Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013, 0021 2014, 2015, 2016, 2017, 2018 Karl Berry. 0022 0023 Copyright 1988, 1994, 2007 Stephen Gilmore. 0024 0025 Copyright 1994, 1995, 1996 Torsten Martinsen. 0026 0027 Permission is granted to make and distribute verbatim copies of 0028 this manual provided the copyright notice and this permission notice 0029 are preserved on all copies. 0030 0031 0032 Permission is granted to copy and distribute modified versions of this 0033 manual under the conditions for verbatim copying, provided that the entire 0034 resulting derived work is distributed under the terms of a permission 0035 notice identical to this one. 0036 0037 Permission is granted to copy and distribute translations of this manual 0038 into another language, under the above conditions for modified versions. --> 0039 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> 0040 <head> 0041 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 0042 <title>\@startsection (LaTeX2e unofficial reference manual (November 2018))</title> 0043 0044 <meta name="description" content="\@startsection (LaTeX2e unofficial reference manual (November 2018))"> 0045 <meta name="keywords" content="\@startsection (LaTeX2e unofficial reference manual (November 2018))"> 0046 <meta name="resource-type" content="document"> 0047 <meta name="distribution" content="global"> 0048 <meta name="Generator" content="makeinfo"> 0049 <link href="index.html#Top" rel="start" title="Top"> 0050 <link href="IndexDocument.html#Index" rel="index" title="Index"> 0051 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 0052 <link href="Sectioning.html#Sectioning" rel="up" title="Sectioning"> 0053 <link href="Cross-references.html#Cross-references" rel="next" title="Cross references"> 0054 <link href="_005cfrontmatter-_0026-_005cmainmatter-_0026-_005cbackmatter.html#g_t_005cfrontmatter-_0026-_005cmainmatter-_0026-_005cbackmatter" rel="prev" title="\frontmatter & \mainmatter & \backmatter"> 0055 <style type="text/css"> 0056 <!-- 0057 /* $Id: latex2e.css 690 2018-09-15 15:20:19Z jimhefferon $ 0058 Minor css for latexrefman. Public domain. 0059 Originally written by Jim Hefferon and Karl Berry, 2018. */ 0060 0061 /* So you can style for yourself */ 0062 @import url("/css/latexreflocal.css"); 0063 0064 0065 0066 a.summary-letter {text-decoration: none} 0067 blockquote.indentedblock {margin-right: 0em} 0068 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} 0069 blockquote.smallquotation {font-size: smaller} 0070 div.display {margin-left: 3.2em} 0071 div.example {margin-left: 3.2em} 0072 div.lisp {margin-left: 3.2em} 0073 div.smalldisplay {margin-left: 3.2em} 0074 div.smallexample {margin-left: 3.2em} 0075 div.smalllisp {margin-left: 3.2em} 0076 kbd {font-style: oblique} 0077 pre.display {font-family: inherit} 0078 pre.format {font-family: inherit} 0079 pre.menu-comment {font-family: serif} 0080 pre.menu-preformatted {font-family: serif} 0081 pre.smalldisplay {font-family: inherit; font-size: smaller} 0082 pre.smallexample {font-size: smaller} 0083 pre.smallformat {font-family: inherit; font-size: smaller} 0084 pre.smalllisp {font-size: smaller} 0085 span.nolinebreak {white-space: nowrap} 0086 span.roman {font-family: initial; font-weight: normal} 0087 span.sansserif {font-family: sans-serif; font-weight: normal} 0088 ul.no-bullet {list-style: none} 0089 BODY { 0090 margin-top: 1em; 0091 margin-left: 1em; /* auto results in two-digit <ol> lost off left */ 0092 margin-right: 1em; 0093 margin-bottom: 1em; 0094 /* the idea is to use the whole window, unless it is ridiculously 0095 wide, probably with too-small fonts, too. */ 0096 max-width: 64em; 0097 } 0098 0099 /* Because we want @math{... @code ...} to be upright, not slanted, 0100 and Texinfo won't fix it. */ 0101 code {font-style:normal; font-family:monospace; } 0102 0103 /* We put a link to our own home page at the bottom. */ 0104 div.referenceinfo {font-size:small;} 0105 0106 --> 0107 </style> 0108 0109 0110 </head> 0111 0112 <body lang="en"> 0113 <a name="g_t_005c_0040startsection"></a> 0114 <div class="header"> 0115 <p> 0116 Previous: <a href="_005cfrontmatter-_0026-_005cmainmatter-_0026-_005cbackmatter.html#g_t_005cfrontmatter-_0026-_005cmainmatter-_0026-_005cbackmatter" accesskey="p" rel="prev">\frontmatter & \mainmatter & \backmatter</a>, Up: <a href="Sectioning.html#Sectioning" accesskey="u" rel="up">Sectioning</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="IndexDocument.html#Index" title="Index" rel="index">Index</a>]</p> 0117 </div> 0118 <hr> 0119 <a name="g_t_005c_0040startsection-1"></a> 0120 <h3 class="section">6.8 <code>\@startsection</code></h3> 0121 0122 <a name="index-_005c_0040startsection"></a> 0123 <a name="index-section_002c-redefining"></a> 0124 0125 <p>Synopsis: 0126 </p> 0127 <div class="example"> 0128 <pre class="example">\@startsection{<var>name</var>}{<var>level</var>}{<var>indent</var>}{<var>beforeskip</var>}{<var>afterskip</var>}{<var>style</var>} 0129 </pre></div> 0130 0131 <p>Used to help redefine the behavior of commands that start sectioning 0132 divisions such as <code>\section</code> or <code>\subsection</code>. 0133 </p> 0134 <p>Note that the <samp>titlesec</samp> package makes manipulation of sectioning 0135 easier. Further, while most requirements for sectioning commands can be 0136 satisfied with <code>\@startsection</code>, some cannot. For instance, in 0137 the standard LaTeX <code>book</code> and <code>report</code> classes the commands 0138 <code>\chapter</code> and <code>\report</code> are not constructed in this way. To 0139 make such a command you may want to use the <code>\secdef</code> command. 0140 </p> 0141 <p>Technically, <code>\@startsection</code> has the form 0142 </p> 0143 <div class="example"> 0144 <pre class="example">\@startsection{<var>name</var>} 0145 {<var>level</var>} 0146 {<var>indent</var>} 0147 {<var>beforeskip</var>} 0148 {<var>afterskip</var>} 0149 {<var>style</var>}*[<var>toctitle</var>]{<var>title</var>} 0150 </pre></div> 0151 0152 <p>so that issuing 0153 </p> 0154 <div class="example"> 0155 <pre class="example">\renewcommand{\section}{\@startsection{<var>name</var>} 0156 {<var>level</var>} 0157 {<var>indent</var>} 0158 {<var>beforeskip</var>} 0159 {<var>afterskip</var>} 0160 {<var>style</var>}} 0161 </pre></div> 0162 0163 <p>redefines <code>\section</code> to have the form 0164 <code>\section*[<var>toctitle</var>]{<var>title</var>}</code> (here too, the 0165 star <code>*</code> is optional). See <a href="Sectioning.html#Sectioning">Sectioning</a>. This implies that 0166 when you write a command like <code>\renewcommand{section}{...}</code>, 0167 the <code>\@startsection{...}</code> must come last in the definition. See 0168 the examples below. 0169 </p> 0170 <dl compact="compact"> 0171 <dt><var>name</var></dt> 0172 <dd><a name="startsection-name"></a><a name="g_t_005c_0040startsection_002fname"></a><p>Name of the counter used to number the sectioning header. This counter 0173 must be defined separately. Most commonly this is either 0174 <code>section</code>, <code>subsection</code>, or <code>paragraph</code>. Although in 0175 those cases the counter name is the same as the sectioning command 0176 itself, you don’t have to use the same name. 0177 </p> 0178 <p>Then <code>\the</code><var>name</var> displays the title number and 0179 <code>\</code><var>name</var><code>mark</code> is for the page headers. See the third 0180 example below. 0181 </p> 0182 </dd> 0183 <dt><var>level</var></dt> 0184 <dd><a name="startsection-level"></a><a name="g_t_005c_0040startsection_002flevel"></a><p>An integer giving the depth of the sectioning command. 0185 See <a href="Sectioning.html#Sectioning">Sectioning</a> for the list of standard level numbers. 0186 </p> 0187 <p>If <var>level</var> is less than or equal to the value of the counter 0188 <code>secnumdepth</code> then titles for this sectioning command will be 0189 numbered (see <a href="Sectioning.html#Sectioning_002fsecnumdepth">Sectioning/secnumdepth</a>). For instance, if 0190 <code>secnumdepth</code> is 1 in an <code>article</code> then the command 0191 <code>\section{Introduction}</code> will produce output like “1 0192 Introduction” while <code>\subsection{Discussion}</code> will produce 0193 output like “Discussion”, without the number prefix. 0194 </p> 0195 <p>If <var>level</var> is less than or equal to the value of the counter 0196 <var>tocdepth</var> then the table of contents will have an entry for this 0197 sectioning unit (see <a href="Sectioning.html#Sectioning_002ftocdepth">Sectioning/tocdepth</a>). For instance, in an 0198 <code>article</code>, if <var>tocdepth</var> is 1 then the table of contents will 0199 list sections but not subsections. 0200 </p> 0201 </dd> 0202 <dt><var>indent</var></dt> 0203 <dd><a name="startsection-indent"></a><a name="g_t_005c_0040startsection_002findent"></a><p>A length giving the indentation of all of the title lines with respect 0204 to the left margin. To have the title flush with the margin use 0205 <code>0pt</code>. A negative indentation such as <code>-\parindent</code> will move 0206 the title into the left margin. 0207 </p> 0208 </dd> 0209 <dt><var>beforeskip</var></dt> 0210 <dd><a name="startsection-beforeskip"></a><a name="g_t_005c_0040startsection_002fbeforeskip"></a><p>The absolute value of this length is the amount of vertical space that 0211 is inserted before this sectioning unit’s title. This space will be 0212 discarded if the sectioning unit happens to start at the top of a fresh 0213 page. If this number is negative then the first paragraph following the 0214 header is not indented, if it is non-negative then the first paragraph 0215 is indented. (Note that the negative of <code>1pt plus 2pt minus 3pt</code> 0216 is <code>-1pt plus -2pt minus -3pt</code>.) 0217 </p> 0218 <p>For example, if <var>beforeskip</var> is <code>-3.5ex plus -1ex minus -0.2ex</code> 0219 then to start the new sectioning unit, LaTeX will add about 3.5 times 0220 the height of a letter x in vertical space, and the first paragraph in 0221 the section will not be indented. Using a rubber length, with 0222 <code>plus</code> and <code>minus</code>, is good practice here since it gives 0223 LaTeX more flexibility in making up the page (see <a href="Lengths.html#Lengths">Lengths</a>). 0224 </p> 0225 <p>The full accounting of the vertical space between the baseline of the 0226 line prior to this sectioning unit’s header and the baseline of the 0227 header is that it is the sum of the <code>\parskip</code> of the text font, 0228 the <code>\baselineskip</code> of the title font, and the absolute value of 0229 the <var>beforeskip</var>. This space is typically rubber so it may stretch 0230 or shrink. (If the sectioning unit starts on a fresh page so that the 0231 vertical space is discarded then the baseline of the header text will be 0232 where LaTeX would put the baseline of the first text line on that 0233 page.) 0234 </p> 0235 </dd> 0236 <dt><var>afterskip</var></dt> 0237 <dd><a name="startsection-afterskip"></a><a name="g_t_005c_0040startsection_002fafterskip"></a><p>This is a length. If <var>afterskip</var> is non-negative then this is the 0238 vertical space inserted after the sectioning unit’s title header. If it 0239 is negative then the title header becomes a run-in header, so that it 0240 becomes part of the next paragraph. In this case the absolute value of 0241 the length gives the horizontal space between the end of the title and 0242 the beginning of the following paragraph. (Note that the negative of 0243 <code>1pt plus 2pt minus 3pt</code> is <code>-1pt plus -2pt minus -3pt</code>.) 0244 </p> 0245 <p>As with <var>beforeskip</var>, using a rubber length, with <code>plus</code> and 0246 <code>minus</code> components, is good practice here since it gives LaTeX 0247 more flexibility in putting together the page. 0248 </p> 0249 <p>If <code>afterskip</code> is non-negative then the full accounting of the 0250 vertical space between the baseline of the sectioning unit’s header and 0251 the baseline of the first line of the following paragraph is that it is 0252 the sum of the <code>\parskip</code> of the title font, the 0253 <code>\baselineskip</code> of the text font, and the value of <var>after</var>. 0254 That space is typically rubber so it may stretch or shrink. (Note that 0255 because the sign of <code>afterskip</code> changes the sectioning unit 0256 header’s from standalone to run-in, you cannot use a negative 0257 <code>afterskip</code> to cancel part of the <code>\parskip</code>.) 0258 </p> 0259 </dd> 0260 <dt><var>style</var></dt> 0261 <dd><a name="startsection-style"></a><a name="g_t_005c_0040startsection_002fstyle"></a><p>Controls the styling of the title. See the examples below. Typical 0262 commands to use here are <code>\centering</code>, <code>\raggedright</code>, 0263 <code>\normalfont</code>, <code>\hrule</code>, or <code>\newpage</code>. The last command 0264 in <var>style</var> may be one that takes one argument, such as 0265 <code>\MakeUppercase</code> or <code>\fbox</code> that takes one argument. The 0266 section title will be supplied as the argument to this command. For 0267 instance, setting <var>style</var> to <code>\bfseries\MakeUppercase</code> would 0268 produce titles that are bold and uppercase. 0269 </p></dd> 0270 </dl> 0271 0272 <p>These are LaTeX’s defaults for the first three sectioning units that 0273 are defined with <code>\@startsection</code>, for the <samp>article</samp>, 0274 <samp>book</samp>, and <samp>report</samp> classes. For section, the <var>level</var> is 0275 1, the <var>indent</var> is 0pt, the <var>beforeskip</var> is <code>-3.5ex 0276 plus -1ex minus -0.2ex</code>, the <var>afterskip</var> is <code>2.3ex plus 0.2ex</code>, 0277 and the <var>style</var> is <code>\normalfont\Large\bfseries</code>. For 0278 subsection, the <var>level</var> is 2, the <var>indent</var> is 0pt, the 0279 <var>beforeskip</var> is <code>-3.25ex plus -1ex minus -0.2ex</code>, the 0280 <var>afterskip</var> is <code>1.5ex plus 0.2ex</code>, and the <var>style</var> is 0281 <code>\normalfont\large\bfseries</code>. For subsubsection, the <var>level</var> 0282 is 3, the <var>indent</var> is 0pt, the <var>beforeskip</var> is 0283 <code>-3.25ex plus -1ex minus -0.2ex</code>, the <var>afterskip</var> is 0284 <code>1.5ex plus 0.2ex</code>, and the <var>style</var> is 0285 <code>\normalfont\normalsize\bfseries</code>. 0286 </p> 0287 <p>Here are examples. They go either in a package or class file or in the 0288 preamble of a LaTeX document. If you put them in the preamble they 0289 must go between a <code>\makeatletter</code> command and a 0290 <code>\makeatother</code>. (Probably the error message <code>You can't use 0291 `\spacefactor' in vertical mode.</code> means that you forgot this.) 0292 See <a href="_005cmakeatletter-_0026-_005cmakeatother.html#g_t_005cmakeatletter-_0026-_005cmakeatother">\makeatletter & \makeatother</a>. 0293 </p> 0294 <p>This will put section titles in large boldface type, centered. It says 0295 <code>\renewcommand</code> because LaTeX’s standard classes have already 0296 defined a <code>\section</code>. For the same reason it does not define a 0297 <code>section</code> counter, or the commands <code>\thesection</code> and 0298 <code>\l@section</code>. 0299 </p> 0300 <div class="example"> 0301 <pre class="example">\renewcommand\section{% 0302 \@startsection{section}% <a href="#g_t_005c_0040startsection_002fname"><var>name</var></a> 0303 {1}% <a href="#g_t_005c_0040startsection_002flevel"><var>level</var></a> 0304 {0pt}% <a href="#g_t_005c_0040startsection_002findent"><var>indent</var></a> 0305 {-3.5ex plus -1ex minus -.2ex}% <a href="#g_t_005c_0040startsection_002fbeforeskip"><var>beforeskip</var></a> 0306 {2.3ex plus.2ex}% <a href="#g_t_005c_0040startsection_002fafterskip"><var>afterskip</var></a> 0307 {\centering\normalfont\Large\bfseries}% <a href="#g_t_005c_0040startsection_002fstyle"><var>style</var></a> 0308 } 0309 </pre></div> 0310 0311 <p>This will put <code>subsection</code> titles in small caps type, inline with the paragraph. 0312 </p> 0313 <div class="example"> 0314 <pre class="example">\renewcommand\subsection{% 0315 \@startsection{subsection}% <a href="#g_t_005c_0040startsection_002fname"><var>name</var></a> 0316 {2}% <a href="#g_t_005c_0040startsection_002flevel"><var>level</var></a> 0317 {0em}% <a href="#g_t_005c_0040startsection_002findent"><var>indent</var></a> 0318 {-1ex plus 0.1ex minus -0.05ex}% <a href="#g_t_005c_0040startsection_002fbeforeskip"><var>beforeskip</var></a> 0319 {-1em plus 0.2em}% <a href="#g_t_005c_0040startsection_002fafterskip"><var>afterskip</var></a> 0320 {\scshape}% <a href="#g_t_005c_0040startsection_002fstyle"><var>style</var></a> 0321 } 0322 </pre></div> 0323 0324 <p>The prior examples redefined existing sectional unit title commands. 0325 This defines a new one, illustrating the needed counter and macros to 0326 display that counter. 0327 </p> 0328 <div class="example"> 0329 <pre class="example">\setcounter{secnumdepth}{6}% show counters this far down 0330 \newcounter{subsubparagraph}[subparagraph]% counter for numbering 0331 \renewcommand{\thesubsubparagraph}% how to display 0332 {\thesubparagraph.\@arabic\c@subsubparagraph}% numbering 0333 \newcommand{\subsubparagraph}{\@startsection 0334 {subsubparagraph}% 0335 {6}% 0336 {0em}% 0337 {\baselineskip}% 0338 {0.5\baselineskip}% 0339 {\normalfont\normalsize}} 0340 \newcommand*\l@subsubparagraph{\@dottedtocline{6}{10em}{5em}}% for toc 0341 \newcommand{\subsubparagraphmark}[1]{}% for page headers 0342 </pre></div> 0343 0344 0345 0346 0347 <hr/><div class='referenceinfo'> <a href='https://latexref.xyz/'> <i>Unofficial LaTeX2e reference manual</i></a></div> 0348 </body> 0349 </html>