Page Layout\c@section problem

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
robertoneto123
Posts: 13
Joined: Thu Sep 25, 2008 1:20 pm

\c@section problem

Post by robertoneto123 »

Hello,

I'm trying to get the following code to work. But the command \c@section simply does not work. I'm unable to get the section number using \the\c@section as well. I want to apply the layout if the section number is greater or equal to 1.

Code: Select all

\fancyput(0cm,0cm){ 
		\ifthenelse{\c@section<1}%
           {}%
           {\ifthenelse{\isodd{\thepage}}%
           {{\dottedline{2}(383,70)(383,-691)(550,-691)}}%
           {{\dottedline{2}(87,70)(87,-691)(-70,-691)}}
           }}%
(if I remove the first line c@section<1 the remaining code works)

What am I doing wrong? The section number is given by \c@section, right?

Thank you!

The full example is:

Code: Select all

\documentclass[% -- opções da classe memoir --
book,			% indica que é um artigo acadêmico
12pt,				% tamanho da fonte
twoside,			% para impressão apenas no verso. Oposto a twoside
a4paper,			% tamanho do papel. 
% -- opções da classe abntex2 --
%chapter=TITLE,		% títulos de capítulos convertidos em letras maiúsculas
%section=TITLE,	\	% títulos de seções convertidos em letras maiúsculas
%subsection=TITLE,	% títulos de subseções convertidos em letras maiúsculas
%subsubsection=TITLE % títulos de subsubseções convertidos em letras maiúsculas
% -- opções do pacote babel --
english,			% idioma adicional para hifenização
brazil,				% o último idioma é o principal do documento
sumario=tradicional]{memoir}


\let\footruleskip\undefined
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[brazil]{babel}
\usepackage{color}        
\usepackage{fancybox, epic, ifthen} 
\usepackage[authoryear]{natbib} 
\usepackage[font=small,format=hang,singlelinecheck=false,skip=12pt,labelsep=quad,labelfont=bf]{caption}
\usepackage{concrete}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[letterpaper]{geometry}
\addto\captionsbrazil{\renewcommand\indexname{Índice Remissivo}}
\addto\captionsbrazil{\renewcommand\chaptername{UNIDADE}}
\definecolor{cinzauab}{gray}{0.73}
\newcommand{\tracocima}{{\color{cinzauab}\rule[1cm]{\paperwidth}{1.5cm}}}
\newcommand{\tracobaixo}{{\color{cinzauab}\rule[-2cm]{\paperwidth}{1.5cm}}}
\def\@makechapterhead#1{%
  \thispagestyle{empty}%
  \vspace*{5.55cm}%
  \hspace*{-2.9cm}
  \tracocima    
  \vspace*{0.5cm}
  \hspace*{0.4cm}{\fontsize{38}{12}\fontfamily{phv}\fontseries{bc}\selectfont \chaptername \space \thechapter}\par
  \vspace*{2.4cm}
  \noindent\hspace*{0.3cm}{\huge #1}\par
  \vspace*{1in}
  \hspace{-2.9cm}
  \tracobaixo    
  \pagebreak
  \newpage \thispagestyle{empty}\null \newpage
}


\fancyput(0cm,0cm){ 
		\ifthenelse{\c@section<1}%
           {}%
           {\ifthenelse{\isodd{\thepage}}%
           {{\dottedline{2}(383,70)(383,-691)(550,-691)}}%
           {{\dottedline{2}(87,70)(87,-691)(-70,-691)}}
           }}%
           
\fancyhead{}%
\fancyfoot{}%
\fancyfoot[RO]{\vspace*{-1cm}{\large\thepage}\hspace*{-4.7cm}}
\fancyfoot[LE]{\vspace*{-1cm}\hspace*{-4.8cm}{\large\thepage}}
\renewcommand{\headrulewidth}{0pt}


\author{NAME OF AUTHOR}
\author{NAME OF AUTHOR}
\title{TITLE OF BOOK}
\date{}


\begin{document}
\let\cleardoublepage\clearpage


\maketitle
%\chapter{teste}

f
gfgdfg

\section{test}

\lipsum
\end{document}

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

\c@section problem

Post by Stefan Kottwitz »

Hi Roberto,

very nice to see you again here in the forum!

That problem is caused by the @ character which is by default not allowed in author macro names. It's ok in style files / packages though. That's why package and class writers often use it for defining internal macros.

You can make it work though: put \makeatletter before your definition with @ inside:

Code: Select all

\makeatletter
\fancyput(0cm,0cm){ 
                \ifthenelse{\c@section<1}%
...
\makeatother
There's also an explanation in the TeX FAQ: \@ and @ in macro names.

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

\c@section problem

Post by Johannes_B »

You are using stuff you are not supposed to fiddle with. That is the reason you get errors. Don't use low level TeX/LaTeX if you don't know what is going on. Same goes for the chapterhead. Also, don't use fancyhdr with memoir. The memoir class has its own way and methods of setting headers and footers.


Out of interest, what are the lines for?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
robertoneto123
Posts: 13
Joined: Thu Sep 25, 2008 1:20 pm

Re: \c@section problem

Post by robertoneto123 »

Thank you!

I'm creating a template that must have large margins and some dotted vertical lines along it.

Thank you, it's working now!

Roberto
Post Reply