cours-snt/template_cours.cls

252 lines
6.3 KiB
TeX
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

% This is a Latex template, inspired from
% http://tutex.tug.org/pracjourn/2005-4/hefferon/hefferon.pdf
%
% Copyright © 2019 Adrian Amaglio <adrian@amaglio.fr>
% This work is free. You can redistribute it and/or modify it under the
% terms of the Do What The Fuck You Want To Public License, Version 2,
% as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
% --- Class structure: identification part
% ---
\ProvidesClass{article_adrian}[Cours en lycée]
\NeedsTeXFormat{LaTeX2e}
%\usepackage{../tof2}
% --- Class structure: declaration of options part
% ---
% This class extends the article class
% Read all the documentclass options; pass them to article,
% ---
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
% --- Class structure: execution of options part
% ---
\ProcessOptions \relax
% --- Class structure: Loading parent class
% ---
\LoadClass{article}
% --- Loading common packages
% ---
% Be utf-8 %
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
%\usepackage{amsmath}%why
%\usepackage{amsfonts}%why
%\usepackage{amssymb}%why
% Include pictures %
\usepackage{graphicx}
% Why
%\usepackage{array}
% To display typewriter style text
\usepackage{listings}
% --- Define hyperlinks style
% ---
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{pdfpagemode={UseOutlines},
bookmarksopen=true,
bookmarksopenlevel=0,
hypertexnames=false,
colorlinks=true, % Set to false to disable coloring links
citecolor=green!40!black!90, % The color of citations
linkcolor=red!40!black!80, % The color of references to document elements (sections, figures, etc)
urlcolor=blue!40!black!80, % The color of hyperlinks (URLs)
pdfstartview={FitV},
breaklinks=true,
}
% --- Define document margins
% ---
\setlength{\textheight}{760pt} \addtolength{\voffset}{-90pt}
\setlength{\textwidth}{485pt} \addtolength{\hoffset}{-70pt}
% --- Paper and page layout
% ---
\setlength{\parindent}{0pt}
\setlength{\headheight}{10pt}
% --- New page for each section
% ---
\usepackage{titlesec}
%\newcommand{\sectionbreak}{\pagebreak}
%not working as expected :(
% --- Define document font
% ---
\usepackage{mathpazo}
%Dyslexie
%OpenDyslexic (open-dyslexic) by Abelardo Gonzalez is licensed under a Creative Commons Attribution 3.0 Unported License
%Lexia Readable
% --- Register some information about the document
% ---
\newcommand{\thelicence}{\def\svgwidth{.1\columnwidth}\input{cc-by-sa.pdf_tex}}
\newcommand{\thelevel}{SNT}
\newcommand{\thesequence}{Séquence 0}
% --- Store title, author and date to use them later, even after maketitle emptyed them
% ---
\let\titleoriginal\title % save original \title macro
\renewcommand{\title}[1]{ % substitute for a new \title
\titleoriginal{#1}% % define the real title
\def\thetitle{#1} % define \thetitle
}
\let\dateoriginal\date % save original \date macro
\renewcommand{\date}[1]{ % substitute for a new \date
\dateoriginal{#1}% % define the real date
\def\thedate{#1} % define \thedate
}
\let\authororiginal\author % save original \author macro
\renewcommand{\author}[1]{ % substitute for a new \author
\authororiginal{#1}% % define the real author
\def\theauthor{#1} % define \theauthor
}
% --- Header and footer
%---
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\thedate}
\chead{\thelevel}
\rhead{\thesequence}
\usepackage{lastpage}
\lfoot{\theauthor}
\cfoot{\thepage \,/ \pageref{LastPage}}
\rfoot{\thelicence}
% --- Document title
% ---
% remove spacing around date:
%\usepackage{titling}
%\predate{}
%\postdate{}
\AtBeginDocument{%
\dateoriginal{} % clear date
\authororiginal{}
\maketitle
\thispagestyle{fancy}
}
% --- Academic year
% --- Use: \academicyear to display text like "2020-2021"
% --- Use: \academicyear[-1] to display text like "2019-2020"
% --- Use: \academicyear[0][/][ to display text like "2020/2021"
% TODO without global : https://tex.stackexchange.com/questions/94710/what-is-the-difference-between-local-and-global-in-a-tex-meaning
\usepackage{xparse}
\newcounter{myyear}
\newcounter{myyearprevious}
\newcounter{myyearnext}
\NewDocumentCommand{\academicyear}{O{0} O{-}}{
\begingroup
% Current year %
\setcounter{myyear}{\year}
\addtocounter{myyear}{#1}
% Previous year %
\setcounter{myyearprevious}{\value{myyear}}
\addtocounter{myyearprevious}{-1}
\addtocounter{myyearprevious}{#1}
% Next year %
\setcounter{myyearnext}{\value{myyear}}
\stepcounter{myyearnext}
\addtocounter{myyearnext}{#1}
% Print academic year %
\ifnum\month<8 \arabic{myyearprevious}#2\arabic{myyear} \else\arabic{myyear}#2\arabic{myyearnext}\fi
\endgroup
}
% --- my environments
% ---
\usepackage[many]{tcolorbox}
% 1: name
% 2: Text to display in cartouche
% 3: font color of cartouche
% 4: back color of cartouche
\newcommand{\myenvironment}[4]{
\newtcolorbox[
auto counter,
number within=section
]{#1}{%
breakable,
enhanced,
colback=white,
colbacktitle=white,
arc=0pt,
boxrule=0pt,
leftrule=1pt,
rightrule=0pt,
toprule=0pt,
bottomrule=0pt,
titlerule=0pt,
colframe=#4,
fonttitle=\color{#4}\sffamily\scshape,
overlay={
\node[
outer sep=-1pt,
anchor=west,
fill=#4,
font=\color{#3}\sffamily\scshape
] at (title.west) {#2~\thetcbcounter};
},
adjusted title={}
}
}
\definecolor{yellowtitle}{RGB}{133,100,4}
\definecolor{yellowtitleback}{RGB}{255,243,205}
\definecolor{yellowtitleborder}{RGB}{255,238,196}
\myenvironment{example}{Exemple}{yellowtitle}{yellowtitleback}
\definecolor{turquoisetitle}{RGB}{12,84,96}
\definecolor{turquoisetitleback}{RGB}{209,236,241}
\definecolor{turquoisetitleborder}{RGB}{190,229,235}
\myenvironment{exercice}{Exercice}{turquoisetitle}{turquoisetitleback}
\definecolor{redtitle}{RGB}{114,28,36}
\definecolor{redtitleback}{RGB}{248,215,218}
\definecolor{redtitleborder}{RGB}{245,198,203}
\myenvironment{definition}{Définition}{redtitle}{redtitleback}
\definecolor{greentitle}{RGB}{21,87,36}
\definecolor{greentitleback}{RGB}{212,237,218}
\definecolor{greentitleborder}{RGB}{195,230,203}
\myenvironment{further}{Pour aller plus loin}{greentitle}{greentitleback}
% --- Some default values
% ---
\title{Template de cours}
\date{\academicyear}
\author{Best teacher EUW}