我已经使用和调整了我所在大学的 Latex 模板一年了。我主要通过查看代码和阅读注释代码来调整。到目前为止,我已经调整了一些形状、更改了颜色以及封面图片和徽标。
今天我想添加第二张封面图片,但我不明白安装文件中的功能定义。
以下是当前定义此封面的代码行:
% Cover page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \UEm {\@matiere}
\def \UEc {\@UEcourt}
\makeatletter
\def\@titre{titre}
\newcommand{\titre}[1]{\def\@titre{#1}}
\def\@soustitre{soustitre}
\newcommand{\soustitre}[1]{\def\@soustitre{#1}}
\def\@pgimage{pgimage}
\newcommand{\pgimage}[1]{\def\@pgimage{#1}}
\def\@etudiants{etudiants}
\newcommand{\etudiants}[1]{\def\@etudiants{#1}}
\def\@noms{noms}
\newcommand{\noms}[1]{\def\@noms{#1}}
\def\@matiere{matiere}
\newcommand{\matiere}[1]{\def\@matiere{#1}}
\def\@UEcourt{UEcourt}
\newcommand{\UEcourt}[1]{\def\@UEcourt{#1}}
\makeatother
% Geometry of the cover page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\BackgroundPic{ %
\begin{tikzpicture}[remember picture, overlay]
\begin{scope}[shift={(current page.west)}]
\draw[draw=Jaune-UPS,fill=Jaune-UPS] (0,-50) rectangle (25,50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.75,-14.25) rectangle (25,-50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-12.75) rectangle (1.5,-12.25);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-13) rectangle (1.5,-13.5);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-13.75) rectangle (1.5,-15);
\node[rotate=90,anchor=west] at(0.75,-12){\textcolor{darkgray}{\textbf{\textsc{\UEm}}}};
\node[rotate=90,anchor=west] at(1.25,-12){\textcolor{darkgray}{\textsc{\UEc}}};
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-1.35) rectangle (1.5,-1.1);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-0.9) rectangle (1.5,-0.4);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-0.2) rectangle (1.5,0.8);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,1) rectangle (1.5,50);
%
\node[inner sep=0pt,anchor=north east] at (20.5,14.5) {\includegraphics[width=.5\textwidth]{Template/JJ.png}};
\end{scope}
\end{tikzpicture}}
\makeatletter
\newcommand{\pagedegarde}{
\newgeometry{top=2.5cm, bottom=1cm, left=2cm, right=1cm}
\AddToShipoutPicture*{\BackgroundPic}
\begin{titlepage}
\centering
\vspace*{4cm}
{\huge\bfseries\color{Gris-UPS} \@titre}\\
\vspace*{3mm}
{\LARGE\color{Gris-UPS}\@soustitre}\\
\vspace{1cm}
{\Large {\bfseries\color{Gris-UPS} \@etudiants}}\\
\vfill
\hspace*{5.15cm}\includegraphics[height=.75\textwidth]{\@pgimage} %IMAGE DE COUVERTURE
\vfill
{\color{Gris-UPS} \@date} \\
\end{titlepage}
\restoregeometry
}
\makeatother
到目前为止,我已经尝试创建一个新的“功能”:
\def\@pgimage2{pgimage2}
\newcommand{\pgimage2}[1]{\def\@pgimage2{#1}}
但是代码没有正确突出显示(它的颜色),所以我觉得我做错了什么。
任何帮助都值得感激,提前谢谢!
PS:我忘了添加一个工作示例,所以我现在就添加。我的 Overleaf 文档有 2 个主文件,然后通过 .tex 文件添加内容。第一个主文件是 CRinfo.sty,第二个是 main.tex
这是CRinfo.sty的内容,我翻译了重要的注释和部分。
% CRinfo.sty Cédric Roosz, 16/11/2022
%
% Style dédié aux comptes rendus d'Informatique Scientifique 3
% Université Toulouse III Paul Sabatier
% Packages for FR %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier} % Bibliothèque de caractères
\usepackage{natbib} % Format de bibliographie
\usepackage{babel}
% Packages for writing, format, symbols, etc. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fourier,amssymb,amsfonts,amsmath,latexsym,fontawesome,setspace,enumitem} % Librairies diverses (police, symboles, listes)
\usepackage{dirtytalk}
\usepackage{lipsum,ulem,hyperref} % Librairies diverses (lipsum, soulignage, liens URL)
\hypersetup{colorlinks=true,linkcolor=blue,filecolor=magenta,urlcolor=cyan}
\usepackage[a4paper, margin=2.5cm]{geometry} % Format des marges
\usepackage{fancyhdr,eso-pic} % Format des entêtes, pieds de pages, fonds
\setlength{\headheight}{15pt} % Taille de l'entête
\fancyhead[L]{\scshape\@noms} % Paramètre de l'entête gauche
\fancyhead[R]{\leftmark} % Paramètre de l'entête droite
\renewcommand{\headrulewidth}{1pt} % Ligne sous l'entête
\renewcommand{\footrulewidth}{1pt} % Ligne sur le pied de page
\fancyfoot[C]{\thepage} % Numéro de page
\pagestyle{fancy}
\usepackage{booktabs,tabularx,array,graphicx, tabularray, multirow} % Format des tableaux, figures
\usepackage{tikz} % Outils de dessins
\setlength{\parindent}{1cm} % Pas d'indentation en début de paragraphe
\setlist[itemize]{label=$\bullet$} % Symbole pour les listes
% Parameters to insert code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{minted} % Permet d'afficher des bouts de codes
\usemintedstyle[python]{default} % Thème d'affichage python
\usemintedstyle[latex]{default} % Thème d'affichage latex
\setminted[python]{frame=lines,framesep=2mm,baselinestretch=1.2,bgcolor=GrisClair,fontsize=\footnotesize,linenos}
\setminted[latex]{frame=lines,framesep=2mm,baselinestretch=1.2,fontsize=\footnotesize}
\renewcommand{\listingscaption}{Extrait de code} % Légende code
\renewcommand{\listoflistingscaption}{Liste des extraits de codes} %Titre liste de codes
\newminted{python}{frame=lines,framesep=2mm,baselinestretch=1.2,bgcolor=GrisClair,fontsize=\footnotesize,linenos}
% University colours %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xcolor}
\definecolor{Orange-UPS}{RGB}{243,150,47}
\definecolor{Jaune-UPS}{RGB}{243,150,47}
\definecolor{Gris-UPS}{RGB}{53,53,53}
\definecolor{GrisClair}{RGB}{240,240,240}
\definecolor{BlancCasse}{RGB}{244,237,222}
% Cover page format %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \UEm {\@matiere}
\def \UEc {\@UEcourt}
\makeatletter
\def\@titre{titre}
\newcommand{\titre}[1]{\def\@titre{#1}}
\def\@soustitre{soustitre}
\newcommand{\soustitre}[1]{\def\@soustitre{#1}}
\def\@pgimage{pgimage}
\newcommand{\pgimage}[1]{\def\@pgimage{#1}}
\def\@etudiants{etudiants}
\newcommand{\etudiants}[1]{\def\@etudiants{#1}}
\def\@noms{noms}
\newcommand{\noms}[1]{\def\@noms{#1}}
\def\@matiere{matiere}
\newcommand{\matiere}[1]{\def\@matiere{#1}}
\def\@UEcourt{UEcourt}
\newcommand{\UEcourt}[1]{\def\@UEcourt{#1}}
\makeatother
% Cover Page Geometry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\BackgroundPic{ %
\begin{tikzpicture}[remember picture, overlay]
\begin{scope}[shift={(current page.west)}]
\draw[draw=Jaune-UPS,fill=Jaune-UPS] (0,-50) rectangle (25,50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.75,-14.25) rectangle (25,-50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-12.75) rectangle (1.5,-12.25);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-13) rectangle (1.5,-13.5);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-13.75) rectangle (1.5,-15);
\node[rotate=90,anchor=west] at(0.75,-12){\textcolor{darkgray}{\textbf{\textsc{\UEm}}}};
\node[rotate=90,anchor=west] at(1.25,-12){\textcolor{darkgray}{\textsc{\UEc}}};
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-1.35) rectangle (1.5,-1.1);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-0.9) rectangle (1.5,-0.4);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,-0.2) rectangle (1.5,0.8);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,1) rectangle (1.5,50);
%
\node[inner sep=0pt,anchor=north east] at (20.5,14.5) {\includegraphics[width=.5\textwidth]{Template/JJ.png}};
\end{scope}
\end{tikzpicture}}
\makeatletter
\newcommand{\pagedegarde}{
\newgeometry{top=2.5cm, bottom=1cm, left=2cm, right=1cm}
\AddToShipoutPicture*{\BackgroundPic}
\begin{titlepage}
\centering
\vspace*{4cm}
{\huge\bfseries\color{Gris-UPS} \@titre}\\
\vspace*{3mm}
{\LARGE\color{Gris-UPS}\@soustitre}\\
\vspace{1cm}
{\Large {\bfseries\color{Gris-UPS} \@etudiants}}\\
\vfill
\hspace*{5.15cm}\includegraphics[height=.85\textwidth]{\@pgimage} %IMAGE DE COUVERTURE
\vfill
{\color{Gris-UPS} \@date} \\
\end{titlepage}
\restoregeometry
}
\makeatother
% Specific Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changing margins
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
% Geometry of the transition page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\TransitionPic{ %
\begin{tikzpicture}[remember picture, overlay]
\begin{scope}[shift={(current page.west)}]
\draw[draw=Jaune-UPS,fill=Jaune-UPS] (0,-50) rectangle (25,50);
% \draw[draw=Gris-UPS,fill=Gris-UPS] (0,50) rectangle (20.5,14.25);
% \draw[draw=Gris-UPS,fill=Gris-UPS] (0,-14.25) rectangle (20.5,-50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-12.75) rectangle (20.5,-12.25);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-13) rectangle (20.5,-13.5);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-13.75) rectangle (20.5,-15);
\node[rotate=270,anchor=west] at(20.25,-1.5){\textcolor{darkgray}{\textbf{\textsc{\UEm}}}};
\node[rotate=270,anchor=west] at(19.75,-1.5){\textcolor{darkgray}{\textsc{\UEc}}};
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-1.35) rectangle (20.5,-1.1);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-0.9) rectangle (20.5,-0.4);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,-0.2) rectangle (20.5,0.8);
% \draw[draw=Gris-UPS,fill=Gris-UPS] (0.5,1) rectangle (1.5,50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (19.5,1) rectangle (20.5,50);
\draw[draw=Gris-UPS,fill=Gris-UPS] (0,-50) rectangle (0.125,50);
\end{scope}
\end{tikzpicture}}
然后这里是main.tex,还翻译了必要的注释:
\documentclass[english,12pt,a4paper]{article} %Définition du type de document
\usepackage{CRinfo} %Import du fichier de style (format du document)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title, authors, date, etc. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\titre{Diagnostic \say{Les Mûriers}} %Insérez ici le titre de votre document
\vspace{1cm}
\soustitre{ATELIER DIAGNOSTIC}
\etudiants{Gauthier DUPONT, Nicolas EVENO, Eugénie SALIGNAT, Camille VIDAL} %Insérez ici vos noms et prénoms
\noms{Dupont, Eveno, Salignat, Vidal}
\date{14 Février 2024}
\pgimage{Couverture1.jpg} %cover page image
\matiere{Master Urbanisme et Aménagement}
\UEcourt{Parcours Villes, Habitat et Transition Écologique}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document Start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagedegarde % insertion of the cover page
\newpage
\tableofcontents % Table des matières
\newpage
%\listoffigures
%\listoftables
%\listoflistings
%\input{Contenu/P0_Introduction}
\input{Contenu/P1}
\end{document}