GeneralReport Layout

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
cbustaam
Posts: 57
Joined: Mon Sep 01, 2008 10:17 pm

Report Layout

Post by cbustaam »

Hi all,
I need to create a document class to typeset a report, but I don't know if I can begin from a previous layout. Attached are two images which show how would be the template. The gray area contents text.
T1.JPG
T1.JPG (16.52 KiB) Viewed 5725 times
T2.JPG
T2.JPG (13.65 KiB) Viewed 5725 times
Anyone can suggest me how or from where star???
"Show me your .emacs and I'll tell you who you are." -- modified proverb

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Report Layout

Post by gmedina »

Hi,

to obtain the fancy chapter headings you can find a really nice example (that you can use as a good starting point) here:

Fancy chapter headings with TikZ - TeXblog.net

Using the titlesec package you can also achieve the desired headers/footers as well as the format for the section headings (refer to the package documentation for relevant information).

Finally, using TikZ you can also achieve the vertical lines.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
cbustaam
Posts: 57
Joined: Mon Sep 01, 2008 10:17 pm

Report Layout

Post by cbustaam »

Hi gmedina,
Thanks for your reply. The TeXBlog example was very useful. I still have two problems:

1. I want to put the section titles in blue, so I'm putting these lines

Code: Select all

\titleformat{\section}{\bfseries}{\textcolor{MidnightBlue}{\thesection.}}{1em}{}
But only appears the section number in blue, without the name. I mean, "1. " in place of "1. First sectio".

2. In the first page of each chapter I loose the footer, made with fancyhdr.

Code: Select all

\fancyfoot[LE,RO]{\colorbox{MidnightBlue}{\textcolor{White}{\small \thepage}}}
\fancyfoot[RE,LO]{\textcolor{Gray}{\scriptsize Report}}
But only appears page number centered, and not the the page number in a blue box aligned at one side, and the word "Report" in the other side. How can I fix it?

Bests regards
"Show me your .emacs and I'll tell you who you are." -- modified proverb
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Report Layout

Post by gmedina »

cbustaam wrote:...1. I want to put the section titles in blue, so I'm putting these lines

Code: Select all

\titleformat{\section}{\bfseries}{\textcolor{MidnightBlue}{\thesection.}}{1em}{}
But only appears the section number in blue, without the name. I mean, "1. " in place of "1. First sectio".
You can use something like this:

Code: Select all

\titleformat{\section}
  {\color{MidnightBlue}}{\thesection}{1em}{}
(The above code requires the xcolor package with svgnames option).
cbustaam wrote:...2. In the first page of each chapter I loose the footer, made with fancyhdr.

Code: Select all

\fancyfoot[LE,RO]{\colorbox{MidnightBlue}{\textcolor{White}{\small \thepage}}}
\fancyfoot[RE,LO]{\textcolor{Gray}{\scriptsize Report}}
But only appears page number centered, and not the the page number in a blue box aligned at one side, and the word "Report" in the other side. How can I fix it?
The standard classes (book, report) assign the plain page style to the first page of chapters. If you want this style also to be fancy, you can add this

Code: Select all

\makeatletter
  \let\ps@plain\ps@fancy
\makeatother
to the preamble of your document. Please notice that now the plain style will behave exactly as the fancy style, throughout the document.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
cbustaam
Posts: 57
Joined: Mon Sep 01, 2008 10:17 pm

Report Layout

Post by cbustaam »

Hi gmedina
Thanks for your suggestions. The second one works perfect, but the first one doesn't work.

I tried this:
You can use something like this:

Code: Select all

\titleformat{\section}
  {\color{MidnightBlue}}{\thesection}{1em}{}
(The above code requires the xcolor package with svgnames option).

But it doesn't work, and still appears "1.1. " in place of "1.1. Section title". I think that this could happend because this part "{\thesection}", so I added "{\thesection \sectionmark}", but LaTeX saids "ERROR: Argument of \sectionmark has an extra }.". How can I solve it?

