我正在尝试在乳胶中的 IEEEtran 样式文档中的标题和文本之间添加一些分隔。
\documentclass[journal, a4paper, 11pt]{IEEEtran}
\IEEEoverridecommandlockouts
\linespread{1.25}\selectfont
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabulary}
\usepackage{url}
\usepackage{amsmath}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm]{geometry}
\usepackage{float}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% ENCABEZADO DE LAS PÁGINAS TIPO UNICAFAM %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\MYhead}{\smash{\scriptsize
\hfil\parbox[t][\height][t]{\textwidth}{\centering
\begin{picture}(0,0) \put(-30,-27){\includegraphics[width=17mm]{images/00_general/cranfield_university_main_logo.png}} \end{picture} \hspace{6.4cm}
PRÁCTICA DE CIRCUITOS I \hspace{5.15cm} Versión 1.0\\
\hspace{5.2cm} DEPARTAMENTO DE INGENIERÍA DE TELECOMUNICACIONES \hspace{3cm} Periodo 2022-II\\
\underline{\hspace{ \textwidth}}}\hfil\hbox{}}}
\makeatletter
% normal pages
\def\ps@headings{%
\def\@oddhead{\MYhead}%
\def\@evenhead{\MYhead}}%
% title page
\def\ps@IEEEtitlepagestyle{%
\def\@oddhead{\MYhead}%
\def\@evenhead{\MYhead}}%
\makeatother
% make changes take effect
\pagestyle{headings}
% adjust as needed
\addtolength{\footskip}{0\baselineskip}
\addtolength{\textheight}{-10\baselineskip}
\begin{document}
\pagenumbering{Roman}
% Titulo
\title{\textbf{\huge{This is the title}} \\
\vspace{5mm}
\large{Group Design Project} \\
\vspace{5mm}
\large{\textbf{Astronautics and Space Engineering MSc.}} \\
\vspace{3mm}
\normalsize{Academic year: 2022-2023}
}
% author names
\author{\textbf{\textbf{Yi Qiang Ji Zhang}}\textsuperscript{1} \\ \vspace{3mm}
\textbf{Supervisors}: Dr. s\textsuperscript{1} \& Dr. s\textsuperscript{1} \\ \vspace{3mm}
\begin{figure}[H]
\centering
\includegraphics[width=0.2\textwidth]{images/00_general/cranfield_university_main_logo.png}
\hspace{3mm}
\includegraphics[width=0.2\textwidth]{images/00_general/Cranfield_Crest.jpg}
\end{figure}
\begin{flushleft}
\small{\textsuperscript{1}\textit{School of Aerospace, Transport and Manufacturing, Cranfield University, United Kingdom}}
\end{flushleft}
}% <-this % stops a space
\onecolumn
\maketitle
\vspace{-10mm}
\end{document}
我尝试添加\vspace{10mm}
其他方法但没有任何改变。
我也想要页码出现在右侧(其中写了版本 1.0),我怎样才能将其添加到我的标题中?
答案1
生成标题tikz
的另一种可能性是使用 选项remember picture, overlay,transform shape
,它基本上将 tikz 生成的标题重叠在页面顶部。在此消息的末尾,我放了执行此操作的代码。我正在做的是:
- 我通过包将顶部边距更改为 2.5 厘米,
geometry
以便为页眉留出空间。 - 我使用和多行节点生成了标题
tikz
,因为它允许文本居中,而不必通过猜测其位置hspace
。 - 我通过库将不同的节点放置在距离文本主体约 1 厘米的位置,并在它们之间划线
calc
。
请注意,所有这些定位都是手动的。如果您在包声明中更改了顶部边距的值geometry
,则需要手动调整不同的尺寸。
文本不与页眉重叠,因为页眉已放置多于文本主体(!)这消除了您之前遇到的问题。无需更改生成标题的方式即可实现类似效果的另一种可能性是将标题包裹在minipage
具有设定高度的环境中,但我不确定这是否可行。
希望对您有帮助!
实现这一目标的代码如下:
\documentclass[journal, a4paper, 11pt]{IEEEtran}
\IEEEoverridecommandlockouts
\linespread{1.25}\selectfont
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabulary}
\usepackage{url}
\usepackage{amsmath}
\usepackage[left=1.5cm,right=1.5cm,top=2.5cm,bottom=1.5cm]{geometry} %<- Here I changed the top value to make space for the header!
\usepackage{float}
\usepackage{tikz} % Extra!
\usepackage{tikzpagenodes} % To employ the command "current page text area" for positioning of tikz nodes
\usetikzlibrary{calc} % To help with positioning
\usepackage{lipsum} % To generate fake text
%\usepackage{showframe} % To show page geometry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% ENCABEZADO DE LAS PÁGINAS TIPO UNICAFAM %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\MYhead}{%
\scriptsize
\hfil\parbox[t][\height][t]{\textwidth}{%
\centering
\begin{picture}(0,0) \put(-30,-27){%
\includegraphics[width=17mm]{example-image-a}}%
\end{picture}%
\hfill PRÁCTICA DE CIRCUITOS I \hfill Versión 1.0 - Page \thepage\\
\hfill DEPARTAMENTO DE INGENIERÍA DE TELECOMUNICACIONES \hfill Periodo 2022-II\\
\underline{\hspace{\textwidth}}}\hfil\hbox{}}
\newcommand{\tikZHeader}{%
% Useful links:
% For relative positioning: https://tex.stackexchange.com/questions/89588/positioning-relative-to-page-in-tikz
% Ikz and overlay: https://tex.stackexchange.com/questions/121393/tikz-header-and-footer-across-top-and-bottom-of-bulletin-newsletter-page
% Calc library: https://tex.stackexchange.com/questions/617027/how-to-add-a-few-points-to-the-current-page-text-area-of-tikz
% Maybe the header is better with the fancyheader package? : https://www.overleaf.com/learn/latex/Headers_and_footers
\begin{tikzpicture}[remember picture, overlay,transform shape]
%- Node with university logo (left side) -%
\node (leftText) [anchor = south west, inner sep=0pt] % Anchors are tricky!
at ($(current page text area.north west) - (0cm,-1cm)$) % Put the node at the upper left (north west) side of the body of text. Then add 1 cm towards the top of the page, so it is separated from the text.
{%
\includegraphics[width=17mm]{example-image-a}%
};
%- Node with text on center of page -%
\node (centerText) [anchor = south, inner sep=0pt, style={align=center, font = \scriptsize}]
at ($(current page text area.north) - (0cm,-1cm)$) % Put the node at the upper center (north) side of the body of text. Then add 1 cm towards the top of the page, so it is separated from the text.
{%
PRÁCTICA DE CIRCUITOS I \\ DEPARTAMENTO DE INGENIERÍA DE TELECOMUNICACIONES \\ Periodo 2022-II
};
%- Node with text on right side -%
\node (rightText) [anchor = south east, inner sep=0pt, style={align=right, font = \scriptsize}]
at ($(current page text area.north east) - (0cm,-1cm)$) % Put the node at the upper right (north east) side of the body of text. Then add 1 cm towards the top of the page, so it is separated from the text.
{%
Versión 1.0 - Page \thepage
};
%- Line below header -%
\draw ($(current page text area.north west) - (0cm,-0.5cm)$) -- ($(current page text area.north east) - (0cm,-0.5cm)$) ;
\end{tikzpicture}
}
\makeatletter
% normal pages
\def\ps@headings{%
\def\@oddhead{\tikZHeader}%
\def\@evenhead{\tikZHeader}}%
% title page
\def\ps@IEEEtitlepagestyle{%
\def\@oddhead{\tikZHeader}%
\def\@evenhead{\tikZHeader}}%
\makeatother
% make changes take effect
\pagestyle{headings}
% adjust as needed
\addtolength{\footskip}{0\baselineskip}
\addtolength{\textheight}{-10\baselineskip}
\pagenumbering{Roman}
\begin{document}
% Titulo
\title{ \vspace*{15mm} \textbf{\huge{This is the title}} \\
\vspace{5mm}
\large{Group Design Project} \\
\vspace{5mm}
\large{\textbf{Astronautics and Space Engineering MSc.}} \\
\vspace{3mm}
\normalsize{Academic year: 2022-2023}
}
% author names
\author{\textbf{\textbf{Yi Qiang Ji Zhang}}\textsuperscript{1} \\ \vspace{3mm}
\textbf{Supervisors}: Dr. s\textsuperscript{1} \& Dr. s\textsuperscript{1} \\ \vspace{3mm}
\begin{figure}[H]
\centering
\includegraphics[width=0.2\textwidth]{example-image-b}
\hspace{3mm}
\includegraphics[width=0.2\textwidth]{example-image-c}
\end{figure}
\begin{flushleft}
\small{\textsuperscript{1}\textit{School of Aerospace, Transport and Manufacturing, Cranfield University, United Kingdom}}
\end{flushleft}
}% <-this % stops a space
\onecolumn
\maketitle
\newpage
\lipsum[10-25] % fake text
\end{document}
答案2
解决方法是将命令直接包含vspace*
在标题中:
\title{ \vspace*{5mm} \textbf{\huge{This is the title}} \\
这对我来说有助于将所有东西都转移下去。
关于将页码改为右上方,可以\MYhead
通过命令修改来实现\thepage
。请注意,为了让第一页也是罗马字体,需要在\pagenumbering{Roman}
之前写上\begin{document}
。修改如下:
\newcommand{\MYhead}{\smash{\scriptsize
\hfil\parbox[t][\height][t]{\textwidth}{\centering
\begin{picture}(0,0) \put(-30,-27){\includegraphics[width=17mm]{images/00_general/cranfield_university_main_logo.png}} \end{picture} \hspace{6.4cm}
PRÁCTICA DE CIRCUITOS I \hspace{5.15cm} Versión 1.0 - Page \thepage\\ % <-- HERE!
\hspace{5.2cm} DEPARTAMENTO DE INGENIERÍA DE TELECOMUNICACIONES \hspace{3cm} Periodo 2022-II\\
\underline{\hspace{ \textwidth}}}\hfil\hbox{}}}
最后,修改后的代码如下:
\documentclass[journal, a4paper, 11pt]{IEEEtran}
\IEEEoverridecommandlockouts
\linespread{1.25}\selectfont
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabulary}
\usepackage{url}
\usepackage{amsmath}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm]{geometry}
\usepackage{float}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% ENCABEZADO DE LAS PÁGINAS TIPO UNICAFAM %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\MYhead}{\smash{\scriptsize
\hfil\parbox[t][\height][t]{\textwidth}{\centering
\begin{picture}(0,0) \put(-30,-27){\includegraphics[width=17mm]{images/00_general/cranfield_university_main_logo.png}} \end{picture} \hspace{6.4cm}
PRÁCTICA DE CIRCUITOS I \hspace{5.15cm} Versión 1.0 - Page \thepage\\
\hspace{5.2cm} DEPARTAMENTO DE INGENIERÍA DE TELECOMUNICACIONES \hspace{3cm} Periodo 2022-II\\
\underline{\hspace{ \textwidth}}}\hfil\hbox{}}}
\makeatletter
% normal pages
\def\ps@headings{%
\def\@oddhead{\MYhead}%
\def\@evenhead{\MYhead}}%
% title page
\def\ps@IEEEtitlepagestyle{%
\def\@oddhead{\MYhead}%
\def\@evenhead{\MYhead}}%
\makeatother
% make changes take effect
\pagestyle{headings}
% adjust as needed
\addtolength{\footskip}{0\baselineskip}
\addtolength{\textheight}{-10\baselineskip}
\pagenumbering{Roman}
\begin{document}
% Titulo
\title{ \vspace*{5mm} \textbf{\huge{This is the title}} \\
\vspace{5mm}
\large{Group Design Project} \\
\vspace{5mm}
\large{\textbf{Astronautics and Space Engineering MSc.}} \\
\vspace{3mm}
\normalsize{Academic year: 2022-2023}
}
% author names
\author{\textbf{\textbf{Yi Qiang Ji Zhang}}\textsuperscript{1} \\ \vspace{3mm}
\textbf{Supervisors}: Dr. s\textsuperscript{1} \& Dr. s\textsuperscript{1} \\ \vspace{3mm}
\begin{figure}[H]
\centering
\includegraphics[width=0.2\textwidth]{images/00_general/cranfield_university_main_logo.png}
\hspace{3mm}
\includegraphics[width=0.2\textwidth]{images/00_general/Cranfield_Crest.jpg}
\end{figure}
\begin{flushleft}
\small{\textsuperscript{1}\textit{School of Aerospace, Transport and Manufacturing, Cranfield University, United Kingdom}}
\end{flushleft}
}% <-this % stops a space
\onecolumn
\maketitle
asdsda
\newpage
asdasd
\newpage
asdasd
\end{document}