3

I'm trying to create a class to typeset a government gazette. this is the template I'm following, although I don't care about all the colours.

I'm using the article class as a baseline (with the twocolumn option on), fancyhdr to make the header and footer, except for the first page, where I'm trying to redefine maketitle to a header-like structure, similar to the template (it doesn't have to be fancy, the logo and the text in black and white would suffice).

my problem is that the title created by the \maketitle command is invading the text in the second column, as is ignoring the rule that separates the columns, as in:

enter image description here

is there a way of making the title more similar to the linked PDF above?

I've based my class mostly in the newspaper package. here is the class code:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{doliberto}[2017/09/21 Mesquita's D.O. class]

% 
%% load article class with options
\LoadClass[twocolumn, a4paper, 10pt]{article}

% pass unused options to article
\DeclareOption{onecolumn}{\OptionNotUsed}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax

%
%% package loading
\RequirePackage{polyglossia}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
\RequirePackage{hyperref}
\RequirePackage[portuges]{datetime2}
\RequirePackage{datetime2-calc}
\RequirePackage{titlesec}

% brazilian portuguese support in XeLaTeX
\setmainlanguage{portuges}
\setlength{\columnseprule}{0.4pt}

%
%% variables

% counters
\newcounter{issue}
\newcommand\currentissue[1]{\setcounter{issue}{#1}}
\newcounter{month}
\newcommand\currentmonth[1]{\setcounter{month}{#1}}
\newcounter{year}
\newcommand\currentyear[1]{\setcounter{year}{#1}}
\newcounter{day}
\newcommand\currentday[1]{\setcounter{day}{#1}}

% date
\newcommand{\dataextenso}{\arabic{day} de \DTMportugesmonthname{\arabic{month}} de \arabic{year}}

% whose D.O.
\renewcommand{\@author}{Prefeitura Municipal de Mesquita}
\newcommand{\@email}{anexogabinete@mesquita.rj.gov.br}
\newcommand{\@site}{http://www.mesquita.rj.gov.br/}
\newcommand{\@location}{Mesquita}

%
%% text dimensions (for now, defaults from newspaper package)
\setlength\topmargin{-48pt} % article default = -58pt
%\setlength\headheight{0pt} % article default = 12pt
\setlength\headsep{34pt} % article default = 25pt
\setlength\marginparwidth{-20pt} % article default = 121pt
\setlength\textwidth{504pt} % article default = 418pt
\setlength\textheight{684pt} % article default = 296pt
\setlength\oddsidemargin{-30pt}

\fancypagestyle{firstpage}{
\setlength{\headheight}{5cm}
\lhead{\includegraphics[height=3cm]{prefeitura-mesquita.jpg}}
\chead{}
\rhead{}
\lfoot{{\footnotesize \url{\@site}}}
\cfoot{\thepage}
\rfoot{{\footnotesize \href{mailto:\@email}{\@email}}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}

\renewcommand{\maketitle}{%\thispagestyle{firststyle}
\vspace*{-40pt}
\begin{center}
{\setlength\fboxsep{3mm}\raisebox{12pt}{\framebox[1.2\width]{\parbox[c]{1.15in}{\includegraphics[height=2.5cm]{prefeitura-mesquita.jpg}}}}}\hfill%
{\huge Diário Oficial}\hfill%   
\raisebox{12pt}{\textbf{\footnotesize \@author}}\\
\vspace*{0.1in}
\rule[0pt]{\textwidth}{0.5pt}\\
{\small {\small\@location, \dataextenso} \hfill \textbf{Diário Oficial Nº \arabic{issue}}}\\
\rule[6pt]{\textwidth}{1.2pt}
\end{center}
}

\pagestyle{fancy}
\lhead{{\small\@location, \dataextenso}}
\chead{\textbf{Diário Oficial Nº \arabic{issue}}}
\rhead{{\small \@author}}
\lfoot{{\footnotesize \url{\@site}}}
\cfoot{\thepage}
\rfoot{{\footnotesize \href{mailto:\@email}{\@email}}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

%\renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}
\setcounter{secnumdepth}{0}

%
%% DOli macros

%% this must be in .tex file
% \titleformat*{\section}[block]{\large\bfseries\filcenter}{\thesection}{1em}{\MakeUppercase}

%% macros

% título do ato
\newcommand\headline[1]{\begin{center} {\bfseries \MakeUppercase{#1}} \end{center} \par}
% quem assina
\newcommand\byline[2]{\begin{center} {\bfseries \MakeUppercase{#1}} \\%
            {\small\bfseries #2} \\ %
            \rule[3pt]{0.4\hsize}{0.5pt}\\ \end{center} \par}
% separando seções de cada secretaria
\newcommand\closearticle{{\begin{center}\rule[6pt]{\hsize}{1pt}\vspace*{-16pt}
      \rule{\hsize}{0.5pt}\end{center}}}

MWE:

%% needs xelatex to compile!
%% you can choose your tex engine on sharelatex/overleaf, or
%% (preferrable) download TeXlive!
\documentclass{doliberto}
\currentissue{4}
\currentmonth{11}
\currentyear{1994}
\currentday{28}
\titleformat{\section}[block]{\large\bfseries\filcenter}{\thesection}{1em}{\MakeUppercase}


\begin{document}
\thispagestyle{plain}
\maketitle
\tableofcontents

\section{Secretaria Municipal de Educação}

\headline{Portaria Nº 394/2017} 

\Blindtext     

\byline{Thaís dos Santos Lima}{Secretário Municipal de Educação}

\closearticle

\section{Conselho Municipal da Criança e do Adolescente}

\headline{RESOLUÇÃO CMDCA Nº 003 / 2017.}

\Blindtext

\byline{Jacqueline  Freitas}{\quad}

\end{document}
  • Hint: You can use the blindtext package to generate fill text. – Dr. Manuel Kuehner Sep 25 '17 at 19:38
3

You could use \maketitle inside a minipage to make it stay within the column width.

\begin{minipage}{.9\columnwidth}%
\maketitle
\end{minipage}

enter image description here


or to have the title span the whole page follow the suggestion of David Carlisle:

\twocolumn[\maketitle]

enter image description here


Alternatively if the changes should happen in the .sty file:

\renewcommand{\maketitle}{%\thispagestyle{firststyle}
\twocolumn[{
\vspace*{-40pt}
\begin{center}
{\setlength\fboxsep{3mm}\raisebox{12pt}{\framebox[1.2\width]{\parbox[c]{1.15in}{\includegraphics[height=2.5cm]{example-image}}}}}\hfill%
{\huge Diário Oficial}\hfill%   
\raisebox{12pt}{\textbf{\footnotesize \@author}}\\
\vspace*{0.1in}
\rule[0pt]{\textwidth}{0.5pt}\\
{\small {\small\@location, \dataextenso} \hfill \textbf{Diário Oficial Nº \arabic{issue}}}\\
\rule[6pt]{\textwidth}{1.2pt}
\end{center}
}]
}
  • that looks good! thanks! can I do something similar to get the title to span both columns? – bruno cuconato Sep 25 '17 at 19:45
  • the minipage is just essentially being used to redefine \textwidth here I think – David Carlisle Sep 25 '17 at 19:49
  • @brunocuconato yes the standard article \maketitle already spans both columns, see in article.cls just make \maketitle do \twocolumn[\@maketitle]% wheer \@maketitke is your main title code. – David Carlisle Sep 25 '17 at 19:52
  • thanks for the help! that's what I wanted :) as I understand, and @David Carlisle pointed out, \maketitle should be on two columns already, so why do we need to use this? (but again, it works great!) – bruno cuconato Sep 25 '17 at 19:58
  • @DavidCarlisle Thanks a lot for your comment! I included your suggestion into my answer and removed the superfluous \begin{@twocolumnfalse}... If you would like to edit your own answer and include it there, I going to revert my edit. – user36296 Sep 25 '17 at 20:05
4
\rule[0pt]{\textwidth}{0.5pt}\\

makes a rule that is \textwidth wide (that is, it will span both columns) you presumably intended \columnwidth

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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