# Show chapter numbers (or letters rather) with \frontmatter

I use the extbook-class and need to use \frontmatter and \mainmatter. However, the chapters numbers within \frontmatter does not display (as expected). But I would like them to be shown (and as letters, rather than numbers (A, B, ...)).

The chapters in \mainmatter are shown as normal numbers, so all is fine there.

As you can see, I use \renewcommand{\thechapter}{\Alph{chapter}} to set the chapters to letters within \frontmatter (and then set it to arabic again within \mainmatter). I suppose that part is correct. All I need now is to actually display the chapter letters in \frontmatter.

(I use a fancy tikz style-thingie for the chapters, but that works fine as long as there is a chapter number or chapter letter.)

EDIT: Ulrike Fischer suggested to use \pagenumbering{roman} instad of \frontmatter. This is a solution I've tried before. And while it does show the chapters (A and B) correctly within the book itself, bookmarks (as seen in pdf viewers) becomes strange. (Meaning printing the book would be fine, but not using it as a pdf file). Roman and arabic numbers are mixed as can be seen here: https://imgur.com/a/9HhQfPZ

In this example, chapter 1 and 2 get roman numbers, while 3 and 4 get arabic numbers. When writing longer documents, I also get roman numbers for subsections in chapter 1 and 2.

This is the code: \documentclass[14pt]{extbook} \usepackage[top=2cm,bottom=2cm,left=3cm,right=2.4cm,headsep=24pt,a4paper]{geometry} % Page margins

\usepackage{mathtools} % for math stuff

\usepackage{hyperref}
\usepackage{bookmark}

\usepackage{xcolor}
\definecolor{myBlue}{RGB}{0,77,153}
\usepackage[explicit]{titlesec}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage{tikz}

\titleformat{\chapter}[display]
{\normalfont\bfseries\color{black}}
{\filleft%
\begin{tikzpicture}
\node[ % the square
outer sep=0pt,
text width=2.5cm,
minimum height=3cm,
fill=myBlue,
font=\color{white}\fontsize{80}{90}\selectfont,
align=center
] (num) {\thechapter};
\node[ % this is the title of the chapter (sent as argument #1)
anchor=south east,
font=\color{black}\Large\normalfont
] at ([yshift=-70pt, xshift=88pt]num.west) {\textls[180]{\textsc{#1}}};
\end{tikzpicture}
}
{10pt}
{\titlerule[2.5pt]\vskip3pt\titlerule\vskip4pt\LARGE\sffamily}

\begin{document}
% =========== TOC, Chapter A and B ==============
\pagenumbering{roman}
%\frontmatter
\renewcommand{\thechapter}{\Alph{chapter}}

\chapter{Init A}
This is supposed to be chapter A. Blablabla.
\chapter{Init B}
This is supposed to be chapter B. Blablabla.

\mainmatter
\renewcommand{\thechapter}{\arabic{chapter}}
\setcounter{chapter}{0}% Equivalent to "letter O"
\chapter{First chapter}
asdf
\newpage
asdf
\newpage
\section{Section of first chapter}
\section{Another section of first chapter}
\chapter{Second chapter}
asdf
\newpage
asdf
\newpage
\section{Section of second chapter}
asdf
\newpage
\section{Another section of second chapter}