1

Writing a book of probability in arabic, and using the titleps package for the headpage, I obtain some non-beautiful result when there is in the headings some "long-down" letters like the arabic letter ع , for example, where the rule touch some letters. So I want to push down the rule of heading with 1pt or 2, to obtain a best heading. How I can I do this? I give an example to watch you the effect.. enter image description here

I use titleps and this is my page style..

\newpagestyle{Mybookstyle}{
  \setheadrule{.1pt}% Header rule
  \sethead
  [\thepage\hspace*{14pt}\thetitle]% even left
    []% even centre
    [\sectiontitle \hspace*{5pt} .\thesection]% even right
{الباب          
    \arabic{chapter}. 
    \chaptertitle}% odd left
    {}% odd centre
    {\thepage}% odd right
} 
  • Could you provide a MWE? are you using fancyhdr? – Ryan Dec 03 '14 at 06:56
  • If you could use fancyhdr instead of titleps this may help. http://tex.stackexchange.com/q/85178/24974 – erik Dec 03 '14 at 06:58
  • I have edit this comment in the body message.you can find my comments for heading. – Faouzi Bellalouna Dec 03 '14 at 07:03
  • You might want to check out fancyhdr, it's pretty powerful for more complex headers and in my experience it's easier to work with. – Ryan Dec 03 '14 at 07:07
  • How do you control page size features? With the package geometry, there is the option headheight=<length>, which might do the trick (e.g., \usepackage[headheight=14pt, <other options>]{geometry}). Some classes, such as memoir or the KOMA classes have their own built-in facilities for such things. – jon Dec 03 '14 at 07:07
  • I try to delete the last comment and write the heading style in the body of the message. – Faouzi Bellalouna Dec 03 '14 at 07:09
  • For the package fancyhdr. I tried it but I use titleps because I need the use of titletoc and titlesec, and the 3 packages seem to be a "subpackages of a bigger one"... – Faouzi Bellalouna Dec 03 '14 at 07:13
  • @jon I will try the package geometry and see the effect... – Faouzi Bellalouna Dec 03 '14 at 07:15
  • @jon The command \usepackage[headheight=14pt]{geometry} gives a better result and I hope that there'snt interferences with my other packages. Other thing.. 14pt is better but not 13pt nor 15pt.. I'll read the doc of geometry to understand the command "headheight="... – Faouzi Bellalouna Dec 03 '14 at 07:30
  • I tried to compile all the book and there's any problem with the package geometry. Thanks for all – Faouzi Bellalouna Dec 03 '14 at 08:03

1 Answers1

3

Add this in the definition of Mybookstyle:

\renewcommand{\makeheadrule}{\rule[-0.4\baselineskip]{\linewidth}{0.1pt}}%

You can remove \setheadrule{.1pt} since this is incorporated in the above command. The default optional argument to \rule is 0.3\baselineskip, and you can change it to whatever you want.

You can define as many page styles as you please and use them in the document (of course at appropriate places). Here is an explicit example: \documentclass[a4paper,12pt,twoside,openany]{book}% \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{erewhon} \usepackage{xcolor} \usepackage[pagestyles, clearempty]{titlesec}

 \newpagestyle{Mybookstyle}{%
\renewcommand{\makeheadrule}{\rule[-0.8\baselineskip]{\linewidth}{0.1pt}}%
 \sethead
 [\thepage]% even left
 []% even centre
 [\sectiontitle\enspace\thesection]% even right
 { \arabic{chapter}.\enspace\chaptertitle}% odd left
 {}% odd centre
 {\thepage}% odd right
 }%
 \newpagestyle{Otherbookstyle}{%
\renewcommand{\makeheadrule}{\rule[-0.8\baselineskip]{\linewidth}{0.1pt}}
 \sethead
 [\thepage]% even left
 []% even centre
 [\color{red}\sectiontitle\enspace\thesection]% even right
 { \arabic{chapter}.\enspace\chaptertitle}% odd left
 {}% odd centre
 {\thepage}% odd right
 }%
\pagestyle{Mybookstyle}

\begin{document}

\chapter{Les lois discrètes}
\newpage
\section{Définition et propriété}
\newpage
\section{Propriété et Définition}
\newpage\pagestyle{Otherbookstyle}
\section{Exercises}

\end{document} 

enter image description here

enter image description here

Bernard
  • 271,350
  • would you give me the entire command. I tried to write

    \AtBeginDocument{\renewcommand{\makeheadrule}{\rule[-0.4\baselineskip]{\linewidth}{0.1pt}}}%

    in the beginning of the document and it has absolutely no effect..

    – Faouzi Bellalouna Dec 03 '14 at 10:59
  • It should be in the definition of your page style. See my updated answer. – Bernard Dec 03 '14 at 11:09
  • with this command I have "AtBeginDocument" in the first page.. are you sure that it isn't \Atbegindocument ? – Faouzi Bellalouna Dec 03 '14 at 11:24
  • I'm sure. Please see an exaggerated example in my updated answer. I couldn't use the whole of your page style because I haven't installed arabxetex. – Bernard Dec 03 '14 at 13:16
  • Hello All is ok. I have tried it and we can play with this command \rule[-0.3\baselineskip] as we want. Thank you – Faouzi Bellalouna Dec 03 '14 at 14:26
  • "Ah j'ai crié victoire trop tôt" !!.. There's a problem in compilation...not fatal but... The command \pagestyle{Mybookstyle} is only accepted in the preamble...but I use several pagestyles: one for the main file, one for exercises, one for solutions, Mymainstyle, myexostyle,mysolstyle... I have tried instead the command \renewpagestyle{myexostyle} after \begin{document} and (a miracle) it's ok so it's accepted.. The problem is that I have a lot of files where I must change \pagestyle by \renewpagestyle... Is there another solution ? – Faouzi Bellalouna Dec 03 '14 at 19:38
  • Other thing. The command \section*{A section} is written "normally", i.e. not as a section, not bold and in the same magnification of teh other characters...14 pt – Faouzi Bellalouna Dec 03 '14 at 20:26
  • 1
    @Faouzi Bellalouna: This was due to the use of \AtBeginDocument. Actually, it was unnecessary, so I removed it and you can see in my updated answer an example of a page style change mid-document. For the ‘other thing’, I'm not sure I understand whether you speak of the section* formatting or of the section* headers. – Bernard Dec 03 '14 at 22:52