Remova completamente o espaçamento dos capítulos

Remova completamente o espaçamento dos capítulos

No MWE abaixo, organizei a posição do título do capítulo (neste caso só preciso do número) de forma que fique no canto tocando a margem. Como faço para remover completamente o espaçamento criado em torno dele, de modo que o texto comece no local como se não houvesse nenhuma entrada de capítulo?

\documentclass[12pt, oneside]{book}
\usepackage[showframe, paperwidth=30pc, paperheight=30pc, margin=5pc]{geometry}
\usepackage{tikz}
\usepackage{titlesec}

\titleformat{\chapter}
  [block]% shape
  {\filcenter\bfseries\large}% format applied to label+text
  {}% label
  {0pt}% horizontal separation between label and title body
  {\maketitleframe{\thechapter}}% before the title body
  \titlespacing{\chapter}{0pt}{0pt}{0pt}

\newcommand{\maketitleframe}[2]{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[draw, rectangle, minimum size=5pc, yshift=-2.5pc, xshift=2.5pc] at (current page.north west) {#1};
  \end{tikzpicture}% before the title body
}

\begin{document}
\chapter{}
test
\end{document}

insira a descrição da imagem aqui

Responder1

Altere também o \titlespacingde \chapter:

\documentclass[12pt, oneside]{book}
\usepackage[showframe, paperwidth=30pc, paperheight=30pc, margin=5pc]{geometry}
\usepackage{tikz}
\usepackage{titlesec}

\titleformat{\chapter}
  [block]% shape
  {}% format applied to label+text
  {}% label
  {0pt}% horizontal separation between label and title body
  {\maketitleframe{\thechapter}}% before the title body
\titlespacing{\chapter}{0pt}{0pt}{-2\baselineskip}

\newcommand{\maketitleframe}[2]{%
  \begin{tikzpicture}[overlay,remember picture]
    \node[draw, rectangle, minimum size=5pc, yshift=-2.5pc, xshift=2.5pc] at (current page.north west) {#1};
  \end{tikzpicture}% before the title body
}

\begin{document}
\chapter{}
test
\end{document}

uma página

Mas, se você quiser apenas o número e também sem cabeçalho e nenhuma entrada de ToC, você pode simplesmente colocar tikzpicturesem usar \chapter:

\documentclass[12pt, oneside]{book}
\usepackage[showframe, paperwidth=30pc, paperheight=30pc, margin=5pc]{geometry}
\usepackage{tikz}

\newcommand*{\chapternum}{%
  \clearpage
  \refstepcounter{chapter}%
  \begin{tikzpicture}[overlay,remember picture]
    \node[draw, rectangle, minimum size=5pc, yshift=-2.5pc, xshift=2.5pc] at (current page.north west) {\thechapter};
  \end{tikzpicture}%
  \ignorespaces
}

\begin{document}
\chapternum
test
\end{document}

ou com entrada ToC e cabeçalho em execução:

\documentclass[12pt, oneside]{book}
\usepackage[showframe, paperwidth=30pc, paperheight=30pc, margin=5pc]{geometry}
\usepackage{tikz}

\newcommand{\chapternum}[1]{%
  \clearpage
  \refstepcounter{chapter}%
  \chaptermark{#1}%
  \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}%
  \begin{tikzpicture}[overlay,remember picture]
    \node[draw, rectangle, minimum size=5pc, yshift=-2.5pc, xshift=2.5pc] at (current page.north west) {\thechapter};
  \end{tikzpicture}%
  \ignorespaces
}

\begin{document}
\tableofcontents
\chapternum{}
test
\chapternum{ToC Entry and Head}
test
\clearpage
test
\clearpage
test
\end{document}

informação relacionada