Bests
"Show me your .emacs and I'll tell you who you are." -- modified proverb
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Report Layout

Post by gmedina »

cbustaam wrote:Hi gmedina...But it doesn't work, and still appears "1.1. " in place of "1.1. Section title"...
Bests
That's unusual. The following sample code (that uses my recommendation) produces the desired effect (as can be seen in the obtained pdf file attached):

Code: Select all

\documentclass{report}
\usepackage[svgnames]{xcolor}
\usepackage{titlesec}

\titleformat{\section}
  {\color{MidnightBlue}}{\thesection}{1em}{}

\begin{document}

\chapter{Test chapter}
\section{Test section}

\end{document}
If the above code doesn't work for you, we will need to see the relevant parts of your actual code. In that case, please post here a minimal working example (MWE) that allows us to reproduce the odd behaviour described (instructions on how to buil such a MWE can be found following the link I just provided).
Attachments
test.pdf
(9.57 KiB) Downloaded 310 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
cbustaam
Posts: 57
Joined: Mon Sep 01, 2008 10:17 pm

Report Layout

Post by cbustaam »

The code you provide works well, so something is wrong in my code. There is an MWE:

Code: Select all

\documentclass[svgnames,twoside,12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm} % margenes
\usepackage{tikz}
\usepackage{kpfonts}
\usepackage[explicit]{titlesec}
\usepackage{multicol}
\usepackage{lipsum} 
\renewcommand{\chaptername}{Capitulo} 
\setlength{\parskip}{10pt}

\setlength\columnseprule{1pt} 
\setlength\columnsep{1cm} 

\renewcommand{\chaptermark}[1]{\markleft{\thechapter.\ #1}{}}
\usepackage{fancyhdr}
\usepackage{calc}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RE]{\textcolor{Gray}{\scriptsize \textsc{Report}}} 
\fancyhead[LO]{\textcolor{Gray}{\scriptsize \nouppercase{\leftmark}}}
\fancyfoot[LE,RO]{\colorbox{MidnightBlue}{\textcolor{White}{\small \thepage}}}
\fancyfoot[RE,LO]{\textcolor{Gray}{\scriptsize \textsc{Date}}}
\makeatletter
  \let\ps@plain\ps@fancy 
\makeatother
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\titleformat{\section}{\color{MidnightBlue}}{\thesection}{1em}{}

\titlespacing*{\section}{0pt}{50pt}{0pt}

\titleformat{\chapter}
  {\gdef\chapterlabel{}
   \normalfont\sffamily\Huge\bfseries\scshape}
  {\gdef\chapterlabel{\thechapter.\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=white!70!gray] (0,0) rectangle
          (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=20pt,inner sep=11pt,
              fill=MidnightBlue]
              {\color{white}\chapterlabel#1};
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }
\titlespacing*{\chapter}{0pt}{50pt}{10pt}

\begin{document}

\chapter{The very first chapter}

\section{First section}
\lipsum[1-2]

\begin{multicols}{2}
  \lipsum[1-4]
\end{multicols}

\section{Section number two}
\lipsum[1]

\end{document}
"Show me your .emacs and I'll tell you who you are." -- modified proverb
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Report Layout

Post by gmedina »

Hi,

just to be sure... maybe you do not have the kpfonts package installed. Comment out the line loading that package (i.e., add a "%" symbol as in %\usepackage{kpfonts}) and compile the document.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
cbustaam
Posts: 57
Joined: Mon Sep 01, 2008 10:17 pm

Re: Report Layout

Post by cbustaam »

The kpfots package is installed. Althought, I comment the line tha load the package, but the result is the same.
"Show me your .emacs and I'll tell you who you are." -- modified proverb
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Report Layout

Post by gmedina »

Yes, you are right; the problem was not the kpfonts package. The problem comes from using the explicit package option for titlesec; as the package documentation (page 8) mentions, with this option the title must be given explicitly with #1, so you must use something like the following:

Code: Select all

\titleformat{\section}{\color{MidnightBlue}}{\thesection}{1em}{#1}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply