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:


\spreadletters{m y w o r d}{3cm}

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) ?



\spreadletters{myword}{10cm} \linebreak % This is working
\spreadletters{\chaptertitlename}{10cm} % This is not working
  • 3
    It's difficult to gauge whether this would work, but try adding \usepackage{seqsplit} to your document preamble and use \makebox[3cm][s]{\expandafter\seqsplit\expandafter{\chaptertitlename}} where you need it.
    – Werner
    Apr 5, 2014 at 7:09
  • Could you please add a minimum (working) example to your post? It would help the solvers a lot to actually start working on it. Otherwise, we are guessing how your document looks like.
    – Malipivo
    Apr 5, 2014 at 8:20
  • 1
    \renewcommand{\chaptername}{\protect\makebox[3cm][s]{C h a p t e r}}
    – egreg
    Apr 5, 2014 at 8:31
  • @egreg Is there a way to automatically convert Chapter to C h a p t e r ?
    – Vincent
    Apr 5, 2014 at 8:39
  • 1
    @Vincent What's the problem in just typing that command in the preamble?
    – egreg
    Apr 5, 2014 at 8:45

3 Answers 3


Using Paul Stanley's answer to your question Conditions for fancy chapter title, here's a way:


  {\tikz[remember picture,overlay]
   {\node[fill=\chaptercolor,%<--- Not hardcoded color
       font=\sffamily\fontsize{96}{72}\bf\selectfont\color{white},anchor=north east, 
       minimum width=3cm, 
       minimum height=3.4cm] 
       at ([xshift=-1cm,yshift=-1cm]current page.north east) 
         (numb) {\thechapter};
           inner sep=0pt,
       at (numb.west) {\SPREAD\chaptertitlename};%<-- Not hardcoded "CHAPTER"
  {\Huge\bfseries\color{\chaptercolor}#1}%< Not hardcoded color

 {% full expand the argument
  \vincent_spread:f { #1 }
\cs_new_protected:Npn \vincent_spread:n #1
 {% with \tl_map_inline:nn we insert \hfil between letters; a final \unskip kills the last \hfil
  \makebox[3.4cm][s]{\tl_map_inline:nn { #1 } { ##1 \hfil } \unskip}
\cs_generate_variant:Nn \vincent_spread:n { f }









\chapter{Appendix Something}


enter image description here enter image description here

  • Is there a way to implement \SPREAD without expl3?
    – gigabytes
    Dec 21, 2017 at 8:50

I enclose a small Lua snippet which add spaces after letters except commas, colons and semicolons. It adds space after spaces. This is a small example.

%! lualatex mal-words.tex
%\newcommand{\spreadletters}[2]{\makebox[#2][s]{#1}} % 1. approach
%\usepackage{seqsplit} % 2. approach

%\spreadletters{my word}{3cm}\par% ->m y w o r d % 1. approach
%\makebox[3cm][s]{\expandafter\seqsplit\expandafter{my word}} % 2. approach

local malset={",", ";", ":"} -- A list of exceptions...

function spreadme(text)
print() -- just an empty line
textlength=string.len(text) -- How many characters we are dealing with?

-- The core cycle...
for i=1,textlength do
if i>1 then bonus="\\enspace " else bonus="" end -- Starting adding spaces...
malletter=string.sub(text,i,i) -- Select only one character...

-- Is a character in the list of exceptions?
for _,v in pairs(malset) do
  if v==malletter then bonus="" break end
end -- of for
tex.sprint(bonus..malletter) -- This is a way without adding \n as in print().
--io.write -- .."\\addme"
end -- of i
end -- of function spreadme

\malword{My first, second and third word!}



with the package graphicx, you can use:

  • 1
    It is a geometric transformation of the box, I wouldn't classify it as a spreading letters situation. :-)
    – Malipivo
    Apr 5, 2014 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .