8 votes

Titlespacing command not working for \subsection and also causing error for \section

You get ! Undefined control sequence. <argument> ...on\endcsname \protect \@secnumpunct l.9 \section{Main section} % <- This line triggers the error ? ! Undefined ...
egreg's user avatar
  • 1.1m
6 votes

How to fix titlesec overriding contentsname

Since \tableofcontents issues a \chapter* - a numberless chapter - you can specify a numberless \titleformat, where you remove all the content related to the numbering (like the Module \thechapter: ...
Werner's user avatar
  • 602k
5 votes

Make a specific style for chapters using titlesec

Here is my solution. In the .cls file, I keep the xcolor package. It isn't needed as tikz provide access to colors, but so, we can use global option like divpsnames in the document class for accessing ...
quark67's user avatar
  • 4,146
4 votes
Accepted

How can I use titlesec to put a tcolorbox around a section title?

You may want to use load the tcolorbox packge with the explicit option, which allows you to use #1 as placeholder for the section title in the defintion of the \section command. Also, I think the ...
Jasper Habicht's user avatar
4 votes
Accepted

How to fix titlesec overriding contentsname

Delay to after \tableofcontents. \documentclass{report} % This is the code that changes the title \usepackage[explicit, compact]{titlesec} \begin{document} \tableofcontents \titleformat{\chapter}[...
user691586's user avatar
  • 1,978
4 votes
Accepted

How can I break lines in a TikZ node used for \paragraph{…}

You are generating your \paragraph titles using TikZ. To automatically allow line breaks in a TikZ \node, you just have to set the allowed text width. For multi-line nodes, also using todotted.south ...
cabohah's user avatar
  • 10.8k
4 votes
Accepted

Can't get Appendix before A on TOC, when using appendix package with titlesec and titletoc

Borrowing heavily from two other answers on the site Unexpected interaction of titletoc and appendix? Properly aligning TOC entries using titletoc The following seems to do what you want: \...
Alan Munn's user avatar
  • 218k
4 votes
Accepted

References using nameref disappeared after titlesec update

Hm, titlesec fixed the case, when the \label is in the section argument, but broke the case when it is outside. Make a bug report at https://github.com/jbezos/titlesec/issues \documentclass{article} \...
Ulrike Fischer's user avatar
4 votes
Accepted

Automatic Chapter or Section Title in Bold face and Small Caps

As already told in Will's answer to the question vou've linked, you should not use \sc, because this deprecated font command does also deactivate the previous \bfseries. Use \scshape instead: \...
cabohah's user avatar
  • 10.8k
4 votes

Titlesec with tikz

A solution is to use the option explicit for the package titlesec. Then the title can be obtained with #1. The command \thechapter is moved to the \node where #1 is placed. \documentclass[12pt, ...
matexmatics's user avatar
  • 3,754
3 votes
Accepted

Insert \par in after-code of a titleformat command

Use \endgraf. \documentclass{book} \usepackage{titlesec,titletoc} \titleformat{\part}[display] {} {\centering\huge\bfseries\partname~\thepart} {0pt} {\centering\huge} [{\normalsize \hspace{-\...
user691586's user avatar
  • 1,978
3 votes
Accepted

Possible babel latvian and titlesec conflict?

The package isn't correctly checking if the class has chapters. Simplest workaround is just to define an unused chapter counter. \documentclass[12pt]{article} \usepackage[latvian]{babel} \usepackage{...
David Carlisle's user avatar
3 votes
Accepted

Make a specific style for chapters using titlesec

Partial response the different spacing on the right and left sides, Overfull \hbox (1.22324pt too wide) I added \titlecontents{section} [0em] {} {} {} {\titlerule*[1pc]{.}\contentspage} I also ...
pascal974's user avatar
  • 4,317
3 votes

Indent chapter title with titlesec

The following is much simpler than egreg's solution. You just have to delete [block]! \documentclass[a4paper]{book} \usepackage{fontspec} \usepackage{titlesec} \newfontfamily{\futura}{Futura} \...
hair-splitter's user avatar
3 votes
Accepted

Two texts with the same width on two different lines, but with different font sizes

\documentclass{article} \usepackage{graphicx} \begin{document} \begin{center} \bfseries\sffamily \resizebox{12cm}{!}{A LONG TEXT FOR TITLE} \medskip \resizebox{12cm}{!}{AND A SMALL} \end{center} ...
David Carlisle's user avatar
3 votes

How to redefine \section to include "long-title" in the ToC?

Instead of using \section explicitly, define a suitable command, here \lecture. \documentclass[a4paper,12pt]{article} \usepackage{subcaption} % ----- Packages -----------------------------------------...
egreg's user avatar
  • 1.1m
3 votes
Accepted

How to center \S section in document and at header?

Don't load both sectsty and titlesec, they fight each other. If you want centered headers, tell so fancyhdr, using the C slot. I also removed the clumsy and deprecated \fancyplain part: the package ...
egreg's user avatar
  • 1.1m
3 votes
Accepted

Titlesec with tikz

The trick is that the final part in the last mandatory argument to \titleformat is passed the title as an argument. Borrowing the code from matexmatics \documentclass[12pt, oneside]{book} \usepackage[...
egreg's user avatar
  • 1.1m
3 votes

a problem when using ```\usepackage{sectsty}``` and ``` \usepackage{titlesec}```

It's my experience that loading both sectsty and titlesec can lead to unexpected outcomes, to put it politely. AFAICT, there's never a good reason for loading both packages. Choose one or the other, ...
Mico's user avatar
  • 503k
3 votes
Accepted

How does \ifthesection of titleps work?

This behavior is described in the manual (page 4): 5. Marks Marks can be retrieved in 4 ways: top marks If a page begins with text, they are the marks belonging to the sectioning unit of that text. ...
Marijn's user avatar
  • 37.2k
3 votes
Accepted

Remove chapter spacing completely

Also change the \titlespacing of \chapter: \documentclass[12pt, oneside]{book} \usepackage[showframe, paperwidth=30pc, paperheight=30pc, margin=5pc]{geometry} \usepackage{tikz} \usepackage{titlesec} \...
cabohah's user avatar
  • 10.8k
3 votes
Accepted

Modifying a known titlesec macro for chapters for variable length rule

The last argument to \titleformat can be a command, to which the chapter title is passed as the last argument. So we can distinguish between numbered and unnumbered chapters. The “Chapter N” bit is ...
egreg's user avatar
  • 1.1m
2 votes
Accepted

Section Title: Colored Box with and without Label

You should change the shape to block which allows for typesetting in vertical mode. I streamlined some minor parts of your code: \documentclass[10pt]{article} \usepackage[a4paper, left=35mm, right=...
Jasper Habicht's user avatar
2 votes
Accepted

How can write "Chapter" in upper case and center of the page in report class?

If your formatting objective is to center-set the chapter header and get it typeset in bold, and if you don't want to change any other aspects of the header (such as the font and font size), I suggest ...
Mico's user avatar
  • 503k
2 votes

\makebox inside 3rd argument of \setfoot generates error

This is a bug in macro \ttl@duplthreeargs which does #1#2#3#4->#1[#2][#3][#4]{#2}{#3}{#4} but should do #1#2#3#4->#1[{#2}][{#3}][{#4}]{#2}{#3}{#4} or at least for #4, as the ][ delimiters are ...
user691586's user avatar
  • 1,978
2 votes

Custom Chapter Headings

Apparently, half an hour of googling didn't help, but the 'Related' answers did. How can I hide the chapter headings number on LaTeX and change the spacing? This was exactly what I needed.
swingwise's user avatar
2 votes
Accepted

Don't print the part name in the part's title

The before-code can take the title as an argument and do something with it, for example gobble it: \documentclass{book} \makeatletter \title{The Book Title} \let\thetitle\@title \usepackage{titlesec} ...
Ulrike Fischer's user avatar
2 votes
Accepted

Issues on length and position of tikz boxes in titlesec

Use text width={\linewidth-12pt} to get a node with appropriate width, because you need to subtract twice the inner sep of 6pt. Also, better not place \hspace inside the \tikz command. Note that a ...
Jasper Habicht's user avatar
2 votes
Accepted

How to reduce the space between the title and the first heading?

I wouldn't use titlesec to change that space. If you redefine the section command, this will change all sections, not just the first one. Instead I would use a negative space to hide the room which ...
samcarter_is_at_topanswers.xyz's user avatar
2 votes
Accepted

Supposed missing brackets

\uppercase\romannumeral\thechapter is wrong: \uppercase needs to see a brace delimiting the tokens to be converted to uppercase. You might do it with correct syntax as \uppercase\expandafter{\...
egreg's user avatar
  • 1.1m

Only top scored, non community-wiki answers of a minimum length are eligible