I need to cut the chapter title that appears at page headers.
I'm developing a latex generator software (http://github.com/caelum/tubaina, new contributors are welcome!), and because of implementation issues I can't simply use \chaptermark to create an arbitrary title for the header. I've tried using \StrLeft from xstring but didn't work for me.
Here is the latex code that produces the output that I would like to see, but in a way I can't use:
\documentclass[a4paper, 11pt, twoside]{book}
\usepackage{fancyhdr}
\usepackage{xstring}
\usepackage{lipsum}
\begin{document}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[LO,RE]{\footnotesize{Publisher Name}}
\fancyhead[LE]{\scriptsize{\nouppercase{\rightmark}}}
\fancyhead[RO]{\scriptsize{\nouppercase{\leftmark}}}
\fancyfoot[RO,LE]{\thepage}
}
\pagestyle{plain}
%% This doesn't work
% \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ \StrLeft{#1}{5}}{}}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}{}}
\chapter{Very long long long long long long long long long long long long long long chapter title}
%% This also doesn't work
% \chaptermark{\StrLeft{chapter mark lalala lalala}{5}}
%% This works and that's the way I would like to the
%% title appear, but I can't use it for other reasons...
\chaptermark{Very long long...}
\section{Section name}
\lipsum
\end{document}
Is there any another way to do that?
