我正在尝试创建一个类来排版政府公报。这是模板我正在关注,尽管我并不关心所有的颜色。
我使用该类article
作为基线(启用 twocolumn 选项)fancyhdr
来制作页眉和页脚,但第一页除外,我试图将 maketitle 重新定义为类似于模板的页眉结构(它不必很花哨,黑白徽标和文字就足够了)。
我的问题是,该命令创建的标题\maketitle
侵入了第二列的文本,并且忽略了分隔列的规则,如下所示:
有没有办法使标题更类似于上面链接的 PDF?
我的课程主要基于newspaper
包。以下是课程代码:
\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}{[email protected]}
\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}}}
梅威瑟:
%% 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}
答案1
您可以\maketitle
在内部使用minipage
以使其保持在列宽范围内。
\begin{minipage}{.9\columnwidth}%
\maketitle
\end{minipage}
或者让标题跨越整个页面,按照建议大卫·卡莱尔:
\twocolumn[\maketitle]
或者如果更改应该发生在.sty
文件中:
\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}
}]
}
答案2
\rule[0pt]{\textwidth}{0.5pt}\\
制定一条较宽的规则\textwidth
(即它将跨越两列),你可能希望\columnwidth