Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to create something like the images I have below:

this

( I couldn't draw well the chapter number and its font)

and

this

( I couldn't draw well the page number)

--------------UPDATE According to Gonzalo Medina answer---------------------

\documentclass[a4paper,12pt,oneside]{report} 

\usepackage{fontspec}
\usepackage{xunicode}

\setmainfont{Times New Roman}
\usepackage{polyglossia}
\setmainlanguage{greek}
\setotherlanguage{english}
\usepackage{fixltx2e} %to use  _ and ^
\usepackage{url}
\usepackage{indentfirst}
\usepackage{wrapfig} % for wrapping graphics with text
\usepackage{float} % for images
\usepackage[a4paper,left=2cm,top=2.5cm,right=2cm,bottom=2.5cm]{geometry}
\usepackage{graphicx, amsmath, lettrine,amssymb}
\usepackage{fancyhdr,verbatim}
\usepackage{rotating,appendix}
\usepackage{ucs}
\usepackage{longtable} 
\usepackage{listings} 
\usepackage{caption}
\usepackage{capt-of}
\usepackage{underscore} %in order to use __
\usepackage{hyperref} % to make hyperlinks

 %----------------------------for changing the chapter format-------------------
\usepackage[explicit]{titlesec}
\usepackage{tikz}

\titleformat{\chapter}[display]
  {\Huge\scshape}
  {\filleft\tikz\node[fill=green!50!black!10,rectangle,rounded corners=6pt] (chap) {\chaptertitlename};}
  {0ex}
  {\colorbox{green!50!black!10}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\vskip1ex#1\vskip1ex}}}



%-------------------------------------------------------------------------------






\begin{document}

\thispagestyle{empty}

\renewcommand{\chaptername}{}
\newcommand{\EN}[1]{\foreignlanguage{english}{#1}} %in order to write english as \EN{Some words in English}

\addtocontents{toc}{\protect\thispagestyle{empty}} %to remove numbering the page from table of contents (ToC)
\tableofcontents
\thispagestyle{empty}


\chapter*{Preface}

\thispagestyle{empty}
\indent some text

\chapter {Chapter 1}

\textbf {\LARGE Intro}

\setcounter{page}{1}

\section {History}

\indent     Some text ggttg


\section {Another}

\indent    some text



\chapter {Chapter 2}

\textbf {\LARGE Two}
\section {History2}

\indent     text
\end{document}

Using the above code i receive this image

I want that image

Also,for the second layout ,almost the same.It shows "1:Chapter 1" instead of "1:Intro". All i want is at every page (except from the first page of each chapter) to show the page number and the title of that chapter

share|improve this question
    
I don't understand. You say you want to remove the chapter numbering and yet your drawings are showing the chapter number? Do you want the chapter number or not? –  Gonzalo Medina Sep 18 '12 at 18:13
add comment

1 Answer

up vote 8 down vote accepted

Here's one possibility using the titlesec package: according to comments, the chapter number had to be removed. Also, there's no need to use the redefinition for \@makechapterhead; all formatting aspects can be modified/controlled in an easier way using \titleformat:

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{tikz}

\titleformat{\chapter}[display]
  {\Huge\scshape}
  {\filleft\tikz\node[fill=green!50!black!10,rectangle,rounded corners=6pt] (chap) {\chaptertitlename};}
  {0ex}
  {\colorbox{green!50!black!10}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\vskip1ex#1\vskip1ex}}}

\begin{document}

\chapter{A Test Chapter}

\end{document}

enter image description here

For the second layout, you can do something like the following (I should mention that having the page number in the chapter heading seems a little strange):

\documentclass{book}
\usepackage[explicit]{titlesec}
\usepackage{tikz}

\titleformat{\chapter}[display]
  {\Large\scshape}
  {}{0ex}
  {\colorbox{green!50!black!10}{\colorbox{green!50!black!20}{\parbox{1cm}{\thepage}}\parbox{\dimexpr\textwidth-2\fboxsep-1cm\relax}{\filcenter\vskip1ex\chaptername~\thechapter: #1\vskip1ex}}}

\begin{document}

\chapter{A Test Chapter}

\end{document}

enter image description here

After comments added to the original question, I think that now I know what was requested: the following example shows a modification of the formatting for chapter headings and also a modification to the headers achieved with the help of the fancyhdr package:

\documentclass[a4paper,12pt,oneside]{report} 
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage[explicit]{titlesec}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{lipsum}% just to generate filler text for the example

 %----------------------------for changing the chapter format-------------------
\titleformat{\chapter}[display]
  {\LARGE\scshape\bfseries}
  {\filleft\tikz\node[fill=green!50!black!10,rectangle,rounded corners=6pt] (chap) {\chaptertitlename~\thechapter};}
  {0ex}
  {\colorbox{green!50!black!10}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\vskip1ex#1\vskip1ex}}}

 %----------------------------for changing the header-------------------
\fancyhf{}
\fancyhead[L]{\colorbox{green!50!black!10}{\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\colorbox{green!50!black!40}{\thepage:} \leftmark}}}
\renewcommand\headrulewidth{0pt}
\setlength\headheight{24pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{% 
  \markboth{#1}{}} 

\makeatletter
\let\ps@plain\ps@empty
\makeatother

\begin{document}

\tableofcontents

\chapter {Intro}
\section {Another}
\lipsum[1-15]
\chapter {Two}
\section {History2}
\lipsum[1-15]

\end{document}
share|improve this answer
    
:Ok,that's good.At the above,i want Chapter 1 to be in the same font as the"A Test Chapter".The line i draw is just a kind of frame.If i can add this kind of line (semi cycle) it will be perfect.If not,i want a frame. –  George Sep 18 '12 at 17:51
    
Gonzalo Medina:At the second draw the number is the page number.The line is just a frame (as the previously). –  George Sep 18 '12 at 17:52
    
@George I updated my answer. Is it something like that what you want for the first layout? For the second one I still have a doubt; the page number goes framed and to the left and the heading goes centered or flushed right? –  Gonzalo Medina Sep 18 '12 at 18:08
    
:Thanks for the help.I also updated because your code doesn't work good.From the first layout i just want to fill the frame with the same color.As for the second , the page number goes framed and the heading either center or left or right. –  George Sep 18 '12 at 18:13
1  
@George sorry, but that error with \usepackage[T1]{fontenc} is from elsewhere in your code not mine; my code doesn't use \nobreakspace, and I can't guess what are you doing. If you want, add to your question a minimal document showing your current settings; otherwise, we will waste valuable time redoing code. –  Gonzalo Medina Sep 18 '12 at 18:43
show 14 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.