我想创建带有中心徽标的标题
\documentclass[11pt,a4paper]{report}
\usepackage[margin=0.5in]{geometry}
\usepackage{multicol}
\usepackage[french]{babel}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{amsthm,amssymb,amsfonts,mathtools}
\newcommand{\centerbox}[1]% #1 = text
{\bgroup% use local definitions
\parskip=0pt
\sbox0{\fbox{#1}}
\dimen0=\dimexpr 0.5\textwidth - 0.5\wd0\relax
\par\noindent\rule{\dimen0}{0.8pt}\box0\rule{\dimen0}{0.8pt}\par
\egroup}
\usepackage{xhfill}
\usepackage{fancyhdr}
\usepackage[svgnames]{xcolor}
%\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,calc,positioning}
\tikzset{box/.style={draw, rectangle, thick, text centered, minimum height=3em}}
\tikzset{line/.style={draw, thick, -latex'}}
\newlength\TextBoxWd% width of the text boxes
\newlength\TextBoxSep% separation of the text boxes
\newlength\TextBoxHt% height of the text boxes
\setlength\TextBoxWd{\marginparwidth}
\setlength\TextBoxSep{\marginparsep}
\setlength\TextBoxHt{2cm}
\newcommand\ThickTitleRule{\xrfill[0.5ex]{3pt}}
\newcommand\Title[4]{%
\begingroup
\setlength\parindent{0pt}%
\par
\makebox[\linewidth]{%
% \fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#3}}\hspace{\TextBoxSep}%
\parbox[t]{\textwidth}{%
\leavevmode
\centering
\ThickTitleRule\quad{\scshape\bfseries\itshape#1}\quad\ThickTitleRule\par
\vskip-0.2\baselineskip
\rule{\textwidth}{2pt}\par\vskip-.8\baselineskip% Thick horizontal line
\rule{\textwidth}{0.4pt}%Thin horizontal line
\par\vskip0.75ex
{\Large\scshape\bfseries\itshape#2\par}% Title
\rule{\textwidth}{0.4pt}\par\par\vskip-.7\baselineskip% Thin horizontal line
\rule{\textwidth}{2pt}% Thick horizontal line
}%
% \hspace{\TextBoxSep}\fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#4}}\par%
}%
\vskip\baselineskip
\endgroup
}
%========================================================================================
\begin{document}
\Title{Mohcine}{The Kingdom of Morocco \hfill
\begin{center}
\includegraphics[width=10cm,height=4cm]{1.jpg}
\end{center} \hfill Semester $1$\\
High School: Educ \hfill \hfill Level: SM \\
\text{address, country} \hfill \hfill Year: 2016--2017 \\
\textbf{Trainee Teacher :Educ \hfill Mohcine}}}{}{}
\bigskip
\end{document}
答案1
基于tabularx
和 的解决方案makecell
:
\documentclass[11pt,a4paper, svgnames, demo]{report}
\usepackage[margin=0.5in]{geometry}
\usepackage{multicol}
\usepackage[english, french]{babel}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{amsthm,amssymb,amsfonts,mathtools}
\newcommand{\centerbox}[1]% #1 = text
{\bgroup% use local definitions
\parskip=0pt
\sbox0{\fbox{#1}}
\dimen0=\dimexpr 0.5\textwidth - 0.5\wd0\relax
\par\noindent\rule{\dimen0}{0.8pt}\box0\rule{\dimen0}{0.8pt}\par
\egroup}
\usepackage{xhfill}
\usepackage{fancyhdr}
\usepackage[]{xcolor}
%\usepackage[most]{tcolorbox}
%\tcbuselibrary{skins,breakable,xparse}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,calc,positioning}
\tikzset{box/.style={draw, rectangle, thick, text centered, minimum height=3em}}
\tikzset{line/.style={draw, thick, -latex'}}
\newlength\TextBoxWd% width of the text boxes
\newlength\TextBoxSep% separation of the text boxes
\newlength\TextBoxHt% height of the text boxes
\setlength\TextBoxWd{\marginparwidth}
\setlength\TextBoxSep{\marginparsep}
\setlength\TextBoxHt{2cm}
\newcommand\ThickTitleRule{\xrfill[0.5ex]{3pt}}
\newcommand\Title[4]{%
\begingroup
\setlength\parindent{0pt}%
\par
\makebox[\linewidth]{%
% \fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#3}}\hspace{\TextBoxSep}%
\parbox[t]{\textwidth}{%
\leavevmode
\centering
\ThickTitleRule\quad{\scshape\bfseries\itshape#1}\quad\ThickTitleRule\par
\vskip-0.2\baselineskip
\rule{\textwidth}{2pt}\par\vskip-.8\baselineskip% Thick horizontal line
\rule{\textwidth}{0.4pt}%Thin horizontal line
\par\vskip0.75ex
{\Large\scshape\bfseries\itshape#2\par}% Title
\rule{\textwidth}{0.4pt}\par\par\vskip-.7\baselineskip% Thin horizontal line
\rule{\textwidth}{2pt}% Thick horizontal line
}%
% \hspace{\TextBoxSep}\fbox{\parbox[t][\TextBoxHt][c]{\TextBoxWd}{\raggedright#4}}\par%
}%
\vskip\baselineskip
\endgroup
}
\usepackage{makecell, tabularx}
%========================================================================================
\begin{document}
{\selectlanguage{english}
\Title{Mohcine}{\centering The Kingdom of Morocco\\[1.5ex]%
\begin{tabularx}{\textwidth}{@{}>{\raggedright\bfseries\arraybackslash}Xc>{\bfseries\arraybackslash}X@{}}
\makecell[lb]{High School: Educ\\
address, country\\
Trainee Teacher: \\%
Educ}%
& \includegraphics[width=0.4\textwidth, height=4cm]{1.jpg}
& \makecell[rb]{Semester 1\\%
Level: SM\\%
Year: 2016-2017\\%
Mohcine}
\end{tabularx} }{}{}}
\bigskip
\end{document}
答案2
这应该有效:
\usepackage{fancyhdr}
\usepackage{graphicx}
\fancypagestyle{logoheader}
\fancyhead[LO,LE]{School \\ Adress \\ Teacher}
\fancyhead[CO,CE]{\includegraphics{yourlogo}}
\fancyhead[RO,RE]{Semester \\ Level \\ Year}
然后使用\pagestyle{logoheader}
。
您可以使用一些水平规则对其进行自定义,这比使用 tikz 更容易。