
En el MWE a continuación, arreglé la posición del título del capítulo (en este caso solo necesito el número) de manera que esté en la esquina tocando el margen. ¿Cómo elimino completamente el espacio creado a su alrededor, de modo que el texto comience en el lugar como si no hubiera ninguna 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}
Respuesta1
También cambie el \titlespacing
de \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}
Pero, si solo desea el número y tampoco el encabezado ni la entrada ToC, simplemente puede colocar el tikzpicture
sin 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}
o con entrada ToC y cabezal móvil:
\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}