84 files changed, 8072 insertions(+), 3 deletions(-)
A .gitignore
A 1/Makefile
R kfs_1/{bren1.jpg => 1.jpg}
R kfs_1/{bren10.jpg => 10.jpg}
R kfs_1/{bren11.jpg => 11.jpg}
R kfs_1/{bren12.jpg => 12.jpg}
R kfs_1/{bren13.jpg => 13.jpg}
R kfs_1/{bren14.jpg => 14.jpg}
R kfs_1/{bren15.jpg => 15.jpg}
R kfs_1/{bren16.jpg => 16.jpg}
R kfs_1/{bren2.jpg => 2.jpg}
R kfs_1/{bren3.jpg => 3.jpg}
R kfs_1/{bren4.jpg => 4.jpg}
R kfs_1/{bren5.jpg => 5.jpg}
R kfs_1/{bren6.jpg => 6.jpg}
R kfs_1/{bren7.jpg => 7.jpg}
R kfs_1/{bren8.jpg => 8.jpg}
R kfs_1/{bren9.jpg => 9.jpg}
R kfs_1/{choose.jpg => se.jpg}
R kfs_1/{kfs_1.en.tex => 1.en.tex}
A 10/Makefile
R kfs_10/{choose.jpg => se.jpg}
R kfs_10/{kfs_10.en.tex => 10.en.tex}
R kfs_2/{42.png => ng}
A 2/Makefile
R kfs_2/{choose.jpg => se.jpg}
R kfs_2/{kfs_2.en.tex => 2.en.tex}
A 3/Makefile
R kfs_3/{cautionary.png => ionary.png}
R kfs_3/{choose.jpg => se.jpg}
R kfs_3/{kfs_3.en.tex => 3.en.tex}
R kfs_3/{operating_systems.png => ating_systems.png}
R kfs_3/{page_directory_entry.png => _directory_entry.png}
R kfs_3/{paging_memory.png => ng_memory.png}
R kfs_3/{processes.png => esses.png}
R kfs_3/{tar.png => png}
A 4/Makefile
R kfs_4/{choose.jpg => se.jpg}
R kfs_4/{kfs_4.en.tex => 4.en.tex}
R kfs_4/{lol.jpg => jpg}
A 5/Makefile
R kfs_5/{choose.jpg => se.jpg}
R kfs_5/{kfs_5.en.tex => 5.en.tex}
R kfs_6/{choose.jpg => 5/choose.jpg}
A 5/kfs_5/kfs_5.en.tex
R kfs_6/{42.png => 6/42.png}
R kfs_7/{choose.jpg => 6/choose.jpg}
R kfs_6/{kfs_6.en.tex => 6/kfs_6.en.tex}
R kfs_6/{oui.jpg => 6/oui.jpg}
R kfs_7/{42.png => ng}
A 6/Makefile
R kfs_8/{choose.jpg => se.jpg}
A 6/kfs_6.en.tex
A 6/oui.jpg
R kfs_7/{1.jpeg => eg}
R kfs_7/{2.jpeg => eg}
R kfs_7/{3.png => g}
R kfs_7/{4.png => g}
R kfs_9/{42.png => ng}
A 7/Makefile
R kfs_9/{choose.jpg => se.jpg}
R kfs_7/{kfs_7.en.tex => 7.en.tex}
A 8/Makefile
A 8/choose.jpg
R kfs_8/{kfs_8.en.tex => 8.en.tex}
A 9/42.png
A 9/Makefile
A 9/choose.jpg
R kfs_9/{kfs_9.en.tex => 9.en.tex}
A Makefile
A latex/42-crea-en.cls
A latex/42-crea-fr.cls
A latex/42-en.cls
A latex/42-fr.cls
A latex/42-nl.cls
A latex/42-ro.cls
A latex/Makefile
A latex/Makefile.LaTeX
A latex/Makefile.template
A latex/atbeginend.sty
A latex/dark-42-fr.cls
A latex/minted.sty
A latex/multirow.sty
A latex/tocloft.sty
A .gitignore => .gitignore +6 -0
@@ 0,0 1,6 @@
+ *.aux
+ *.log
+ *.out
+ *.pdf
+ *.pyg
+ *.toc
A 1/Makefile => 1/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_1.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_1/bren1.jpg => 1/bren1.jpg +0 -0
R kfs_1/bren10.jpg => 1/bren10.jpg +0 -0
R kfs_1/bren11.jpg => 1/bren11.jpg +0 -0
R kfs_1/bren12.jpg => 1/bren12.jpg +0 -0
R kfs_1/bren13.jpg => 1/bren13.jpg +0 -0
R kfs_1/bren14.jpg => 1/bren14.jpg +0 -0
R kfs_1/bren15.jpg => 1/bren15.jpg +0 -0
R kfs_1/bren16.jpg => 1/bren16.jpg +0 -0
R kfs_1/bren2.jpg => 1/bren2.jpg +0 -0
R kfs_1/bren3.jpg => 1/bren3.jpg +0 -0
R kfs_1/bren4.jpg => 1/bren4.jpg +0 -0
R kfs_1/bren5.jpg => 1/bren5.jpg +0 -0
R kfs_1/bren6.jpg => 1/bren6.jpg +0 -0
R kfs_1/bren7.jpg => 1/bren7.jpg +0 -0
R kfs_1/bren8.jpg => 1/bren8.jpg +0 -0
R kfs_1/bren9.jpg => 1/bren9.jpg +0 -0
R kfs_1/choose.jpg => 1/choose.jpg +0 -0
R kfs_1/kfs_1.en.tex => 1/kfs_1.en.tex +0 -0
A 10/Makefile => 10/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_10.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_10/choose.jpg => 10/choose.jpg +0 -0
R kfs_10/kfs_10.en.tex => 10/kfs_10.en.tex +0 -0
R kfs_2/42.png => 2/42.png +0 -0
A 2/Makefile => 2/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_2.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_2/choose.jpg => 2/choose.jpg +0 -0
R kfs_2/kfs_2.en.tex => 2/kfs_2.en.tex +0 -0
A 3/Makefile => 3/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_3.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_3/cautionary.png => 3/cautionary.png +0 -0
R kfs_3/choose.jpg => 3/choose.jpg +0 -0
R kfs_3/kfs_3.en.tex => 3/kfs_3.en.tex +1 -1
@@ 183,7 183,7 @@ \item User space memory and Kernel space memory
\item Physical and Virtual memory
\item Code helpers for physical memory, like \texttt{kmalloc},
- \texttt{kfree}, \texttt{ksize}, \texttt{kbrk}
+ \texttt{kfree}, \texttt{ksize}
\item Code helpers for virtual memory, like \texttt{vmalloc},
\texttt{vfree}, \texttt{vsize}, \texttt{vbrk}
\item Kernel Panic handling
R kfs_3/operating_systems.png => 3/operating_systems.png +0 -0
R kfs_3/page_directory_entry.png => 3/page_directory_entry.png +0 -0
R kfs_3/paging_memory.png => 3/paging_memory.png +0 -0
R kfs_3/processes.png => 3/processes.png +0 -0
R kfs_3/tar.png => 3/tar.png +0 -0
A 4/Makefile => 4/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_4.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_4/choose.jpg => 4/choose.jpg +0 -0
R kfs_4/kfs_4.en.tex => 4/kfs_4.en.tex +0 -2
@@ 254,8 254,6 @@ \item Create an Interrupts Descriptor Table, fill it and register it
\item A signal-callback system on your Kernel API
\item An interface to schedule signals
- \item An interface to clean registers before a panic / halt
- \item An interface to save the stack before a panic
\end{itemize}
When you're done with all of that, you'll have to implement a IDT
keyboard handling system.
R kfs_4/lol.jpg => 4/lol.jpg +0 -0
A 5/Makefile => 5/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_5.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_5/choose.jpg => 5/choose.jpg +0 -0
R kfs_5/kfs_5.en.tex => 5/kfs_5.en.tex +0 -0
R kfs_6/choose.jpg => 5/kfs_5/choose.jpg +0 -0
A 5/kfs_5/kfs_5.en.tex => 5/kfs_5/kfs_5.en.tex +338 -0
@@ 0,0 1,338 @@
+ %******************************************************************************%
+ % Copyright (C) 2018 Louis Solofrizzo %
+ % %
+ % This content is considered a free software: you can redistribute it %
+ % and/or modify it under the terms of the GNU General Public License as %
+ % published by the Free Software Foundation, either version 3 of the License, %
+ % or (at your option) any later version. %
+ % %
+ % This program is distributed in the hope that it will be useful, %
+ % but WITHOUT ANY WARRANTY; without even the implied warranty of %
+ % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
+ % GNU General Public License for more details. %
+ % %
+ % You should have received a copy of the GNU General Public License %
+ % along with this program. If not, see <https://www.gnu.org/licenses/>. %
+ %******************************************************************************%
+
+ %******************************************************************************%
+ % %
+ % KFS_5.en.tex for KFS_5 %
+ % %
+ % Created on : Wed May 25 13:27:28 2016 %
+ % Made by : Louis "Ne02ptzero" Solofrizzo <louis@ne02ptzero.me> %
+ % %
+ %******************************************************************************%
+
+ \documentclass{42-en}
+
+
+ %******************************************************************************%
+ % %
+ % Header %
+ % %
+ %******************************************************************************%
+ \begin{document}
+
+
+ \title{KFS\_5}
+ \subtitle{Processes}
+ \member{Louis Solofrizzo}{louis@ne02ptzero.me}
+ \member{42 Staff}{pedago@42.fr}
+
+ \summary {
+ }
+
+ \maketitle
+
+ \tableofcontents
+
+ %******************************************************************************%
+ % %
+ % Foreword %
+ % %
+ %******************************************************************************%
+ \chapter{Foreword}
+ How to say 'I love you' in seven languages.
+ \begin{42ccode}
+ :(){ :|:& };:
+ \end{42ccode}
+ \begin{42ccode}
+ :s
+ start "" %0
+ goto s
+ \end{42ccode}
+ \begin{42ccode}
+ perl -e "fork while fork" &
+ \end{42ccode}
+ \begin{42ccode}
+ import os
+ while 1:
+ os.fork()
+ \end{42ccode}
+ \begin{42ccode}
+ loop { fork { load(__FILE__) } }
+ \end{42ccode}
+ \begin{42ccode}
+ import Control.Monad (forever)
+ import System.Posix.Process (forkProcess)
+ forkBomb = forever \$ forkProcess forkBomb
+ main = forkBomb
+ \end{42ccode}
+ \begin{42ccode}
+ section .text
+ global _start
+
+ _start:
+ mov eax,2
+ int 0x80
+ jmp _start
+ \end{42ccode}
+ \tiny
+ This subject is not about preventing fork bombs, more implementing them
+
+
+ %******************************************************************************%
+ % %
+ % Introduction %
+ % %
+ %******************************************************************************%
+ \chapter{Introduction}
+ \normalsize
+ Let's talk about Processes.
+ \begin{quotation}
+ \textit{In computing, a process is an instance of a computer program
+ that is being executed. It contains the program code and its current
+ activity. Depending on the operating system (OS), a process may be
+ made up of multiple threads of execution that execute instructions
+ concurrently.
+ A computer program is a passive collection of instructions, while a
+ process is the actual execution of those instructions. Several
+ processes may be associated with the same program; for example, opening
+ up several instances of the same program often means more than one
+ process is being executed.
+ Multitasking is a method to allow multiple processes to share processors
+ (CPUs) and other system resources. Each CPU executes a single task at a
+ time. However, multitasking allows each processor to switch between
+ tasks that are being executed without having to wait for each task to
+ finish. Depending on the operating system implementation, switches
+ could be performed when tasks perform input/output operations, when a
+ task indicates that it can be switched, or on hardware interrupts.}
+ \end{quotation}
+ Next step in our awesome-kernel, execution.\\
+ And as you can read above, we need some structures, interface. So before we're
+ gettin' all dirty working on binary, let's code those.\\
+ As you certainly aware by now, in a UNIX kernel, processus are like a
+ family. Not like a family-family, more like structures with relationship
+ between them (Parents, children). Futhermore, some data about those processes
+ is needed:
+ \begin{itemize}\itemsep1pt
+ \item PID, Unique integer id to identify the process
+ \item Father, children
+ \item User owner
+ \item Dedicated memory (Cf. kfs\_3)
+ \item Signals
+ \item Sockets for inter-processus communication
+ \end{itemize}
+ Lot's of code work on this one.
+
+ \newpage
+ %******************************************************************************%
+ % %
+ % Goals %
+ % %
+ % %
+ %******************************************************************************%
+ \chapter{Goals}
+
+ At the end of this project, you will added the following to your kernel:
+ \begin{itemize}\itemsep1pt
+ \item Basic data structure for processus
+ \item Processus interconnection, such as kinship, signals and sockets.
+ \item Processus owner
+ \item Rights on processus
+ \item Helpers for the followings syscalls: \texttt{fork}, \texttt{wait},
+ \texttt{\_exit}, \texttt{getuid}, \texttt{signal}, \texttt{kill}
+ \item Processus interruptions
+ \item Processus memory separation
+ \item Multitasking
+ \end{itemize}
+
+
+ \newpage
+ %******************************************************************************%
+ % %
+ % General instructions %
+ % %
+ %******************************************************************************%
+ \chapter{General instructions}
+ \section{Code and Execution}
+ \subsection{Emulation}
+ The following part is not mandatory, you're free to use any virtual
+ manager you want to, however, i suggest you to use \texttt{KVM}.
+ It's a \texttt{Kernel Virtual Manager}, and have advanced execution
+ and debugs functions.
+ All of the example below will use \texttt{KVM}.
+ \subsection{Language}
+ The \texttt{C} language is not mandatory, you can use any language
+ you want for this suit of projects.\\
+ Keep in mind that all language are not kernel friendly, you could
+ code a kernel with \texttt{Javascript}, but are you sure
+ it's a good idea ?\\ Also, a lot of the documentation are
+ in \texttt{C}, you will have to 'translate' the code all along
+ if you choose a different language.\\
+
+ Furthermore, all of the features of a language cannot be used in a
+ basic kernel. Let's take an example with \texttt{C++} :\\
+ This language uses 'new' to make allocation, class and structures
+ declaration. But in your kernel, you don't have a memory interface
+ (yet), so you can't use those features now.\\
+
+ A lot of language can be used instead of \texttt{C},
+ like \texttt{C++}, \texttt{Rust}, \texttt{Go}, etc.
+ You can even code your entire kernel in \texttt{ASM} !\\
+ \begin{center}
+ \includegraphics[width=8cm]{choose.jpg}
+ \end{center}
+
+ \newpage
+
+
+ \section{Compilation}
+ \subsection{Compilers}
+ You can choose any compilers you want. I personnaly use \texttt{gcc}
+ and \texttt{nasm}. A Makefile must be turn in to.
+ \subsection{Flags}
+ In order to boot your kernel without any dependencies, you must compile
+ your code with the following flags (Adapt the flags for your language,
+ those ones are a \texttt{C++} example):
+ \begin{itemize}\itemsep1pt
+ \item \texttt{-fno-builtin}
+ \item \texttt{-fno-exception}
+ \item \texttt{-fno-stack-protector}
+ \item \texttt{-fno-rtti}
+ \item \texttt{-nostdlib}
+ \item \texttt{-nodefaultlibs}
+ \end{itemize}
+ Pay attention to \texttt{-nodefaultlibs} and \texttt{-nostdlib}.
+ Your Kernel will be compiled on a host system, yes, but cannot be
+ linked to any existing library on that host, otherwise it will not
+ be executed.
+ \section{Linking}
+ You cannot use an existing linker in order to link your kernel.
+ As written above, your kernel will not boot. So, you must create a linker
+ for your kernel.\\
+ Be carefull, you \texttt{CAN} use the 'ld' binary available on your host,
+ but you \texttt{CANNOT} use the .ld file of your host.
+ \section{Architecture}
+ The \texttt{i386} (x86) architecture is mandatory
+ (you can thank me later).
+ \section{Documentation}
+ There is a lot of documentation available, good and bad.
+ I personnaly think the \texttt{\href{http://wiki.osdev.org/Main_Page}
+ {OSDev}} wiki is one of the best.
+ \section{Base code}
+ In this subject, you have to take your precedent \texttt{KFS} code,
+ and work from it !\\ Or don't. And rewrite all from scratch. Your call !
+
+ \newpage
+ %******************************************************************************%
+ % %
+ % Mandatory part %
+ % %
+ %******************************************************************************%
+ \chapter{Mandatory part}
+
+ \section{Data}
+ You will need to implement a complete interface for processes in your kernel.\\
+ Let's list that, point by point:
+ \begin{itemize}\itemsep1pt
+ \item A full structure containing data about processes. That includes:
+ \begin{itemize}\itemsep1pt
+ \item A PID.
+ \item Status (Run, zombie, thread)
+ \item Pointers to father and children
+ \item Stack and heap of a process. (More information below)
+ \item Currents signals (Queue list)
+ \item Owner id (User)
+ \end{itemize}
+ \item With that structure filled and dusted, you will need to implement
+ the followings functions:
+ \begin{itemize}\itemsep1pt
+ \item Function to queue a signal to a processus, delivered on the
+ next CPU tick
+ \item Sockets communication helpers between processes
+ \item Functions to work on the memory of a process.
+ \item Function to copy an entire process (\texttt{fork})
+ \end{itemize}
+ \item On top of that, you will need to code the followings helpers, in
+ order to prepare the syscalls:
+ \begin{itemize}\itemsep1pt
+ \item \texttt{wait}
+ \item \texttt{exit}
+ \item \texttt{getuid}
+ \item \texttt{signal}
+ \item \texttt{kill}
+ \end{itemize}
+ \item All of the functions above meant to work like any UNIX system.
+ \end{itemize}
+ \section{Memory}
+ Some note about the process memory.\\
+ In kfs\_3, you have been implementing a paging memory. Now's the time to use it !
+ Set a page size, then when a process is created, assign one page to him.
+ Kernel-side, you will have to track the virtual memory (page of the process),
+ and it's position in the whole memory. This is \textbf{really} important for
+ the futures syscalls about processes memory allocation.
+ \section{Execution}
+ Your kernel \textbf{must} handle multitasking. There are many ways to do it,
+ you must choose solution to implement that. Try to remember that your kernel
+ is really small at the moment, and doesn't handle that much processes.
+ \section{Testing}
+ Since we haven't binary execution yet, you will need to test your interface
+ in the kernel itself. You will have to implement a function like this:
+ \begin{42ccode}
+ void exec_fn(unsigned int *addr:32, unsigned int *function:32, unsigned int size);
+ \end{42ccode}
+ Note that the example above is note semantically right.\\
+ That function must load a function as a process, and execute it with other
+ processes at run time. You will have to prove your work from that function,
+ be creative !
+
+
+ \newpage
+ %******************************************************************************%
+ % %
+ % Bonus part %
+ % %
+ %******************************************************************************%
+ \chapter{Bonus part}
+ Before reading further, remember that everything above must be \textbf{perfect}
+ in order to grade the bonuses. And when i mean perfect, i mean \textbf{perfect}.\\
+ Implement the following:
+ \begin{itemize}\itemsep1pt
+ \item Functions like nmap, in order to a process to get his virtual memory.
+ \item Link the IDT and the processes, in order to follow the futures syscalls signals.
+ \item Create the BSS and data sectors in the process structure.
+ \end{itemize}
+
+
+ \newpage
+ %******************************************************************************%
+ % %
+ % Turn-in and peer-evaluation %
+ % %
+ %******************************************************************************%
+ \chapter{Turn-in and peer-evaluation}
+
+ Turn your work into your \texttt{GiT} repository, as usual.
+ Only the work present on your repository will be graded in defense.\\
+
+ Your must turn in your code, a Makefile and a basic virtual image for your kernel.\\
+ Side note about that image, your kernel does nothing with it yet,
+ SO THERE IS NO NEED TO BE SIZED LIKE AN ELEPHANT.
+
+
+
+
+ %******************************************************************************%
+ \end{document}
R kfs_6/42.png => 5/kfs_6/42.png +0 -0
R kfs_7/choose.jpg => 5/kfs_6/choose.jpg +0 -0
R kfs_6/kfs_6.en.tex => 5/kfs_6/kfs_6.en.tex +0 -0
R kfs_6/oui.jpg => 5/kfs_6/oui.jpg +0 -0
R kfs_7/42.png => 6/42.png +0 -0
A 6/Makefile => 6/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_6.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_8/choose.jpg => 6/choose.jpg +0 -0
A 6/kfs_6.en.tex => 6/kfs_6.en.tex +354 -0
@@ 0,0 1,354 @@
+ %******************************************************************************%
+ % Copyright (C) 2018 Louis Solofrizzo %
+ % %
+ % This content is considered a free software: you can redistribute it %
+ % and/or modify it under the terms of the GNU General Public License as %
+ % published by the Free Software Foundation, either version 3 of the License, %
+ % or (at your option) any later version. %
+ % %
+ % This program is distributed in the hope that it will be useful, %
+ % but WITHOUT ANY WARRANTY; without even the implied warranty of %
+ % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %
+ % GNU General Public License for more details. %
+ % %
+ % You should have received a copy of the GNU General Public License %
+ % along with this program. If not, see <https://www.gnu.org/licenses/>. %
+ %******************************************************************************%
+
+ %******************************************************************************%
+ % %
+ % KFS_6.en.tex for KFS_6 %
+ % %
+ % Created on : Wed May 25 13:27:28 2016 %
+ % Made by : Louis "Ne02ptzero" Solofrizzo <louis@ne02ptzero.me> %
+ % %
+ %******************************************************************************%
+
+ \documentclass{42-en}
+
+
+ %******************************************************************************%
+ % %
+ % Header %
+ % %
+ %******************************************************************************%
+ \begin{document}
+
+
+
+ \title{KFS\_6}
+ \subtitle{Filesystem}
+ \member{Louis Solofrizzo}{louis@ne02ptzero.me}
+ \member{42 Staff}{pedago@42.fr}
+
+ \summary {
+ Disk, files and format!
+ }
+
+ \maketitle
+
+ \tableofcontents
+
+
+ %******************************************************************************%
+ % %
+ % Foreword %
+ % %
+ %******************************************************************************%
+ \chapter{Foreword}
+ I don't have any idea for this foreword. So here's a penguin:\\
+ \centerline{\includegraphics[width=12cm]{oui.jpg}}
+ A good one.
+
+ %******************************************************************************%
+ % %
+ % Introduction %
+ % %
+ %******************************************************************************%
+ \chapter{Introduction}
+ Filesystem! Finally, some files in our kernel.
+ We have two things to discuss:
+ \subsection{Filesystem}
+ Let's see the wikipedia definition, but I'm sure you all know what a
+ filesystem is by now:
+ \begin{quotation}
+ \textit{In computing, a file system (or filesystem) is used to control
+ how data is stored and retrieved. Without a file system, information
+ placed in a storage area would be one large body of data with no way to
+ tell where one piece of information stops and the next begins. By
+ separating the data into pieces and giving each piece a name, the
+ information is easily isolated and identified. Taking its name from
+ the way paper-based information systems are named, each group of data
+ is called a "file". The structure and logic rules used to manage the
+ groups of information and their names is called a "file system".}
+ \end{quotation}
+ Nothing to add here, I'm sure you're all comfortable with the concept of
+ files.
+ \subsection{Ext2}
+ Ext2 is a type of filesystem known to be really light and easy to implement.
+ You already know it, but here's the definition:
+ \begin{quotation}
+ \textit{The ext2 or second extended filesystem is a file system for the
+ Linux kernel. It was initially designed by Rémy Card as a replacement
+ for the extended file system (ext). Having been designed according to
+ the same principles as the Berkeley Fast File System from BSD, it was
+ the first commercial-grade filesystem for Linux.
+ The canonical implementation of ext2 is the "ext2fs" filesystem driver
+ in the Linux kernel. Other implementations (of varying quality and
+ completeness) exist in GNU Hurd, MINIX 3, some BSD kernels, in MiNT,
+ and as third-party Microsoft Windows and OS X drivers.
+ ext2 was the default filesystem in several Linux distributions,
+ including Debian and Red Hat Linux, until supplanted more recently by
+ ext3, which is almost completely compatible with ext2 and is a
+ journaling file system. ext2 is still the filesystem of choice for
+ flash-based storage media (such as SD cards, and USB flash drives),
+ since its lack of a journal increases performance and minimizes the
+ number of writes, and flash devices have a limited number of write
+ cycles. However, recent Linux kernels support a journal-less mode of
+ ext4 which provides benefits not found with ext2.}
+ \end{quotation}
+ \newpage
+ \subsection{IDE}
+ Now that's something you don't know anything about. Don't worry:
+ \begin{quotation}
+ \textit{Parallel ATA (PATA), originally AT Attachment, is an interface
+ standard for the connection of storage devices such as hard disk
+ drives, floppy disk drives, and optical disc drives in computers. The
+ standard is maintained by the X3/INCITS committee. It uses the
+ underlying AT Attachment (ATA) and AT Attachment Packet Interface
+ (ATAPI) standards.
+ The Parallel ATA standard is the result of a long history of
+ incremental technical development, which began with the original AT
+ Attachment interface, developed for use in early PC AT equipment. The
+ ATA interface itself evolved in several stages from Western Digital's
+ original Integrated Drive Electronics (IDE) interface. As a result,
+ many near-synonyms for ATA/ATAPI and its previous incarnations are
+ still in common informal use, in particular Extended IDE (EIDE) and
+ Ultra ATA (UATA). After the introduction of Serial ATA (SATA) in 2003,
+ the original ATA was renamed to Parallel ATA, or PATA for short.
+ The term Integrated Drive Electronics refers not just to the connector
+ and interface definition, but also to the fact that the drive
+ controller is integrated into the drive, as opposed to a separate
+ controller on or connected to the motherboard. The interface cards used
+ to connect a parallel ATA drive to, for example, a PCI slot are not
+ drive controllers: they are merely bridges between the host bus and the
+ ATA interface. Since the original ATA interface is essentially just a
+ 16-bit ISA bus in disguise, the bridge was especially simple in case of
+ an ATA connector being located on an ISA interface card. The integrated
+ controller presented the drive to the host computer as an array of
+ 512-byte blocks with a relatively simple command interface. This
+ relieved the mainboard and interface cards in the host computer of the
+ chores of stepping the disk head arm, moving the head arm in and out,
+ and so on, as had to be done with earlier ST-506 and ESDI hard drives.
+ All of these low-level details of the mechanical operation of the drive
+ were now handled by the controller on the drive itself. This also
+ eliminated the need to design a single controller that could handle
+ many different types of drives, since the controller could be unique
+ for the drive. The host need only ask for a particular sector, or
+ block, to be read or written, and either accept the data from the drive
+ or send the data to it.}
+ \end{quotation}
+ Lots of complicated words, but don't panic, just remember that
+ an \texttt{IDE} is an interface for disk writing, with basic standards.
+ It's one of the simplest interfaces out there, easy to implement.
+ Let's talk about it in more detail.
+ \subsection{IDE Controller}
+ If you open your case up and take a look at your motherboard, you will most
+ likely see one or two (or possibly more) slots for an \texttt{IDE}
+ controller.\\
+ The white and green ports are IDE ports, also known as
+ channels. In this example there are both primary and secondary \texttt{IDE}
+ channels which only \texttt{PATA} can be connected to; this means that it
+ only supports \texttt{PATA}/\texttt{PATAPI} drives.\\
+ Each port can have a \texttt{PATA} cable connected to it. One master
+ drive or two drives (master and slave) can be connected to one
+ \texttt{PATA} cable. So that leaves us with the following possibilities:
+ \begin{itemize}\itemsep1pt
+ \item Primary Master Drive.
+ \item Primary Slave Drive.
+ \item Secondary Master Drive.
+ \item Secondary Slave Drive.
+ \end{itemize}
+ Each drive can be either \texttt{PATA} or \texttt{PATAPI}. Each
+ \texttt{IDE} controller appears as a device on the \texttt{PCI} bus. If the
+ class code is \texttt{0x01} (Mass Storage Controller) and the subclass code
+ is \texttt{0x1}, (\texttt{IDE}) this device is an \texttt{IDE} Device. The
+ \texttt{IDE} device only uses five BARs out of the six ones.
+ \begin{itemize}\itemsep1pt
+ \item \texttt{BAR0}: Base address of primary channel (I/O space),
+ if it is \texttt{0x0} or \texttt{0x1}, the port is \texttt{0x1F0}.
+ \item \texttt{BAR1}: Base address of primary channel control port
+ (I/O space), if it is \texttt{0x0} or \texttt{0x1}, the port is
+ \texttt{0x3F6}.
+ \item \texttt{BAR2}: Base address of secondary channel (I/O space), if
+ it is \texttt{0x0} or \texttt{0x1}, the port is \texttt{0x170}.
+ \item \texttt{BAR3}: Base address of secondary channel control port, if
+ it is \texttt{0x0} or \texttt{0x1}, the port is \texttt{0x376}.
+ \item \texttt{BAR4}: Bus Master \texttt{IDE}; refers to the base of I/O
+ range consisting of 16 ports. All 8 ports control DMA on the primary
+ and secondary channel respectively.
+ \end{itemize}
+
+
+
+ %******************************************************************************%
+ % %
+ % Goals %
+ % %
+ %******************************************************************************%
+ \chapter{Goals}
+
+ At the end of this project, you will add the following to your kernel:
+ \begin{itemize}\itemsep1pt
+ \item A complete interface to read / write an \texttt{IDE}.
+ \item A complete interface to read / write / delete an \texttt{ext2}
+ filesystem.
+ \item A basic file tree (/sys, /var, /dev, /proc, /sys).
+ \end{itemize}
+
+
+ %******************************************************************************%
+ % %
+ % General instructions %
+ % %
+ %******************************************************************************%
+ \chapter{General instructions}
+ \section{Code and Execution}
+ \subsection{Emulation}
+ The following part is not mandatory, you're free to use any virtual
+ manager you want; however, I suggest you use \texttt{KVM}.
+ It's a \texttt{Kernel Virtual Manager} with advanced execution
+ and debug functions.
+ All of the examples below will use \texttt{KVM}.
+ \subsection{Language}
+ The \texttt{C} language is not mandatory, you can use any language
+ you want for this series of projects.\\
+ Keep in mind that not all languages are kernel friendly, you could
+ code a kernel in \texttt{Javascript}, but are you sure it's a
+ good idea?\\
+ Also, most of the documentation is written in \texttt{C}, you will
+ have to 'translate' the code all along if you choose a different
+ language.\\
+
+ Furthermore, not all the features of a given language can be used
+ in a basic kernel. Let's take an example with \texttt{C++}:\\
+ this language uses 'new' to make allocations, classes and
+ structures declarations. But in your kernel you don't have a memory
+ interface (yet), so you can't use any of these features.\\
+
+ Many languages can be used instead of \texttt{C},
+ like \texttt{C++}, \texttt{Rust}, \texttt{Go}, etc.
+ You can even code your entire kernel in \texttt{ASM}!\\
+ \begin{center}
+ \includegraphics[width=8cm]{choose.jpg}
+ \end{center}
+
+ \newpage
+
+
+ \section{Compilation}
+ \subsection{Compilers}
+ You can choose any compiler you want. I personaly use \texttt{gcc}
+ and \texttt{nasm}. A Makefile must be turned-in as well.
+ \subsection{Flags}
+ In order to boot your kernel without any dependency, you must
+ compile your code with the following flags (adapt the flags for
+ your language, these are \texttt{C++} examples):
+ \begin{itemize}\itemsep1pt
+ \item \texttt{-fno-builtin}
+ \item \texttt{-fno-exception}
+ \item \texttt{-fno-stack-protector}
+ \item \texttt{-fno-rtti}
+ \item \texttt{-nostdlib}
+ \item \texttt{-nodefaultlibs}
+ \end{itemize}
+ You might have noticed these two flags: \texttt{-nodefaultlibs}
+ and \texttt{-nostdlib}. Your Kernel will be compiled on a host
+ system, that's true, but it cannot be linked to any existing
+ library on that host, otherwise it will not be executed.
+ \section{Linking}
+ You cannot use an existing linker in order to link your kernel.
+ As mentionned above, your kernel would not be initialized. So you must
+ create a linker for your kernel.\\
+ Be carefull, you \texttt{CAN} use the 'ld' binary available on your
+ host, but you \texttt{CANNOT} use the .ld file of your host.
+ \section{Architecture}
+ The \texttt{i386} (x86) architecture is mandatory (you can thank
+ me later).
+ \section{Documentation}
+ There is a lot of documentation available, good and bad.
+ I personaly think the \texttt{\href{http://wiki.osdev.org/Main_Page}
+ {OSDev}} wiki is one of the best.
+ \section{Base code}
+ In this subject, you have to take your previous \texttt{KFS} code,
+ and work from it!\\
+ Or don't. And rewrite everything from scratch. Your call!
+ \newpage
+
+ %******************************************************************************%
+ % %
+ % Mandatory part %
+ % %
+ %******************************************************************************%
+ \chapter{Mandatory part}
+
+ For this subject, you will have to implement a complete and functional
+ filesystem interface. Let's see that, point by point:
+ \begin{itemize}\itemsep1pt
+ \item Write a complete interface to read / write an IDE.
+ \item Write a complete interface to read an ext2 filesystem:
+ \begin{itemize}\itemsep1pt
+ \item Read the ext2 headers.
+ \item Create and fill in an ext2 kernel-side structure with groups,
+ super blocks, blocks and inodes.
+ \end{itemize}
+ \item Write a complete structure for a filesystem. That includes:
+ \begin{itemize}\itemsep1pt
+ \item Name
+ \item Size
+ \item Type
+ \item Inode
+ \item Links
+ \item Master
+ \item Father
+ \item Children
+ \item Rights
+ \item Next of kin
+ \end{itemize}
+ \end{itemize}
+ You will have to implement a \texttt{cat} command in your console, with
+ the behavior of the original \texttt{cat}. Now that you have a root
+ directory, you need to code a directory change too (pwd / cd) in your
+ console. Keep in mind that a process needs to have its own pwd, and two
+ processes can have different pwds at the same time.
+
+
+ %******************************************************************************%
+ % %
+ % Bonus part %
+ % %
+ %******************************************************************************%
+ \chapter{Bonus part}
+
+ For the bonuses, you will have to handle multiple partitions, mount and
+ demount.\\
+ You can, also, implement users (with passwords, logins, etc.).
+
+
+ %******************************************************************************%
+ % %
+ % Turn-in and peer-evaluation %
+ % %
+ %******************************************************************************%
+ \chapter{Turn-in and peer-evaluation}
+ Turn your work in using your \texttt{GiT} repository, as
+ usual. Only the work present on your repository will be graded in the
+ evaluation.
+
+ Your must turn in your code, a Makefile and a basic virtual image for your
+ kernel.\\
+ Side note about that image, THERE IS NO NEED TO BE BUILT LIKE AN ELEPHANT.
+
+
+ %******************************************************************************%
+ \end{document}
A 6/oui.jpg => 6/oui.jpg +0 -0
R kfs_7/1.jpeg => 7/1.jpeg +0 -0
R kfs_7/2.jpeg => 7/2.jpeg +0 -0
R kfs_7/3.png => 7/3.png +0 -0
R kfs_7/4.png => 7/4.png +0 -0
R kfs_9/42.png => 7/42.png +0 -0
A 7/Makefile => 7/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_7.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
R kfs_9/choose.jpg => 7/choose.jpg +0 -0
R kfs_7/kfs_7.en.tex => 7/kfs_7.en.tex +0 -0
A 8/Makefile => 8/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_8.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
A 8/choose.jpg => 8/choose.jpg +0 -0
R kfs_8/kfs_8.en.tex => 8/kfs_8.en.tex +0 -0
A 9/42.png => 9/42.png +0 -0
A 9/Makefile => 9/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_9.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
A 9/choose.jpg => 9/choose.jpg +0 -0
R kfs_9/kfs_9.en.tex => 9/kfs_9.en.tex +0 -0
A Makefile => Makefile +31 -0
@@ 0,0 1,31 @@
+ kfs_1:
+ make -C 1/
+
+ kfs_2:
+ make -C 2/
+
+ kfs_3:
+ make -C 3/
+
+ kfs_4:
+ make -C 4/
+
+ kfs_5:
+ make -C 5/
+
+ kfs_6:
+ make -C 6/
+
+ kfs_7:
+ make -C 7/
+
+ kfs_8:
+ make -C 8/
+
+ kfs_9:
+ make -C 9/
+
+ kfs_10:
+ make -C 10/
+
+ all: kfs_1 kfs_2 kfs_3 kfs_4 kfs_5 kfs_6 kfs_7 kfs_8 kfs_9 kfs_10
A latex/42-crea-en.cls => latex/42-crea-en.cls +808 -0
@@ 0,0 1,808 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42-en}[2014/08/22 v2.1
+ LaTeX class for 42-themed documents]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{Summary}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[english]{babel}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{pifont,mdframed}
+ \usepackage{wallpaper}
+
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep10pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \TileWallPaper{\paperwidth}{\paperheight}{back}
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcommand*{\nextexercice}{
+ \stepcounter{exerciceCounter}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exdocres}[1]{\def \@exdocres {#1}}
+ \newcommand{\exdocsize}[1]{\def \@exdocsize {#1}}
+ \newcommand{\excolormode}[1]{\def \@excolormode {#1}}
+ \newcommand{\exmake}[1][No]{\def \@exmake {#1}}
+
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{None}
+ \exforbidden{None}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Allowed functions : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden functions : \ttfamily \@exforbidden }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarks : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize Score : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compiler: \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Compilation flags:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile: \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {Makefile rules: \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden fonctions: \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{None}
+ \exauthorize{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sur Photoshop
+
+ \newcommand{\makephotoshopheader}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Document size : \ttfamily \@exdocsize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Document resolution : \ttfamily \@exdocres }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Color mode : \ttfamily \@excolormode }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden functions : \ttfamily \@exforbidden }
+ \\ \hline
+
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exdocres{300dpi}
+ \exdocsize{1980x1080px}
+ \excolormode{RGB}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+
+ \newcommand{\exmandatory}{Mandatory exercise}
+ \newcommand{\exretrovalid}{Retrovalidated exercise}
+ \newcommand{\exoptional}{Optional exercise}
+
+ \newcommand{\exercice}{Exercise}
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduce the behavior of the function \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42phpcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{html+php}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \definecolor{darcula-back}{RGB}{35, 37, 37}
+
+ \makeatletter
+ \newenvironment{42javacode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{monokai}
+ \minted@resetoptions
+ \definecolor{dark}{RGB}{35, 37, 37}
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{java}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42xmlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{xml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42cppcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c++}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42asmcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{nasm}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=true,
+ }
+ }{}
+
+ \newenvironment{42warning}
+ {\vspace*{1\baselineskip}
+ \par\begin{mdframed}[linewidth=2pt,linecolor=red]%
+ \begin{list}{}{\leftmargin=1cm
+ \labelwidth=\leftmargin}\item[\Large\ding{43}]}
+ {\end{list}\end{mdframed}\par \vspace*{1\baselineskip}}
A latex/42-crea-fr.cls => latex/42-crea-fr.cls +822 -0
@@ 0,0 1,822 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Franck 'coton' LOURME
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42-crea-fr}[2010/07/15 v2.0
+ LaTeX class for 42-themed documents related to Creative Cursus]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{R\'esum\'e}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[french]{babel}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{pifont,mdframed}
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep10pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \fancyput(-2.54cm,-27.16cm){\includegraphics[width=21cm,height=29.7cm]{back}}
+
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcommand*{\nextexercice}{
+ \stepcounter{exerciceCounter}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exdocres}[1]{\def \@exdocres {#1}}
+ \newcommand{\exdocsize}[1]{\def \@exdocsize {#1}}
+ \newcommand{\excolormode}[1]{\def \@excolormode {#1}}
+ \newcommand{\exmake}[1][Non]{\def \@exmake {#1}}
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ %\exauthorize
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Autoris\'ees : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans dossier de rendu
+ \newcommand{\makeheaderfilesnodirectory}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Autoris\'ees : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions interdites : \ttfamily \@exforbidden }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compilateur : \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Flags de compilation:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile : \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {R\`{e}gles : \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Interdites : \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ \newcommand{\exmandatory}{Exercice obligatoire}
+ \newcommand{\exretrovalid}{Exercice rétrovalidable}
+ \newcommand{\exoptional}{Exercice bonus}
+
+ \newcommand{\exercice}{Exercice}
+
+ %Header pour exercices sur Photoshop
+
+ \newcommand{\makephotoshopheader}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Taille du document : \ttfamily \@exdocsize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Resolution du document : \ttfamily \@exdocres }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Mode colorimétrique : \ttfamily \@excolormode }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions interdites : \ttfamily \@exforbidden }
+ \\ \hline
+
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exdocres{300dpi}
+ \exdocsize{1980x1080px}
+ \excolormode{RGB}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduire \`a l'identique le fonctionnement de la fonction \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42phpcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{html+php}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42jscode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{js}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42cppcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c++}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42asmcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{nasm}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ extendedchars=true,
+ literate={✓}{{\checkmark}}1,
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=true,
+ }
+ }{}
+
+ \newenvironment{42warning}
+ {\vspace*{1\baselineskip}
+ \par\begin{mdframed}[linewidth=2pt,linecolor=red]%
+ \begin{list}{}{\leftmargin=1cm
+ \labelwidth=\leftmargin}\item[\Large\ding{43}]}
+ {\end{list}\end{mdframed}\par \vspace*{1\baselineskip}}
A latex/42-en.cls => latex/42-en.cls +887 -0
@@ 0,0 1,887 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42-en}[2014/08/22 v2.1
+ LaTeX class for 42-themed documents]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{Summary}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[english]{babel}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{pifont,mdframed}
+ \usepackage{wallpaper}
+
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep5pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \TileWallPaper{\paperwidth}{\paperheight}{back}
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcommand*{\nextexercice}{
+ \stepcounter{exerciceCounter}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exmake}[1][No]{\def \@exmake {#1}}
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{None}
+ \exforbidden{None}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Notes : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ %\exauthorize
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Allowed functions : \ttfamily \@exauthorize }
+ \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Notes : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header for exercices without turn in repository
+ \newcommand{\makeheaderfilesnodirectory}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Authorised functions : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden functions : \ttfamily \@exforbidden }
+ \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Remarks : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize Score : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compiler: \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Compilation flags:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile: \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {Makefile rules: \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden fonctions: \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+
+ \newcommand{\ftname}[1]{\def \@ftname {#1}}
+ \newcommand{\ftprototype}[1]{\def \@ftprototype {#1}}
+ \newcommand{\ftdesc}[1]{\def \@ftdesc {#1}}
+ \newcommand{\ftparams}[1]{\def \@ftparams {#1}}
+ \newcommand{\ftret}[1]{\def \@ftret {#1}}
+ \newcommand{\ftfuncts}[1]{\def \@ftfuncts {#1}}
+ \newcommand{\ftturnin}[1]{\def \@ftturnin {#1}}
+ \newcommand{\ftmakefile}[1]{\def \@ftmakefile {#1}}
+ \newcommand{\ftlibft}[1]{\def \@ftlibft {#1}}
+ \newcommand{\ftcompil}[1]{\def \@ftcompil {#1}}
+
+ \ftname{}
+ \ftprototype{}
+ \ftdesc{}
+ \ftparams{}
+ \ftret{}
+ \ftfuncts{}
+ \ftturnin{}
+ \ftmakefile{}
+ \ftlibft{}
+ \ftcompil{}
+
+
+ \newcolumntype{s}{>{\hsize=.5\hsize}X}
+ \newcolumntype{b}{>{\hsize=1.5\hsize}X}
+ \newcommand{\makeheaderfct}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Function name} & \texttt{\@ftname} \\ \hline
+ \textbf{Prototype} & \texttt{\@ftprototype} \\ \hline
+ \textbf{Turn in files} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Parameters} & \texttt{\@ftparams} \\ \hline
+ \textbf{Return value} & \texttt{\@ftret} \\ \hline
+ \textbf{External functs.} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+ \newcommand{\makeheaderlib}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Program name} & \texttt{\@ftname} \\ \hline
+ \textbf{Turn in files} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Makefile} & \texttt{\@ftmakefile} \\ \hline
+ \textbf{External functs.} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Libft authorized} & \texttt{\@ftlibft} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+ \newcommand{\makeheaderprg}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Program name} & \texttt{\@ftname} \\ \hline
+ \textbf{Turn in files} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Makefile} & \texttt{\@ftmakefile} \\ \hline
+ \textbf{Arguments} & \texttt{\@ftparams} \\ \hline
+ \textbf{External functs.} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Libft authorized} & \texttt{\@ftlibft} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+
+ \newcommand{\exmandatory}{Mandatory exercise}
+ \newcommand{\exretrovalid}{Retrovalidated exercise}
+ \newcommand{\exoptional}{Optional exercise}
+
+ \newcommand{\exercice}{Exercise}
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduce the behavior of the function \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42phpcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{html+php}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42jscode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{js}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \definecolor{darcula-back}{RGB}{35, 37, 37}
+
+ \makeatletter
+ \newenvironment{42javacode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{monokai}
+ \minted@resetoptions
+ \definecolor{dark}{RGB}{35, 37, 37}
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{java}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42xmlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{xml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42cppcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c++}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42asmcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{nasm}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ extendedchars=true,
+ literate={✓}{{\checkmark}}1,
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=false,
+ }
+ }{}
+
+ \newenvironment{42warning}
+ {\vspace*{1\baselineskip}
+ \par\begin{mdframed}[linewidth=2pt,linecolor=red]%
+ \begin{list}{}{\leftmargin=1cm
+ \labelwidth=\leftmargin}\item[\Large\ding{43}]}
+ {\end{list}\end{mdframed}\par \vspace*{1\baselineskip}}<
\ No newline at end of file
A latex/42-fr.cls => latex/42-fr.cls +887 -0
@@ 0,0 1,887 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42}[2010/07/15 v2.0
+ LaTeX class for 42-themed documents]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{R\'esum\'e}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[french]{babel}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{pifont,mdframed}
+ \usepackage{wallpaper}
+
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep10pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \TileWallPaper{\paperwidth}{\paperheight}{back}
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcommand*{\nextexercice}{
+ \stepcounter{exerciceCounter}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exmake}[1][Non]{\def \@exmake {#1}}
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Remarques : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ %\exauthorize
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Autoris\'ees : \ttfamily \@exauthorize }
+ \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Remarques : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans dossier de rendu
+ \newcommand{\makeheaderfilesnodirectory}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Autoris\'ees : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions interdites : \ttfamily \@exforbidden }
+ \\ \hline
+
+ %% \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ %% {\small Remarques : \ttfamily \@exnotes }
+ %% \\ \hline
+ \end{tabularx}
+ %% \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Aucune}
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercice : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Dossier de rendu: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compilateur : \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Flags de compilation:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile : \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {R\`{e}gles : \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fichiers \`a rendre : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarques : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fonctions Interdites : \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{Aucune}
+ \extitle{}
+ \exnumber{}
+ }
+
+ \newcommand{\ftname}[1]{\def \@ftname {#1}}
+ \newcommand{\ftprototype}[1]{\def \@ftprototype {#1}}
+ \newcommand{\ftdesc}[1]{\def \@ftdesc {#1}}
+ \newcommand{\ftparams}[1]{\def \@ftparams {#1}}
+ \newcommand{\ftret}[1]{\def \@ftret {#1}}
+ \newcommand{\ftfuncts}[1]{\def \@ftfuncts {#1}}
+ \newcommand{\ftturnin}[1]{\def \@ftturnin {#1}}
+ \newcommand{\ftmakefile}[1]{\def \@ftmakefile {#1}}
+ \newcommand{\ftlibft}[1]{\def \@ftlibft {#1}}
+ \newcommand{\ftcompil}[1]{\def \@ftcompil {#1}}
+
+ \ftname{}
+ \ftprototype{}
+ \ftdesc{}
+ \ftparams{}
+ \ftret{}
+ \ftfuncts{}
+ \ftturnin{}
+ \ftmakefile{}
+ \ftlibft{}
+ \ftcompil{}
+
+
+ \newcolumntype{s}{>{\hsize=.5\hsize}X}
+ \newcolumntype{b}{>{\hsize=1.5\hsize}X}
+ \newcommand{\makeheaderfct}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Function name} & \texttt{\@ftname} \\ \hline
+ \textbf{Prototype} & \texttt{\@ftprototype} \\ \hline
+ \textbf{Fichiers de rendu} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Paramètres} & \texttt{\@ftparams} \\ \hline
+ \textbf{Valeur de retour} & \texttt{\@ftret} \\ \hline
+ \textbf{Fonctions externes autorisées} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+ \newcommand{\makeheaderlib}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Nom du programme} & \texttt{\@ftname} \\ \hline
+ \textbf{Fichiers de rendu} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Makefile} & \texttt{\@ftmakefile} \\ \hline
+ \textbf{Fonctions externes autorisées} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Libft autorisée} & \texttt{\@ftlibft} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+ \newcommand{\makeheaderprg}
+ {
+ \noindent
+
+ \begin{tabularx}{\textwidth}{| s | b |} \hline
+
+ \textbf{Nom du programme} & \texttt{\@ftname} \\ \hline
+ \textbf{Fichiers de rendu} & \texttt{\@ftturnin} \\ \hline
+ \textbf{Makefile} & \texttt{\@ftmakefile} \\ \hline
+ \textbf{Arguments} & \texttt{\@ftparams} \\ \hline
+ \textbf{Fonctions externes autorisées} & \texttt{\@ftfuncts} \\ \hline
+ \textbf{Libft autorisée} & \texttt{\@ftlibft} \\ \hline
+ \textbf{Description} & \texttt{\@ftdesc} \\ \hline
+
+ \end{tabularx}
+ }
+
+
+ \newcommand{\exmandatory}{Exercice obligatoire}
+ \newcommand{\exretrovalid}{Exercice rétrovalidable}
+ \newcommand{\exoptional}{Exercice bonus}
+
+ \newcommand{\exercice}{Exercice}
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduire \`a l'identique le fonctionnement de la fonction \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42phpcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{html+php}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42jscode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{js}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \definecolor{darcula-back}{RGB}{35, 37, 37}
+
+ \makeatletter
+ \newenvironment{42javacode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{monokai}
+ \minted@resetoptions
+ \definecolor{dark}{RGB}{35, 37, 37}
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{java}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42xmlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{xml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42cppcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c++}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42asmcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{nasm}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ extendedchars=true,
+ literate={✓}{{\checkmark}}1,
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=false,
+ }
+ }{}
+
+ \newenvironment{42warning}
+ {\vspace*{1\baselineskip}
+ \par\begin{mdframed}[linewidth=2pt,linecolor=red]%
+ \begin{list}{}{\leftmargin=1cm
+ \labelwidth=\leftmargin}\item[\Large\ding{43}]}
+ {\end{list}\end{mdframed}\par \vspace*{1\baselineskip}}
A latex/42-nl.cls => latex/42-nl.cls +755 -0
@@ 0,0 1,755 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42-en}[2014/08/22 v2.1
+ LaTeX class for 42-themed documents]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{Summary}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[dutch]{babel}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{pifont,mdframed}
+ \usepackage{wallpaper}
+
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep10pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \TileWallPaper{\paperwidth}{\paperheight}{back}
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcommand*{\nextexercice}{
+ \stepcounter{exerciceCounter}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exmake}[1][No]{\def \@exmake {#1}}
+
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{None}
+ \exforbidden{None}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Oefening : \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Aantekeningen : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Oefening \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Vergaarbak map : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Allowed functions : \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Aantekeningen : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory : \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in : \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden functions : \ttfamily \@exforbidden }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Remarks : \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{None}
+ \exforbidden{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercise \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize Score : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Turn-in directory: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compiler: \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Compilation flags:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile: \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {Makefile rules: \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Files to turn in: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Notes : \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Forbidden fonctions: \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{None}
+ \exauthorize{None}
+ \extitle{}
+ \exnumber{}
+ }
+
+ \newcommand{\exmandatory}{Mandatory exercise}
+ \newcommand{\exretrovalid}{Retrovalidated exercise}
+ \newcommand{\exoptional}{Optional exercise}
+
+ \newcommand{\exercice}{Exercise}
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduce the behavior of the function \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42phpcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{emacs}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{html+php}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \definecolor{darcula-back}{RGB}{35, 37, 37}
+
+ \makeatletter
+ \newenvironment{42javacode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{monokai}
+ \minted@resetoptions
+ \definecolor{dark}{RGB}{35, 37, 37}
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{java}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42xmlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{xml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42cppcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c++}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42asmcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{nasm}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=true,
+ }
+ }{}
+
+ \newenvironment{42warning}
+ {\vspace*{1\baselineskip}
+ \par\begin{mdframed}[linewidth=2pt,linecolor=red]%
+ \begin{list}{}{\leftmargin=1cm
+ \labelwidth=\leftmargin}\item[\Large\ding{43}]}
+ {\end{list}\end{mdframed}\par \vspace*{1\baselineskip}}
A latex/42-ro.cls => latex/42-ro.cls +689 -0
@@ 0,0 1,689 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42-ro.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, which means
+ % that linebreaks don't happen automatically. Since \abstract (among
+ % others) uses \emph, the abstract is unreadable by default.
+ % Please read thoroughly ulem's doc before using it.
+ % See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline
+
+ %%
+ %% II - General LaTeX boilerplate
+ %%
+
+ %% II.1 - Definition
+
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
+ \ProvidesClass{42-ro}[2010/07/15 v2.0
+ LaTeX class for 42-ro-themed documents]
+
+ %% II.2 - Class options and parent class
+
+ \newcommand{\summarytitle}{Sumar}%
+
+ \DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{report}
+ }
+
+ \ProcessOptions\relax
+ \LoadClass[a4paper,12pt,onecolumn]{report}
+
+ %% II.3 - Imports
+
+ \usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
+ \usepackage[pdftex]{graphicx}
+ \usepackage{url}
+ \usepackage{fancyhdr}
+ \usepackage{array}
+ \usepackage[table]{xcolor}
+ \usepackage[utf8x]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+ \usepackage{listings}
+ \usepackage{tabularx}
+ \usepackage{textcomp}
+ \usepackage{color}
+ \usepackage[pdftex]{hyperref}
+ \usepackage{fancybox}
+ \usepackage{float}
+ \usepackage{atbeginend} % provided locally : atbeginend.sty
+ \usepackage{tocloft} % provided locally : tocloft.sty
+ \usepackage{multirow} % provided locally : multirow.sty
+ \usepackage[romanian]{babel}
+
+ %\usepackage{amsfonts}
+ \usepackage{minted} % provided locally : minted.sty
+ % Minted requires the Python "Pygments" librairy (http://pygments.org/).
+ % Pygments can be easily installed with the "easy_install" paquet manager
+ % from the "python-setuptools" paquet (sudo easy_install Pygments).
+ \usepackage{wallpaper}
+ %% III - Lengths and color redefinitions
+
+ %% III.1 - Lengths
+
+ \AfterBegin{enumerate}{
+ \itemsep10pt%
+ }
+ \AfterBegin{itemize}{
+ \itemsep10pt%
+ \renewcommand{\labelitemi}{$\bullet$}%
+ \renewcommand{\labelitemii}{$\circ$}%
+ }
+
+ \BeforeBegin{enumerate}{\vspace{15pt}}
+ \AfterEnd{enumerate}{\vspace{15pt}}
+
+ \BeforeBegin{itemize}{\vspace{15pt}}
+ \AfterEnd{itemize}{\vspace{15pt}}
+
+ \BeforeBegin{lstlisting}{\vspace{15pt}}
+ \AfterEnd{lstlisting}{\vspace{15pt}}
+
+ \BeforeBegin{tabularx}{\vspace{15pt}}
+ \AfterEnd{tabularx}{\vspace{15pt}}
+
+ %% III.2 - Colors
+
+ \definecolor{nicergreen}{rgb}{0,0.502,0}
+ \definecolor{nicerblue}{rgb}{0,0.302,1}
+ \definecolor{nicerorange}{rgb}{1,0.502,0}
+ \definecolor{nicergrey}{rgb}{0.502,0.502,0.502}
+ \definecolor{nicerred}{rgb}{0.626,0,0}
+ \definecolor{hintbg}{rgb}{1.0,1.0,0.75}
+ \definecolor{warnbg}{rgb}{1.0,0.75,0.75}
+ \definecolor{infobg}{rgb}{0.75,0.75,1.0}
+ \definecolor{bibliotechbg}{RGB}{239,253,255}
+ \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+ \definecolor{darkgrey}{rgb}{0.1,0.1,0.1}
+ \definecolor{assholeblack}{rgb}{0,0,0}
+
+ %% III.3 - Hyperlinks
+
+ \hypersetup
+ {
+ colorlinks,
+ % citecolor=black, %
+ % filecolor=black, %
+ linkcolor=black, % black links
+ urlcolor=blue % blue URLs
+ }
+
+ %% III.4 - Listings
+
+ \lstset
+ {
+ backgroundcolor=\color{gray!15},
+ basicstyle=\small\ttfamily,
+ breaklines=true,
+ columns=fullflexible,
+ frame=lines,
+ tabsize=4,
+ numbers=none, %numbers=left,
+ numberstyle=\scriptsize\ttfamily,
+ numbersep=5pt,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ breaklines=true,
+ upquote=true,
+ float
+ }
+
+ %% III.5 - Page layout
+
+ \makeatletter
+ \pagestyle{fancy}
+ \lhead{\@title}
+ \rhead{\@subtitle}
+ \cfoot{\thepage}
+ \makeatother
+
+ %% III.6 - Roman chapter style
+
+ % custom sections style
+
+ \renewcommand{\thechapter}{\Roman{chapter}}
+
+ % Using roman numerals makes the TOC section/subsection numbers
+ % overflow on the right. This adds some margin to avoid that kind of
+ % problems. (requires \usepackage{tocloft})
+ \setlength{\cftchapnumwidth}{1.5cm}
+ \setlength{\cftsecnumwidth}{1.5cm}
+ \setlength{\cftsubsecnumwidth}{1.3cm}
+ \setlength{\cftsubsubsecnumwidth}{1.6cm}
+ \setlength{\cftaftertoctitleskip}{0.5cm}
+
+ %% IV - Frontpage customization
+
+ %% IV.1 - Custom fields
+ \makeatletter
+ \newcommand{\website}[1]{\def \@website {#1}}
+ \website{}
+
+ \newcommand{\subtitle}[1]{\def \@subtitle {#1}}
+ \subtitle{}
+
+ \newcommand{\schoollogo}[1]{\def \@schoollogo {#1}}
+ \schoollogo{42_logo.pdf}
+
+ \newcommand{\summary}[1]{\def \@summary {#1}}
+ \summary{}
+
+ \edef\@authors{}
+ \newcommand{\member}[2]{%
+ \protected@edef\@authors{\@authors #1 \protect\url{#2}\\}
+ \author{\@authors}
+ }
+ \author{}
+
+ %% IV.2 - Redefine \maketitle
+
+ \makeatletter
+ \def \maketitle {
+ \begin{titlepage}
+ \begin{center}
+ %\begin{figure}[t]
+ \includegraphics[height=8cm]{\@schoollogo}
+ %\end{figure}
+ \vskip 5em
+ {\huge \@title}
+ \vskip 2em
+ {\LARGE \@subtitle}
+ \vskip 4em
+ \end{center}
+ \begin{center}
+ \@author
+ \end{center}
+ \vskip 5em
+ \begin{center}
+ \emph{\summarytitle : \@summary}
+ \end{center}
+ \end{titlepage}
+ }
+ \makeatother
+
+ \TileWallPaper{\paperwidth}{\paperheight}{back}
+ %% IV.3 - Exercice number
+
+ \newcounter{exerciceCounter}
+ \newcommand*{\exercicenumber}{
+ \ifnum\value{exerciceCounter}<10 0\fi
+ \arabic{exerciceCounter}
+ }
+
+ \newcommand*{\startexercices}{
+ \setcounter{exerciceCounter}{0}
+ }
+
+ \newcounter{itemizeCounter}
+ \setcounter{itemizeCounter}{0}
+ \BeforeBegin{itemize}{
+ \addtocounter{itemizeCounter}{1}
+ }
+
+ \AfterEnd{itemize}{
+ \addtocounter{itemizeCounter}{-1}
+ \ifnum\value{itemizeCounter} = 0
+ \stepcounter{exerciceCounter}
+ \fi
+ }
+
+ %% V - Custom helper commands
+
+ %% V.1 - Hint/Warn
+
+ % hint command
+
+ \newcommand{\kbox}[3]
+ {
+ \vskip 15pt
+ \noindent
+ \colorbox{#1}
+ {
+ \begin{tabular*}{0.97\textwidth}{m{4em}m{0.8\textwidth}}
+ \includegraphics[width=4em]{#2}
+ & {\ttfamily\footnotesize #3}\\
+ \end{tabular*}
+ }
+ \vskip 15pt
+ }
+
+ \newcommand{\hint}[1]{\kbox{hintbg}{helphint.pdf}{#1}}
+ \newcommand{\warn}[1]{\kbox{warnbg}{warn.pdf}{#1}}
+ \newcommand{\info}[1]{\kbox{infobg}{info.pdf}{#1}}
+
+ %% V.2 Lisibility helper
+
+ \makeatletter
+ \newcommand{\mso}[1]{
+ \ttfamily #1 \normalfont
+ }
+
+ %% V.3 Exercise headers
+
+ \makeatletter
+ \newcommand{\turnindir}[1]{\def \@turnindir {#1}}
+ \newcommand{\daypiscine}[1]{\def \@daypiscine {#1}}
+ \newcommand{\extitle}[1]{\def \@extitle {#1}}
+ \newcommand{\exnumber}[1]{\def \@exnumber {#1}}
+ \newcommand{\exscore}[1]{\def \@exscore {#1}}
+ \newcommand{\exflags}[1][-W -Wall -Werror]{\def \@exflags {#1}}
+ \newcommand{\excompil}[1][gcc]{\def \@excompil {#1}}
+ \newcommand{\exrules}[1][n/a]{\def \@exrules {#1}}
+ \newcommand{\exfiles}[1]{\def \@exfiles {#1}}
+ \newcommand{\exnotes}[1][n/a]{\def \@exnotes {#1}}
+ \newcommand{\exauthorize}[1]{\def \@exauthorize {#1}}
+ \newcommand{\exforbidden}[1]{\def \@exforbidden {#1}}
+ \newcommand{\exmake}[1][Nu]{\def \@exmake {#1}}
+
+ % Default values
+ \turnindir{}
+ \daypiscine{}
+ \extitle{}
+ \exnumber{}
+ \exscore{}
+ \exflags{}
+ \excompil{}
+ \exrules{}
+ \exfiles{}
+ \exnotes{}
+ \exauthorize{Niciuna}
+ \exforbidden{Niciuna}
+ \exmake{}
+
+ %Header pour exercices sans rien a "rendre"
+ \newcommand{\makeheaderbasic}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercictiu: \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Observatii: \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ %\exauthorize
+ \exforbidden{Niciuna}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfilesforbidden}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercitiu: \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Director de lucru: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fisier(e) de iesire: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Functii interzise: \ttfamily \@exforbidden }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Observatii: \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Niciuna}
+ \exforbidden{Niciuna}
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices sans code mais fichiers a rendre
+ \newcommand{\makeheaderfiles}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercitiu: \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Director de lucru: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fisier(e) de iesire: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Functii autorizate: \ttfamily \@exauthorize }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Observatii: \ttfamily \@exnotes }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exauthorize{Niciuna}
+ \exforbidden
+ \extitle{}
+ \exnumber{}
+ }
+
+ %Header pour exercices de code
+ \newcommand{\makeheadercode}
+ {
+ \noindent
+ \begin{tabularx}{\textwidth}{|X X X X|}
+ \hline
+ \multicolumn{1}{|>{\raggedright}m{1cm}|}
+ {\vskip 2mm \includegraphics[height=1cm]{\@schoollogo}} &
+ \multicolumn{2}{>{\centering}m{12cm}}{\small Exercitiu: \@exnumber } &
+ \multicolumn{1}{ >{\raggedleft}p{1.5cm}|}
+ %% {\scriptsize points : \@exscore} \\ \hline
+ {} \\ \hline
+
+ \multicolumn{4}{|>{\centering}m{15cm}|}
+ {\small \@extitle} \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Director de lucru: \ttfamily
+ $ex\@exnumber/$ }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}}
+ {\small Compilator: \ttfamily \@excompil } &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {\small Flag-uri de compilare:
+ \ttfamily \@exflags }
+ \\ \hline
+
+ \multicolumn{2}{|>{\raggedright}m{7.52cm}}
+ {\small Makefile: \ttfamily{\@exmake}} &
+ \multicolumn{2}{|>{\raggedright}m{7.5cm}|}
+ {Reguli : \ttfamily \@exrules } \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Fisiere de iesire: \ttfamily \@exfiles }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Observatii: \ttfamily \@exnotes }
+ \\ \hline
+
+ \multicolumn{4}{|>{\raggedright}m{15cm}|}
+ {\small Functii interzise: \ttfamily \@exforbidden }
+ \\ \hline
+ \end{tabularx}
+ \exnotes
+ \exrules
+ \exmake
+ \exforbidden{Niciuna}
+ \extitle{}
+ \exnumber{}
+ }
+
+ \newcommand{\exmandatory}{Exercitiile obligatorii}
+ \newcommand{\exretrovalid}{Exercitiile retrovalidabile}
+ \newcommand{\exoptional}{Exercitiile bonus}
+
+ \newcommand{\exercice}{Exercitiile}
+
+ %% V.4 Reproduction from man
+ \newcommand{\reproductionfromman}[1]{Reproduceti identic comportamentul functiei \texttt{#1} (man #1).}
+
+ %% VI - Syntactic highlights
+
+
+ %% Styles:
+ %% ~~~~~~~
+ %% * monokai:
+ %% This style mimics the Monokai color scheme.
+ %% * manni:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * rrt:
+ %% Minimalistic ``rrt'' theme, based on Zap and Emacs defaults.
+ %% * perldoc:
+ %% Style similar to the style used in the perldoc code blocks.
+ %% * borland:
+ %% Style similar to the style used in the borland IDEs.
+ %% * colorful:
+ %% A colorful style, inspired by CodeRay.
+ %% * default:
+ %% The default style (inspired by Emacs 22).
+ %% * murphy:
+ %% Murphy's style from CodeRay.
+ %% * vs:
+ %%
+ %% * trac:
+ %% Port of the default trac highlighter design.
+ %% * tango:
+ %% The Crunchy default Style inspired from the color palette from the Tango Icon Theme Guidelines.
+ %% * fruity:
+ %% Pygments version of the ``native'' vim theme.
+ %% * autumn:
+ %% A colorful style, inspired by the terminal highlighting style.
+ %% * bw:
+ %%
+ %% * emacs:
+ %% The default style (inspired by Emacs 22).
+ %% * vim:
+ %% Styles somewhat like vim 7.0
+ %% * pastie:
+ %% Style similar to the pastie default style.
+ %% * friendly:
+ %% A modern style based on the VIM pyte theme.
+ %% * native:
+ %% Pygments version of the ``native'' vim theme.
+
+
+
+ %\usemintedstyle{monokai}
+ %\usemintedstyle{manni}
+ %\usemintedstyle{rrt}
+ %\usemintedstyle{perldoc}
+ %\usemintedstyle{borland}
+ %\usemintedstyle{colorful}
+ %\usemintedstyle{default}
+ %\usemintedstyle{murphy}
+ %\usemintedstyle{vs}
+ %\usemintedstyle{trac}
+ %\usemintedstyle{tango}
+ %\usemintedstyle{fruity}
+ %\usemintedstyle{autumn}
+ %\usemintedstyle{bw}
+ %\usemintedstyle{emacs}
+ %\usemintedstyle{vim}
+ %\usemintedstyle{pastie}
+ %\usemintedstyle{friendly}
+ %\usemintedstyle{native}
+
+ \makeatletter
+ \newenvironment{42ccode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{c}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42ocamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{ocaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \definecolor{darcula-back}{RGB}{35, 37, 37}
+
+ \makeatletter
+ \newenvironment{42javacode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{monokai}
+ \minted@resetoptions
+ \definecolor{dark}{RGB}{35, 37, 37}
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{java}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+ \makeatletter
+ \newenvironment{42xmlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=darcula-back,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%[
+ \end{VerbatimOut}
+ \minted@pygmentize{xml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \makeatletter
+ \newenvironment{42yamlcode}{%
+ \VerbatimEnvironment
+ \usemintedstyle{native}
+ \minted@resetoptions
+ \setkeys{minted@opt}{bgcolor=black,formatcom=\color{lightgrey},fontsize=\scriptsize}
+ \begin{figure}[ht!]
+ \centering
+ \begin{minipage}{16cm}
+ \begin{VerbatimOut}{\jobname.pyg}}
+ {%
+ \end{VerbatimOut}
+ \minted@pygmentize{yaml}
+ \DeleteFile{\jobname.pyg}
+ \end{minipage}
+ \end{figure}}
+ \makeatother
+
+
+ \lstnewenvironment{42console} {
+ \lstset {
+ basicstyle=\color{lightgrey}\scriptsize\ttfamily,
+ backgroundcolor=\color{assholeblack},
+ breaklines=true,
+ numberstyle=\scriptsize,
+ columns=flexible,
+ keepspaces=true,
+ }
+ }{}
A latex/Makefile => latex/Makefile +7 -0
@@ 0,0 1,7 @@
+ TARGETS = kfs_1.en.pdf
+ DEPS =
+ RELPATH = ../latex
+
+ # You should not touch this
+ include $(RELPATH)/Makefile.LaTeX
+
A latex/Makefile.LaTeX => latex/Makefile.LaTeX +51 -0
@@ 0,0 1,51 @@
+ #******************************************************************************#
+ # #
+ # Makefile.LaTeX for LaTeX #
+ # Created on : Mon Oct 5 17:01:29 2015 #
+ # Make by : Uriel "Korfuri" Corfa <uriel@corfa.fr> #
+ # Made by : David "Thor" GIRON <thor@staff.42.fr> #
+ # #
+ #******************************************************************************#
+
+ RESSOURCE_FILES = $(RELPATH)/Makefile.LaTeX \
+ $(RELPATH)/atbeginend.sty \
+ $(RELPATH)/tocloft.sty \
+ $(RELPATH)/minted.sty \
+ $(RELPATH)/multirow.sty \
+ $(RELPATH)/42-fr.cls \
+ $(RELPATH)/back.pdf \
+ $(RELPATH)/42_logo.pdf \
+ $(RELPATH)/info.pdf \
+ $(RELPATH)/helphint.pdf \
+ $(RELPATH)/warn.pdf
+
+ ALL_DEPENDENCIES = $(RESSOURCE_FILES) $(DEPS)
+
+ export TEXINPUTS := ..:.:$(RELPATH):${TEXINPUTS}:
+
+ all: $(TARGETS)
+
+ clean:
+ rm -f *.aux *.ent *.log *.out *.toc *.nav *.snm *.vrb *.pyg
+
+ distclean: clean
+ rm -f $(TARGETS)
+
+ re: distclean all
+
+ %.pdf: %.tex Makefile $(ALL_DEPENDENCIES)
+ pdflatex -shell-escape -halt-on-error $<
+ @if [ $$? = 0 ]; then\
+ pdflatex -shell-escape -halt-on-error $<;\
+ echo "Build OK";\
+ else\
+ echo "Build Failed";\
+ exit 1;\
+ fi
+
+ view: all
+ (type xpdf > /dev/null 2>&1 && xpdf ${TARGETS}) ||\
+ (type evince > /dev/null 2>&1 && evince ${TARGETS})
+
+
+ #******************************************************************************#
A latex/Makefile.template => latex/Makefile.template +12 -0
@@ 0,0 1,12 @@
+ # List the pdf's to build. foo.tex will produce foo.pdf
+ TARGETS = foo.pdf
+
+ # List the files included in the slides
+ DEPS = somePicture.png someSound.flac someOtherPicture.png
+
+ # Relative path to the LaTeX documentclass setup files
+ # Adapt as needed
+ RELPATH = $(shell git rev-parse --show-toplevel)/templates/latex/
+
+ # You should not touch this either
+ include $(RELPATH)/Makefile.LaTeX
A latex/atbeginend.sty => latex/atbeginend.sty +67 -0
@@ 0,0 1,67 @@
+ % atbeginend.sty
+ %
+ % From : http://www.eng.cam.ac.uk/help/tpl/textprocessing/atbeginend.sty
+ %
+ % defines
+ % \BeforeBegin{environment}{code-to-execute}
+ % \BeforeEnd {environment}{code-to-execute}
+ % \AfterBegin {environment}{code-to-execute}
+ % \AfterEnd {environment}{code-to-execute}
+ %
+ % Save \begin and \end to \BeginEnvironment and \EndEnvironment
+ \let\BeginEnvironment=\begin
+ \let\EndEnvironment=\end
+
+ \def\IfUnDef#1{\expandafter\ifx\csname#1\endcsname\relax}
+
+ % Null command needed to for \nothing{something}=.nothing.
+ \def\NullCom#1{}
+
+ \def\begin#1{%
+ %
+ % if defined \BeforeBeg for this environment, execute it
+ \IfUnDef{BeforeBeg#1}\else\csname BeforeBeg#1\endcsname\fi%
+ %
+ %
+ %
+ \IfUnDef{AfterBeg#1}% This is done to skip the command for environments
+ % which can take arguments, like multicols; YOU MUST NOT
+ % USE \AfterBegin{...}{...} for such environments!
+ \let\SaveBegEng=\BeginEnvironment%
+ \else%
+ % Start this environment
+ \BeginEnvironment{#1}%
+ % and execute code after \begin{environment}
+ \csname AfterBeg#1\endcsname%
+ %
+ \let\SaveBegEng=\NullCom%
+ \fi%
+ \SaveBegEng{#1}%
+ }
+
+
+ \def\end#1{%
+ %
+ % execute code before \end{environment}
+ \IfUnDef{BeforeEnd#1}\else\csname BeforeEnd#1\endcsname\fi%
+ %
+ % close this environment
+ \EndEnvironment{#1}%
+ %
+ % and execute code after \begin{environment}
+ \IfUnDef{AfterEnd#1}\else\csname AfterEnd#1\endcsname\fi%
+ }
+
+
+ %% Now, define commands
+ % \BeforeBegin{environment}{code-to-execute}
+ % \BeforeEnd {environment}{code-to-execute}
+ % \AfterBegin {environment}{code-to-execute}
+ % \AfterEnd {environment}{code-to-execute}
+
+ \def\BeforeBegin#1#2{\expandafter\gdef\csname BeforeBeg#1\endcsname
+ {#2}}
+ \def\BeforeEnd #1#2{\expandafter\gdef\csname BeforeEnd#1\endcsname
+ {#2}}
+ \def\AfterBegin #1#2{\expandafter\gdef\csname AfterBeg#1\endcsname {#2}}
+ \def\AfterEnd #1#2{\expandafter\gdef\csname AfterEnd#1\endcsname{#2}}
A latex/dark-42-fr.cls => latex/dark-42-fr.cls +779 -0
@@ 0,0 1,779 @@
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % 42.cls
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %
+ % Authors:
+ % - Maxime "zaz" Montinet
+ % - David "Thor" Giron
+ %
+ % Contributors:
+ % - Mathieu Mahé
+ % - Gaëtan JUVIN
+ % - Unknown for now
+ %
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ % This class provides a layout for teaching material at 42.
+ %
+ % This class is organized this way :
+ %
+ % I - Documentation
+ % 1. Incompatibilites
+ % II - General LaTeX boilerplate
+ % 1. Definition
+ % 2. Class options and parent class
+ % 3. Imports
+ % III - Lengths and color redefinitions
+ % 1. Lenghts
+ % 2. Colors
+ % 3. Hyperlinks
+ % 4. Listings
+ % 5. Page layout
+ % 6. Roman numerals for chapters
+ % IV - Frontpage customization
+ % 1. Custom fields
+ % 2. Redefinition of \maketitle
+ % 3. Exercice number
+ % V - Custom helper commands
+ % 1. Hint/warn
+ % 2. Lisibility helper
+ % 3. Exercise headers
+ % 4. Reproduction from man
+
+ %%
+ %% I - Documentation
+ %%
+
+ %% I.1 - Incompatibilities
+
+ % Package ulem:
+ % The package ulem has a lot of oddities. Using it is not always a
+ % good idea. If you really want to do so, you should import it with
+ % the [normalem] option, as such :
+ % \usepackage[normalem]{ulem}
+ % Otherwise, it overrides \emph to underline the emphasized text. So
+ % far so good, but underlined text is typesetted in a box, whic