New answers tagged

1

While Christian offers a better solution, you can start with \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{lipsum} \begin{document} \begin{tcolorbox}[ sharp corners, boxrule=2mm, notitle, colback=white, colframe=blue, coltitle=white, fonttitle=\bfseries] This is a \textbf{tcolorbox}. \tcbsubtitle[before ...


0

If you are using KOMA-Script version 3.17 or older you have to replace \include{...} by \clearpage\input{...}. If you do not want that the content of the loaded file starts on a new page then use only \input{...}. With KOMA-Script version 3.18 or newer there is no problem with the order of the TOC entries. But the code that removes the chapter heading does ...


1

A bit ugly, but with three conditionals in the frametitle definition, it gives the desired numbers. \documentclass{beamer} \usepackage{etoolbox} \usepackage{xpatch} \usetheme{Warsaw} \usecolortheme{seahorse} \setbeamertemplate{section in head/foot}{\hfill\insertsectionheadnumber.~\insertsectionhead} \setbeamertemplate{section in head/foot ...


2

\documentclass{scrartcl} \usepackage{kantlipsum} \title{A title} \author{An author} \date{\today} \begin{document} \maketitle \begin{abstract} \kant[1] \end{abstract} \section{A section} \subsection{A subsection} \kant \end{document} If you want the abstract text itself in Sans Serif use \begin{abstract}\sffamily


1

LaTeX is a funny beast sometimes, since what should be a fairly simple thing can often end up more complicated than you expect. In this case, because the different parts of the document (title, abstract, headings, etc.) are constructed separately, you need to change each part separately. For some things (like the title parts) the hacky way to do this is ...


2

Here is a solution \documentclass{article} \usepackage{lipsum} \newcommand*\editorialtable{% \beforeeditorialtable \begin{tabular}{|l|l|l|l|} \hline \multicolumn{1}{|c}{Section} & \multicolumn{1}{|c}{Subsection} & \multicolumn{1}{|c}{Responsible}&\multicolumn{1}{|c|}{Helpers}\\ \hline \makeeditorialtable \end{tabular} \aftereditorialtable} ...


2

See the updated and better version at the end, please! A preliminary version with expl3 features and key-value interface, only working for a table at the end at the moment! \documentclass{article} \usepackage{xparse} \usepackage{xkeyval} \makeatletter \let\latex@@section\section \let\latex@@subsection\subsection \define@key{editorial}{helper}{% ...


1

The basic idea is to use the starred form: \chapter*{Attachments} associated with \addcontentsline{toc}{chapter}{Attachments}. This last bit is needed because the starred form strips down the chapter number but also prevents it to appear in the table of contents. \documentclass[a4paper,10pt]{book} \begin{document} \tableofcontents \chapter{This is chapter1} ...


2

It is already answered here. If you wish to remove page numbers for a certain level, such as subsection, redefine \l@subsection{title}{page number}.


4

The visual representation of the section counter is specified by macro \thesection, which can be redefined: \section{Section Title} (Question 1) \let\savedthesection\thesection \renewcommand*{\thesection}{% \arabic{section}--\the\numexpr\value{section}+1\relax } \section{Section Title} \stepcounter{section} \let\thesection\savedthesection (Question 2 ...


1

You can use following code in preamble to change color of links according to your choice.Use black instead of red if you want links in toc to appear black. \hypersetup{ colorlinks, linkcolor={red!100!black}, citecolor={blue!100!black}, urlcolor={green!100!black}}


2

I wouldn't do it, but ... you asked for it. \documentclass{article} \usepackage{xcolor} \begin{document} \tableofcontents \section{Wombat} {\color{blue!50!black} \section{Capybara} } \section{Mara} \end{document}


2

\subsubsection[Embedded Design]{{\color{red} Embedded Design}} The part in the square brackets, defines the optional title of a *section that will be shown in the toc


1

I think I got it. Hope this helps anybody as confused with latex as I am. Using the new pagestyle, I ended up with: \fancypagestyle{special_chapter}{ \fancyhf{} \fancyhead[RO]{% \begin{tikzpicture}[overlay,remember picture] \fill [color=black!20] (current page.north east) rectangle ($ (current page.south east) + (-1cm,0cm) ...


0

As abstract is neither a chapter nor a section so for abstract you should use \begin{abstract}....\end{abstract} as shown below: \begin{abstract} \addcontentsline{toc}{chapter}{abstract} abstract content here \end{abstract} Line below is used to show abstract in list of contents: \addcontentsline{toc}{chapter}{abstract}


2

If you don't want to use any of the sectioning titles, I think it would be OK for you to just print the section number, including the other levels. It would not be immediate as seeing the word, but the numbering would still be unambiguous. However keep in mind that \paragraph doesn't carry a number by default, so referring to this will still show the ...


1

You can use the cleveref package and code \cref{<subsubsectionlabel>}, which will print as Section x.y.z. The difference between the various sectioning levels is reflected in the numbering. You also can customise the string which will appear as the subsubsection name with \crefname{subsubsection}{\S}{\S} \Crefname{subsubsection}{\S}{\S} These can ...


2

Remove \centering from the definition of \section using an etoolbox patch. Since the patch would be permanent from that point forward, you can save the original and modified definitions and creates switches to change the style on demand: \documentclass{amsart} \let\centeredsection\section% Copy original centered definition of \section ...


0

This is readily achievable using sectsty and some manual adjustments for the \chapter setting: \documentclass{report} \usepackage{sectsty} % http://tex.stackexchange.com/q/59726/5764 \allsectionsfont{\centering\normalsize\bfseries}% All sections are centred/normal size/bold \subsectionfont{\normalsize\bfseries}% Correct \subsection formatting ...


4

You can \RedeclareSectionCommand to change the skips before and after the heading. A negative value of afterskip will result in a horizontal skip. So you get a runin heading. To change the format of the subsection number in the heading you can redefine \subsectionformat. To insert the dot at the end of the subsection title redefine \sectioncatchphraseformat. ...


4

The optional argument to sectional commands are dedicated for ToC-related entries. And, entries to the ToC are treated differently than that of the regular title within the document body. More specifically, ToC entries are written to the .toc file, which may incur expansion problems (typical of what you observed when you used \footnote in the section title). ...


5

The [Short Title] content is meant for the ToC and page headers only, to provide a shorter title, whereas the \chapter{Longer Title} is displayed on the page body. As long as you don't use \tableofcontents you won't notice ANYTHING at all (and not using page headers as well) If the [...] version is omitted, ToC entry and chapter header entry are the same ...


2

It seems that you have somewhere defined \thesection on different way as you expected. So if you instead \renewcommand{\thefigure}{\thesection-\arabic{figure}} use \renewcommand{\thefigure}{\arabic{section}-\arabic{figure}} you will obtain desired form of figure numbers.


0

Since KOMA-Script Version 3.20 (current on CTAN) it is possible to remove the entry numbers in TOC using \RedeclareSectionCommands. \documentclass{scrbook}[2016/05/10] \usepackage{lipsum} \newcommand\remove[1]{} \RedeclareSectionCommands[ %tocindent=0pt,% if the indentation should also be removed tocnumwidth=0pt, tocentrynumberformat=\remove ...


2

You can define your own command that calls \paragraph only when not immediately \subsubsection. \documentclass[oneside,openany,openbib,11pt]{memoir} \usepackage{titlesec} \titleformat{\subsubsection}[runin]{\bfseries}{}{}{}[] \titleformat{\paragraph}[runin]{\normalsize\itshape}{}{}{}[] \makeatletter \newcommand{\prg}[1]{% ...


2

This seems to work, even if the reason is puzzling. ;-) \documentclass{article} \usepackage{titletoc} \usepackage[ colorlinks=true, urlcolor=blue, anchorcolor=blue, citecolor=blue, filecolor=blue, linkcolor=blue, menucolor=blue, linktocpage=true, bookmarks=true, unicode=true, pdfa=true, ]{hyperref} \def\maposectionname{section} ...


1

\documentclass{article} \let\svthesubsection\thesubsection \renewcommand\thesubsection{\S\svthesubsection} \begin{document} \tableofcontents \noindent\hrulefill \section{my section} \subsection{my subsection} \subsubsection{my subsubsection} \end{document}


2

What matters is that space be added if another section (or similar) follows. Hence, it works to add space before the heading and that is what LaTeX does. So you just want to increase that spacing. It is quite possible to add space which will not affect the typesetting of the first section, for example, because TeX knows spacings of many kind. Stretchy ...


1

Maybe something like this would work, using the titlesec package. \documentclass{article} \usepackage[explicit]{titlesec} \titleformat{\section}% {\Large\sffamily\bfseries}% format {Lecture \thesection{} (#1)}% {0pt}% horizontal sep {}% before \begin{document} \section{May 10} Here is the lesson material. ...


1

This is useless code golfing ;-) section is no environment, it's a command,as such, an \endsection is not defined automatically, contrary to a 'real' environment which has been set up with, say, \newenvironment{foo}, then \endfoo does exist. It's possible to abuse LaTeX's environment facilities completely by using \renewenviroment{section} and omitting the ...


1

Maybe I found a solution, it's enough to define \renewcommand\appendix{\par \setcounter{section}{0}% \setcounter{subsection}{0}% \gdef\thesection{\@Alph\c@section}% \@appendixtrue \titlecontents{section}% [2mm] {} ...


4

Under regular documents, using \pdfstrcmp (e-TeX) should work: \documentclass{article} \makeatletter \renewcommand{\@seccntformat}[1]{% \csname the#1\endcsname% Print sectional counter \ifnum\pdfstrcmp{#1}{section}=0 .\fi% If \section, print . \quad% Space between number and title } \makeatother \begin{document} \section{A section} \subsection{A ...


5

Using a \ifx\.... comparison \documentclass{article} \makeatletter \DeclareRobustCommand{\@seccntformat}[1]{% \def\temp@@a{#1}% \def\temp@@b{section}% \ifx\temp@@a\temp@@b \csname the#1\endcsname .\quad% \else \csname the#1\endcsname\quad% \fi } \makeatother \begin{document} \section{Foo} \subsection{Foo} \end{document}


7

How about \makeatletter \def\@seccntformat#1{\@ifundefined{#1@cntformat}% {\csname the#1\endcsname\quad}% default {\csname #1@cntformat\endcsname}}% enable indiv. control \newcommand\section@cntformat{\thesection.\quad} \makeatother Feel free to use a different spacing amount than \quad. A full MWE: \documentclass{article} \makeatletter ...


5

Update (2016/05/22) I've uploaded a new version of cntperchap to CTAN, being called xcntperchap now, it's available on my personal package as well and it will allow for multiple track levels. Edit (2016/05/09): Update: I found a small weird bug in xassoccnt, that lead to some nasty off-by-one value. See the scratch version of a new cntperchap - look-alike ...


1

Here's one option, by setting the content of the section inside a \parbox which allows for using \\: \documentclass{article} \usepackage{xcolor} \usepackage{xparse} \definecolor{color0}{rgb}{0,0,0}% black \definecolor{color1}{rgb}{0.22,0.45,0.70}% light blue \definecolor{color2}{rgb}{0.45,0.45,0.45}% dark grey \makeatletter \newlength{\hintscolumnwidth} ...


2

You shouldn't use underline. This dates back to the times of typewriters, when it was the only simple way to emphasize text. However, if you insist, here's a way to obtain what you want: use the advanced interface of titlesec and the soulutf8 package (I suppose you use utf8 input encoding). The code differs slightly, depending on whether you want to ...


2

You must ‘renewcommand’ \thesubbpart, not \subpart: \documentclass[b5paper]{book} \usepackage[b5paper, showframe]{geometry} \usepackage[newparttoc]{titlesec} \titleclass{\subpart}{page}[\part] \newcounter{subpart} \titleformat{\subpart}[block]{\centering\Huge\bfseries}{\thesubpart.}{10pt}{\thispagestyle{empty}} ...


1

As far as I know standalone does not preserve counter values, it just glues the documents together (with some precautions of course due to packages,\begin{document}...\end{document} etc.) A special environment would not help here, since LaTeX counters are not group safe. The package xassoccnt provides the \BackupCounterValues{section,...} command,that ...


4

A quick hack, not really customizable so far... Redefine \@seccntformat for \section, this displays the section number in the section header and add some change for \addcontentsline. \documentclass{book} \usepackage{xpatch} \usepackage{tikz} \makeatletter \renewcommand{\@seccntformat}[1]{% \ifstrequal{#1}{section}{% \shapecircle% }{% ...


4

Define \UnitLabel with an argument: \documentclass{article} \usepackage{lipsum} \usepackage{xparse} \newcounter{Unit} \NewDocumentCommand{\UnitLabel}{m}{% \makebox[4.5em][l]{Unit #1}% } \NewDocumentCommand{\Unit}{ m }{% \refstepcounter{Unit}% \section*{\UnitLabel{\Roman{Unit}}#1} \addcontentsline{toc}{section}{\UnitLabel{\Roman{Unit}}#1}% } ...


2

You can change the alignment of all section levels redefining \raggedsection. Default is \raggedright. But if you want to center the section titles do not set an indentf for it. \documentclass{scrbook} \renewcommand*\raggedsection{\centering} \RedeclareSectionCommand[ font=\fontsize{15}{10}\selectfont ]{section} \usepackage{blindtext} \begin{document} ...


3

Use \DeclareExpandableDocumentCommand -- this does not allow an optional argument at the end of the argument list, but this is no issue here! The \NewDocumentCommand version isn't expandable, see e.g. \show\UnitLabel: \UnitLabel=\protected macro: ->\makebox [4.5em][l]{Unit \Roman {Unit}}. l.25 \show\UnitLabel i.e. \UnitLabel is protected. The xparse ...


4

Do not use package titlesec together with a KOMA-Script class. It is possible to get the same format of the chapter heading using KOMA-Script commands. \renewcommand\chapterformat{% \thechapter\hspace*{20pt}\textcolor{gray75}{|}\hspace*{20pt}% } \addtokomafont{chapter}{\Huge\rmfamily} Additional remarks: Use the new syntax for option ...


2

Here is a solution (I used erewhon, a clone and extension of Adobe Utopia). \documentclass{book} \usepackage[utf8]{inputenc} \usepackage{geometry} \usepackage[explicit]{titlesec} \usepackage{array, graphicx} \usepackage[tracking=true]{microtype} \usepackage{fourier, erewhon} \usepackage{lipsum}% just to generate text for the example ...


1

It's wrong to use center to begin with. In the following example I used the PDF for another answer; in the second page I added the same heading, in order to see that they're typeset in the same way. \documentclass[12pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[brazilian]{babel} ...


3

Here's a way if para means \section etc. (In this case, \thesection does not need to be changed). The (aa) numbering can be obtained by \alphalph and increasing the subparagraph number by 26 only virtually. I've provided a enumitem way in case a list is actually meant. In case of the \section - version -- I don't recommend this numbering/labelling style ...


1

Here are two ways -- with mdframed and tcolorbox -- the numbers are bold, as well as the title by default (in book) \documentclass{book} \usepackage[x11names]{xcolor} \usepackage{mdframed} \usepackage[most]{tcolorbox} \setcounter{secnumdepth}{3} \begin{document} \chapter{Foo} \section{Foo} \subsection{Foo} \begin{mdframed}[backgroundcolor=lightgray] ...


4

A simple solution is to gobble math with \pdfstringdefDisableCommands: \documentclass{article} \usepackage{hyperref} \makeatletter \pdfstringdefDisableCommands{\let\(\fake@math} \newcommand\fake@math{}% just for safety \def\fake@math#1\){[math]} \makeatother \begin{document} \section{\(I\) cast warnings but I wish I wouldnt} ...


1

Using \renewcommand{\thesection}{\arabic{section}} is similar to \makeatletter \renewcommand{\thesection}{\@arabic\c@section} \makeatother so use the former. Sectional numbering is defined recursively by default, meaning that if its removed from \section, it'll be removed from \subsection, \subsubsection, ... However, the chapter number may show ...



Top 50 recent answers are included