I have made a fancy title page using titleformat
and tikz
, but I now face the following problem. The \chaptertitlename
command returns \chaptername
or \appendixname
. I would like to spread the letters of the text returned by \chaptertitlename
to a given length.
For example I would like to be able to call:
\mycommand{\chaptertitlename}{3cm}
in order to space the letters of \chaptertitlename
on a total length of 3cm
. How to do that ?
EDIT:
This example illustrates a nearly working thing:
\documentclass[11pt]{article}
\usepackage{fontspec}
\newcommand{\spreadletters}[2]{\makebox[#2][s]{#1}}
\begin{document}
\spreadletters{m y w o r d}{3cm}
\end{document}
How to convert myword
to m y w o r d
?
EDIT 2:
Can someone explain me why the first work and not the second one (and how to make it work) ?
\documentclass[11pt]{book}
\usepackage{fontspec}
\usepackage{seqsplit}
\usepackage[explicit]{titlesec}
\newcommand{\spreadletters}[2]{\makebox[#2][s]{\seqsplit{#1}}}
\begin{document}
\chapter{First}
\spreadletters{myword}{10cm} \linebreak % This is working
\spreadletters{\chaptertitlename}{10cm} % This is not working
\end{document}
Best Answer
Using Paul Stanley's answer to your question Conditions for fancy chapter title, here's a way: