condom 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,9 @@
1
+ 0.1.0
2
+ =====
3
+
4
+ Added the language option. This option should be a LaTeX language. Default is 'francais'.
5
+
6
+ 0.0.1
7
+ =====
8
+
9
+ Initial version of Condom gem.
data/README ADDED
@@ -0,0 +1,85 @@
1
+ Condom
2
+ ------
3
+
4
+ A Ruby lib to create a skeleton for a LaTeX document.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ $ gem install condom
10
+
11
+ Usage
12
+ -----
13
+
14
+ For the usage of the lib, see the documentation (gem server for example).
15
+
16
+ Condom gem provides a condom shell command.
17
+
18
+ $ condom --help
19
+ Usage: condom [options] [destination]
20
+ Available options:
21
+ -m, --math Math packages
22
+ -l, --listings Listings package
23
+ -f, --fancyhdr Fancyhdr package
24
+ -p, --pdf PDF config
25
+ -g, --graphics Images packages
26
+ -n, --filename=FILENAME Define a file name
27
+ -a, --author=AUTHOR Define the author
28
+ -t, --title=TITLE Define the title
29
+ -d, --date=DATE Define the date
30
+ -c, --class=CLASS Define the document class
31
+ -P, --package=PACKAGE Add another package
32
+ -v, --version Print version
33
+ destination:
34
+ /home/v0n (current directory)
35
+
36
+ In generated files, there is a Makefile.
37
+ Just use your document this way (from the source folder):
38
+ - compile with:
39
+ $ make
40
+ or
41
+ $ make view # this will open the generated document after
42
+
43
+ - clean sources with:
44
+ $ make clean
45
+
46
+ - archive the whole document with:
47
+ $ make archive
48
+
49
+ Technique
50
+ ---------
51
+
52
+ The following command:
53
+ $ condom -mlfpg -t "Condom makes LaTeX easier" here
54
+
55
+ will generate:
56
+ here/
57
+ ├── fig
58
+ ├── fig.tex
59
+ ├── inc
60
+ │   ├── colors.tex
61
+ │   ├── commands.tex
62
+ │   ├── lst-conf.tex
63
+ │   └── packages.tex
64
+ ├── main.tex
65
+ ├── Makefile
66
+ └── src
67
+
68
+ fig/
69
+ This is the folder where you should put your images.
70
+
71
+ inc/
72
+ This folder has all configuration tex files:
73
+ colors.tex - customized colors
74
+ commands.tex - customized commands
75
+ lst-conf.tex - configuration file for the listings package
76
+ packages - all needed packages
77
+
78
+ main.tex
79
+ The main tex file. If you specify a filename with -n option, then the generated pdf file will have this name, not the main tex file.
80
+
81
+ Makefile
82
+ Makefile to manage your document sources easily (see the usage above).
83
+
84
+ src/
85
+ This is the folder where to put listings (a result of -l option).
data/bin/condom ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/ruby -w
2
+ # Command line tool for Condom
3
+
4
+ # Add ../lib to the load path
5
+ #lib_dir = File.join(File.dirname(__FILE__), '..', 'lib')
6
+ #$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
7
+
8
+ require 'condom'
9
+ require 'optparse'
10
+ require 'yaml'
11
+
12
+ ops = Condom::Document::DEFAULT_OPTIONS
13
+
14
+ ARGV.options do |o|
15
+ o.banner = "Usage: #{File.basename $0} [options] [destination]\n"
16
+ o.on_head("Available options:")
17
+
18
+ o.on("-m", "--math", "Math packages") { ops[:math] = true }
19
+ o.on("-l", "--listings", "Listings package") { ops[:listings] = true }
20
+ o.on("-f", "--fancyhdr", "Fancyhdr package") { ops[:fancyhdr] = true }
21
+ o.on("-p", "--pdf", "PDF config") { ops[:pdf] = true }
22
+ o.on("-g", "--graphics", "Images packages") { ops[:graphics] = true }
23
+ o.on("-n", "--filename=FILENAME", String, "Define a file name") { |v| ops[:filename] = v }
24
+ o.on("-a", "--author=AUTHOR", String, "Define the author") { |v| ops[:author] = v }
25
+ o.on("-t", "--title=TITLE", String, "Define the title") { |v| ops[:title] = v }
26
+ o.on("-d", "--date=DATE", String, "Define the date") { |v| ops[:date] = v }
27
+ o.on("-c", "--class=CLASS", String, "Define the document class") { |v| ops[:document_class] = v }
28
+ o.on("-L", "--language=LANGUAGE", String, "Define the language") { |v| ops[:language] = v }
29
+ o.on("-P", "--package=PACKAGE", String, "Add another package") { |v| ops[:packages].push v }
30
+ #o.on("-v", "--version", "Print version") { puts "Condom lib: version #{Condom::VERSION}" ; exit }
31
+
32
+ o.on_tail("destination:\n " << ops[:outputdir] + (ops[:outputdir] == Dir.getwd ? " (current directory)" : ""))
33
+ end
34
+
35
+ begin
36
+ ARGV.options.parse!
37
+
38
+ raise "Bad syntax." if ARGV.length > 1
39
+ if ARGV.length == 1
40
+ ops[:outputdir] = (ARGV.first == ".") ? Dir.getwd : ARGV.first
41
+ end
42
+
43
+ # Ask for confirmation
44
+ puts ops.to_yaml # Could it be prettier?
45
+ print "\nContinue [Y/n/h]? "
46
+ case STDIN.gets.strip
47
+ when 'Y', 'y', ''
48
+ when 'h'
49
+ puts ARGV.options
50
+ exit
51
+ else
52
+ puts "Cancel."
53
+ exit
54
+ end
55
+
56
+ doc = Condom::Document.new(ops)
57
+ doc.create
58
+
59
+ puts "OK"
60
+ rescue => e
61
+ STDERR.puts "error: #{e}"
62
+ end
63
+
64
+ exit
data/lib/condom.rb ADDED
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/ruby -w
2
+
3
+ #TODO Split author with space to get firstname and lastname?
4
+
5
+ require 'etc'
6
+ require 'erb'
7
+ require 'fileutils'
8
+
9
+ # The Condom module
10
+ module Condom
11
+ # Constant views directory
12
+ VIEWS_DIR = File.join(File.expand_path(File.dirname(__FILE__)), 'views')
13
+
14
+ # Function to get the name of the user.
15
+ # It will be the name in the /etc/passwd file (on Un*x system)
16
+ # or the system user.
17
+ def Condom.get_user_name
18
+ user = Etc.getpwnam(Etc.getlogin)['gecos'].split(',').first
19
+ user = Etc.getlogin if user.nil?
20
+
21
+ return user
22
+ end
23
+
24
+ # The Document class.
25
+ # This is the main class of the condom lib.
26
+ class Document
27
+ attr_accessor :outputdir,
28
+ :listings, :fancyhdr, :graphics, :math, :pdf,
29
+ :filename, :author, :title, :date, :document_class, :language,
30
+ :packages
31
+
32
+ # The default options
33
+ DEFAULT_OPTIONS = {
34
+ :outputdir => Dir.getwd,
35
+ :listings => false,
36
+ :fancyhdr => false,
37
+ :graphics => false,
38
+ :math => false,
39
+ :pdf => true,
40
+ :filename => 'main',
41
+ :author => Condom.get_user_name,
42
+ :title => 'Document \LaTeX',
43
+ :date => '\today',
44
+ :document_class => 'article',
45
+ :language => 'francais',
46
+ :packages => Array.new
47
+ }
48
+
49
+ # The constructor.
50
+ # Argument could be nothing,
51
+ # the title of the document,
52
+ # a hash of options.
53
+ def initialize(*args)
54
+ # Need to initialize each variables else they won't exist in instance_variables.
55
+ @outputdir = @listings = @fancyhdr = @graphics = @math = @pdf = @filename = @author = @title = @date = @document_class = @language = @packages = nil
56
+
57
+ set_options DEFAULT_OPTIONS
58
+
59
+ arg = args.first
60
+ if arg.is_a? String
61
+ @title = arg
62
+ elsif arg.is_a? Hash
63
+ set_options arg
64
+ end
65
+ end
66
+
67
+ # This method returns a hash of the options of the document.
68
+ def get_options
69
+ hash = Hash.new
70
+ instance_variables.each do |var|
71
+ hash[var[1..-1].to_sym] = instance_variable_get(var)
72
+ end
73
+
74
+ return hash
75
+ end
76
+
77
+ # This method sets options of the document given in a hash
78
+ def set_options(hash)
79
+ hash.keys.each do |key|
80
+ var = '@' << key.to_s
81
+ raise("Key #{key} not supported.") unless instance_variables.include? var
82
+ instance_variable_set(var, hash[key])
83
+ end
84
+ end
85
+
86
+ # This method creates the output directory (if needed)
87
+ # and write in it all files needed.
88
+ def create
89
+ # Verify output
90
+ FileUtils.makedirs @outputdir
91
+ Dir.chdir @outputdir do
92
+ raise("#{@outputdir}: it already exists a main.tex file") if File.exist? "main.tex"
93
+ raise("#{@outputdir}: it already exists a Makefile") if File.exist? "Makefile"
94
+
95
+ # Create files
96
+ if @document_class == "beamer"
97
+ build "main_beamer.tex"
98
+ else
99
+ build "main.tex"
100
+ end
101
+ build "Makefile"
102
+ if @graphics
103
+ build "fig.tex"
104
+ Dir.mkdir "fig"
105
+ end
106
+ Dir.mkdir "src" if @listings
107
+ Dir.mkdir "inc"
108
+ Dir.chdir "inc" do
109
+ build "packages.tex"
110
+ build "commands.tex"
111
+ build "colors.tex"
112
+ build "lst-conf.tex" if @listings
113
+ build "flyleaf.tex" if @document_class == "report"
114
+ end
115
+ end
116
+ end
117
+
118
+ private
119
+
120
+ # This fonction writes a file from its template
121
+ def build template
122
+ file = (template == "main_beamer.tex") ? "main.tex" : template
123
+
124
+ erb = File.read(File.join(VIEWS_DIR, template + ".erb"))
125
+ content = ERB.new(erb).result(binding)
126
+ File.open(file, 'w') do |f|
127
+ f.write content
128
+ end
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,33 @@
1
+ # Makefile
2
+ # generated on <%= Time.now %>
3
+ # by <%= @author %> with the Condom lib
4
+
5
+ FINAL_FILENAME=<%= @filename %>
6
+ FILENAME=main
7
+ VIEWER=xdg-open
8
+ RUBBER=$(shell which rubber)
9
+
10
+ all: $(FILENAME).tex
11
+ ifeq ($(RUBBER),)
12
+ @pdflatex $(FILENAME).tex
13
+ @pdflatex $(FILENAME).tex
14
+ @echo -e "\nYou should install the rubber package ;)"
15
+ else
16
+ @$(RUBBER) -d $(FILENAME).tex
17
+ endif
18
+ ifneq ($(FILENAME),$(FINAL_FILENAME))
19
+ @mv $(FILENAME).pdf $(FINAL_FILENAME).pdf
20
+ endif
21
+
22
+ view: all
23
+ @$(VIEWER) $(FINAL_FILENAME).pdf
24
+
25
+ clean:
26
+ @echo "cleaning..."
27
+ @rm -f *.aux *.log *.out *.toc *.lol<% if @listings %> *.lof<% end %><% if @document_class == "beamer" %> *.nav *.snm<% end %><% unless @document_class == "beamer" %>
28
+ @rm -f inc/*.aux<% end %>
29
+ @rm -f $(FINAL_FILENAME).tar
30
+
31
+ archive: all clean
32
+ @tar -cf $(FINAL_FILENAME).tar *
33
+ @echo "archived in $(FINAL_FILENAME).tar"
@@ -0,0 +1,19 @@
1
+ % Colors Bright Colors
2
+ % Black #0F2130 #B0B3B9
3
+ % Red #D22613 #F96795
4
+ % Green #7CDE53 #A0F2A0
5
+ % Yellow #EBE645 #F4EF82
6
+ % Blue #2C9ADE #A3FEFE
7
+ % Orange #FFA705 #F1B356
8
+ % Cyan #8A95A7 #B0C3DA
9
+ % White #F8F8F8 #FFFFFF
10
+
11
+ \definecolor{myblack}{HTML}{0F2130}
12
+ \definecolor{myred}{HTML}{D22613}
13
+ \definecolor{mygreen}{HTML}{7CDE53}
14
+ \definecolor{myyellow}{HTML}{EBE645}
15
+ \definecolor{myblue}{HTML}{2C9ADE}
16
+ \definecolor{myorange}{HTML}{FFA705}
17
+ \definecolor{mycyan}{HTML}{8A95A7}
18
+ \definecolor{mywhite}{HTML}{F8F8F8}
19
+ \definecolor{mygrey}{HTML}{555753}
@@ -0,0 +1,38 @@
1
+ % raccourcis
2
+ <% if @language == "francais" %>
3
+ \newcommand{\Cad}{C'est-à-dire~}
4
+ \newcommand{\cad}{c'est-à-dire~}
5
+ \newcommand{\pe}{peut-être~}
6
+ <% end %>
7
+
8
+ \newcommand{\todo}[1]{\bigskip \colorbox{myyellow}{\textcolor{mygrey}{\textsf{\textbf{TODO} #1 }}} \bigskip}
9
+
10
+ \newcommand{\name}[2]{#1 \textsc{#2}}
11
+
12
+ <% if @pdf %>
13
+ \newcommand{\email}[1]{\href{mailto:#1}{\textsf{<#1>}}}
14
+ <% end %>
15
+
16
+ <% if @graphics %>
17
+ % commande pour afficher un lien vers une image
18
+ \newcommand{\figref}[1]{\textsc{Fig.}~\ref{#1} (p.~\pageref{#1})}
19
+ <% end %>
20
+
21
+ <% if @listings %>
22
+ % commande pour afficher le lien vers un listing :
23
+ \newcommand{\lstref}[1]{{\footnotesize Listing~\ref{#1}, p.~\pageref{#1}}}
24
+ <% end %>
25
+
26
+ <% if @document_class == "report" %>
27
+ \newcommand{\unnumchap}[1]{%
28
+ \chapter*{#1}%
29
+ \addcontentsline{toc}{chapter}{#1}%
30
+ \chaptermark{#1}%
31
+ }
32
+
33
+ \newcommand{\unnumpart}[1]{%
34
+ \part*{#1}%
35
+ \addcontentsline{toc}{part}{#1}%
36
+ }
37
+ <% end %>
38
+
@@ -0,0 +1,58 @@
1
+ % tips to insert images in LaTeX
2
+ % generated on <%= Time.now %>
3
+ % by <%= @author %> with the Condom lib
4
+
5
+ % [!h] est facultatif, ca permet d'indiquer la position de la figure (si possible !)
6
+ % ! = forcer la position
7
+ % h = here
8
+ % t = top
9
+ % b = bottom
10
+ % p = page separee
11
+ % si il y a un probleme avec le positionnement, il peut etre force avec la position [H] (necessite le paquet float)
12
+
13
+ \begin{figure}[!h]
14
+ \begin{center}
15
+ %\includegraphics[width=5cm]{images/freebsd.png}
16
+ %\includegraphics[height=4cm]{images/freebsd.png}
17
+ \includegraphics{images/freebsd.png}
18
+ \caption{\label{freebsd}Logo de FreeBSD}
19
+ \end{center}
20
+ \end{figure}
21
+
22
+ % images cotes a cotes avec une seule legende
23
+ % note de bas de page dans un caption (\footnote ne peut pas etre utilise)
24
+ \begin{figure}[!h]
25
+ \begin{center}
26
+ \includegraphics[height=2cm]{images/freebsd.png}
27
+ \hspace{1cm} % espace horizontal (facultatif)
28
+ \includegraphics[height=2cm]{images/openbsd.png}
29
+ \hspace{1cm}
30
+ \includegraphics[height=2cm]{images/netbsd.png}
31
+ \end{center}
32
+ \caption{FreeBSD, OpenBSD et NetBSD\protect\footnotemark}
33
+ \end{figure}
34
+ \footnotetext{Tous des systemes d'exploitation libres.}
35
+
36
+ % images cotes a cotes avec une legende pour chaque
37
+ % si 2 images, mettre comme largeur 0.5\textwidth
38
+ \begin{figure}[!h]
39
+ \begin{minipage}{0.33\textwidth}
40
+ \begin{center}
41
+ \includegraphics[height=2cm]{images/freebsd.png}
42
+ \caption{FreeBSD}
43
+ \end{center}
44
+ \end{minipage}
45
+ \begin{minipage}{0.33\textwidth}
46
+ \begin{center}
47
+ \includegraphics[height=2cm]{images/openbsd.png}
48
+ \caption{OpenBSD}
49
+ \end{center}
50
+ \end{minipage}
51
+ \begin{minipage}{0.33\textwidth}
52
+ \begin{center}
53
+ \includegraphics[height=2cm]{images/netbsd.png}
54
+ \caption{NetBSD}
55
+ \end{center}
56
+ \end{minipage}
57
+ \end{figure}
58
+
@@ -0,0 +1,57 @@
1
+ % custom flyleaf
2
+ % generated on <%= Time.now %>
3
+ % by <%= @author %> with the Condom lib
4
+
5
+ % voir http://zoonek.free.fr/LaTeX/LaTeX_samples_title/0.html pour d'autres modeles
6
+
7
+ \makeatletter
8
+ % commandes supplementaires
9
+ \def\location#1{\def\@location{#1}}
10
+ \def\blurb#1{\def\@blurb{#1}}
11
+
12
+ \def\clap#1{\hbox to 0pt{\hss #1\hss}}%
13
+ \def\ligne#1{%
14
+ \hbox to \hsize{%
15
+ \vbox{\centering #1}}%
16
+ }%
17
+ \def\haut#1#2#3{%
18
+ \hbox to \hsize{%
19
+ \rlap{\vtop{\raggedright #1}}%
20
+ \hss
21
+ \clap{\vtop{\centering #2}}%
22
+ \hss
23
+ \llap{\vtop{\raggedleft #3}}}%
24
+ }%
25
+ \def\bas#1#2#3{%
26
+ \hbox to \hsize{%
27
+ \rlap{\vbox{\raggedright #1}}%
28
+ \hss
29
+ \clap{\vbox{\centering #2}}%
30
+ \hss
31
+ \llap{\vbox{\raggedleft #3}}}%
32
+ }%
33
+ \def\maketitle{%
34
+ \thispagestyle{empty}\vbox to \vsize{%
35
+ \haut{}{\@blurb}{}
36
+ \vfill
37
+ \vspace{1cm}
38
+ \begin{flushleft}
39
+ \usefont{OT1}{ptm}{m}{n}
40
+ \huge \@title
41
+ \end{flushleft}
42
+ \par
43
+ \hrule height 4pt
44
+ \par
45
+ \begin{flushright}
46
+ \Large \@author
47
+ \par
48
+ \end{flushright}
49
+ \vspace{1cm}
50
+ \vfill
51
+ \vfill
52
+ \bas{}{\@location, \@date}{}
53
+ }%
54
+ \cleardoublepage
55
+ }
56
+ \makeatother
57
+
@@ -0,0 +1,104 @@
1
+ % listings package config file
2
+ % generated on <%= Time.now %>
3
+ % by <%= @author %> with the Condom lib
4
+
5
+ % /!\ ne pas utiliser de caracteres accentues dans les sources (ne gere pas l'utf-8)
6
+ % pour remplacer les lettres accentues : sed -i -e "y/ÉÈÊÇÀÔéèçàôîêûùï/EEECAOeecaoieuui/" fichier
7
+
8
+ % configuration des listings par defaut :
9
+ \lstset{
10
+ basicstyle=\footnotesize\ttfamily,
11
+ %numbers=left,
12
+ numberstyle=\tiny,
13
+ %stepnumber=2,
14
+ numbersep=5pt,
15
+ tabsize=2,
16
+ extendedchars=true,
17
+ breaklines=true,
18
+ frame=b,
19
+ keywordstyle=\color{red},
20
+ %keywordstyle=[1]\textbf,
21
+ %keywordstyle=[2]\textbf,
22
+ %keywordstyle=[3]\textbf,
23
+ %keywordstyle=[4]\textbf,
24
+ stringstyle=\color{white}\ttfamily,
25
+ showspaces=false,
26
+ showtabs=false,
27
+ xleftmargin=17pt,
28
+ framexleftmargin=17pt,
29
+ framexrightmargin=5pt,
30
+ framexbottommargin=4pt,
31
+ %backgroundcolor=\color{lightgray},
32
+ showstringspaces=false
33
+ }
34
+
35
+ \lstloadlanguages{
36
+ %[Visual]Basic
37
+ %Pascal
38
+ %C
39
+ %C++
40
+ %XML
41
+ %HTML
42
+ %Java
43
+ }
44
+ %\DeclareCaptionFont{blue}{\color{blue}}
45
+
46
+ %\captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}}
47
+ \DeclareCaptionFont{white}{\color{white}}
48
+ \DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
49
+ \captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}
50
+
51
+ % configuration des listings C :
52
+ \lstnewenvironment{C}
53
+ {\lstset{%
54
+ language=C,
55
+ tabsize=3,
56
+ xleftmargin=0.75cm,
57
+ numbers=left,
58
+ numberstyle=\tiny,
59
+ extendedchars=true,
60
+ %frame=single,
61
+ %frameround=tttt,
62
+ framexleftmargin=8mm,
63
+ float,
64
+ showstringspaces=true,
65
+ showspaces=false,
66
+ showtabs=false,
67
+ breaklines=true,
68
+ backgroundcolor=\color{mywhite},
69
+ basicstyle=\color{myblack} \small,
70
+ keywordstyle=\color{myred} \bfseries,
71
+ ndkeywordstyle=\color{myred} \bfseries,
72
+ commentstyle=\color{myblue} \itshape,
73
+ identifierstyle=\color{myyellow},
74
+ stringstyle=\color{mygreen}
75
+ }}
76
+ {}
77
+
78
+ % configuration des listings console :
79
+ \lstnewenvironment{console}
80
+ {\lstset{%
81
+ language={},
82
+ numbers=none,
83
+ extendedchars=true,
84
+ framexleftmargin=5mm,
85
+ %float,
86
+ showstringspaces=false,
87
+ showspaces=false,
88
+ showtabs=false,
89
+ breaklines=false,
90
+ backgroundcolor=\color{darkgray},
91
+ basicstyle=\color{white} \scriptsize \ttfamily,
92
+ keywordstyle=\color{white},
93
+ ndkeywordstyle=\color{white},
94
+ commentstyle=\color{white},
95
+ identifierstyle=\color{white},
96
+ stringstyle=\color{white}
97
+ }}
98
+ {}
99
+
100
+ \renewcommand{\lstlistlistingname}{Table des codes sources} % renommer la liste des listings
101
+
102
+ % un listing depuis un fichier s'importe comme ceci :
103
+ %\lstinputlisting[caption={Legende}, label=lst:label]{emplacement}
104
+
@@ -0,0 +1,102 @@
1
+ % LaTeX skeleton
2
+ % generated on <%= Time.now %>
3
+ % by <%= @author %> with the Condom lib
4
+
5
+ %%%%%%%%%%%%%
6
+ % PREAMBULE %
7
+ %%%%%%%%%%%%%
8
+
9
+ \documentclass[a4paper, 11pt]{<%= @document_class %>} % format general
10
+
11
+ \input{inc/packages}
12
+ \input{inc/colors}
13
+ \input{inc/commands}
14
+ <% if @listings %>
15
+ \input{inc/lst-conf} % fichier de config du paquet listings
16
+ <% end %>
17
+
18
+ \geometry{top=2.5cm, bottom=2.5cm, left=2cm, right=2cm}
19
+ <% if @graphics %>
20
+ \graphicspath{{fig/}} % chemins vers les images
21
+ <% end %>
22
+
23
+ % informations du document
24
+ \author{<%= @author %>}
25
+ \date{Le <%= @date %>}
26
+ \title{<%= @title %>}
27
+
28
+ <% if @document_class == "report" %>
29
+ %\input{inc/flyleaf.tex} % page de garde personnalisee
30
+ %\location{}
31
+ %\blurb{}
32
+ <% end %>
33
+
34
+ <% if @pdf %>
35
+ \hypersetup{%
36
+ pdftitle = {<%= @title %>},
37
+ pdfauthor = {<%= @author %>}
38
+ pdfcreator = {Texlive},
39
+ pdfproducer = {Texlive},
40
+ colorlinks = true,
41
+ linkcolor = black,
42
+ citecolor = black,
43
+ urlcolor = black
44
+ } % informations du pdf
45
+ <% end %>
46
+
47
+ <% if @fancyhdr %>
48
+ \pagestyle{fancy}
49
+ \lhead{<%= @title %>}
50
+ \chead{}
51
+ \rhead{\thepage/\pageref{LastPage}}
52
+ \lfoot{}
53
+ \cfoot{}
54
+ \rfoot{\footnotesize <%= @author %>}
55
+ %\renewcommand{\headrulewidth}{0pt}
56
+ %\renewcommand{\footrulewidth}{0.4pt}
57
+ \fancypagestyle{plain}{% % style des pages de titres
58
+ \fancyhf{}
59
+ \renewcommand{\headrulewidth}{0pt}
60
+ \renewcommand{\footrulewidth}{0pt}
61
+ }
62
+ <% end %>
63
+
64
+ <% if @document_class == "report" %>
65
+ \renewcommand{\thesection}{\Roman{part}.\arabic{section}} % redefinir la numerotation des sections (ex: I.2)
66
+ <% end %>
67
+
68
+ \makeatletter
69
+ \@addtoreset{section}{part} % reprendre a partir de 1 les sections des parties suivantes
70
+ \makeatother
71
+
72
+ %\AtBeginDocument{%
73
+ % \renewcommand{\abstractname}{} % renommer le resume
74
+ %}
75
+
76
+ %%%%%%%%%
77
+ % CORPS %
78
+ %%%%%%%%%
79
+
80
+ \begin{document} % debut du document
81
+
82
+ \maketitle % afficher le titre
83
+
84
+ % resume
85
+ \begin{abstract}
86
+ \end{abstract}
87
+
88
+ \tableofcontents % table des matieres
89
+
90
+ <% if @listings %>
91
+ \lstlistoflistings % tables des listings
92
+ <% end %>
93
+
94
+ <% if @document_class == "article" %>
95
+ \newpage
96
+ <% elsif @document_class == "report" %>
97
+ \unnumpart{Introduction}
98
+ <% end %>
99
+
100
+ \end{document} % fin du document
101
+ %EOF
102
+
@@ -0,0 +1,51 @@
1
+ % LaTeX skeleton
2
+ % generated on <%= Time.now %>
3
+ % by <%= @author %> with the Condom lib
4
+
5
+ %%%%%%%%%%%%%
6
+ % PREAMBULE %
7
+ %%%%%%%%%%%%%
8
+
9
+ % http://latex-beamer.sourceforge.net/
10
+ % http://www.tex.ac.uk/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
11
+
12
+ \documentclass{beamer}
13
+ \usetheme{Warsaw}
14
+
15
+ \input{inc/packages}
16
+ \input{inc/colors}
17
+ \input{inc/commands}
18
+ <% if @listings %>
19
+ \input{inc/lst-conf} % fichier de config du paquet listings
20
+ <% end %>
21
+
22
+ <% if @graphics %>
23
+ \graphicspath{{fig/}} % chemins vers les images
24
+ <% end %>
25
+
26
+ % informations du document
27
+ \author{<%= @author %>}
28
+ \date{Le <%= @date %>}
29
+ \title{<%= @title %>}
30
+ \institute{}
31
+
32
+ \AtBeginSubsection[]
33
+ {
34
+ \begin{frame}<beamer>
35
+ \frametitle{Plan}
36
+ \tableofcontents[currentsection,currentsubsection]
37
+ \end{frame}
38
+ }
39
+
40
+ %%%%%%%%%
41
+ % CORPS %
42
+ %%%%%%%%%
43
+
44
+ \begin{document} % debut du document
45
+
46
+ \begin{frame}
47
+ \titlepage
48
+ \end{frame}
49
+
50
+ \end{document} % fin du document
51
+ %EOF
@@ -0,0 +1,44 @@
1
+ \usepackage[T1]{fontenc} % codage des caracteres
2
+
3
+ <% enc = (PLATFORM.include? "linux") ? "utf8" : "latin1" %>
4
+ \usepackage[<%= enc %>]{inputenc} % encodage du fichier (utf8 ou latin1)
5
+ \usepackage[<%= @language %>]{babel} % langue
6
+ \usepackage{mathpazo} % selection de la police
7
+ \usepackage{geometry} % mise en page
8
+ \usepackage{xcolor} % pour colorer des elements
9
+
10
+ <% if @graphics %>
11
+ \usepackage{graphicx} % pour inserer des images
12
+ <% end %>
13
+
14
+ <% if @math %>
15
+ % math
16
+ \usepackage{amssymb} % symboles mathematiques
17
+ %\usepackage{amsmath} % commandes mathematiques
18
+ <% end %>
19
+
20
+ <% if @pdf %>
21
+ % pdf
22
+ \usepackage{url} % permet l'insertion d'url
23
+ \usepackage[pdftex]{hyperref} % permet l'hypertexte (rend les liens cliquables)
24
+ <% end %>
25
+
26
+ <% if @listings %>
27
+ % listings
28
+ \usepackage{listings} % permet d'inserer du code (multi-langage)
29
+ \usepackage{courier}
30
+ \usepackage{caption}
31
+ <% end %>
32
+
33
+ <% if @fancyhdr %>
34
+ % fancyhdr
35
+ \usepackage{lastpage} % derniere page
36
+ \usepackage{fancyhdr} % en-tete et pied de page
37
+ <% end %>
38
+
39
+ \usepackage{multicol}
40
+
41
+ <% for package in @packages do %>
42
+ \usepackage{#{package}}
43
+ <% end %>
44
+
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: condom
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Vivien Didelot
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-09 00:00:00 +10:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description:
23
+ email: vivien.didelot@gmail.com
24
+ executables:
25
+ - condom
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/views/flyleaf.tex.erb
32
+ - lib/views/main.tex.erb
33
+ - lib/views/lst-conf.tex.erb
34
+ - lib/views/packages.tex.erb
35
+ - lib/views/fig.tex.erb
36
+ - lib/views/main_beamer.tex.erb
37
+ - lib/views/colors.tex.erb
38
+ - lib/views/Makefile.erb
39
+ - lib/views/commands.tex.erb
40
+ - lib/condom.rb
41
+ - README
42
+ - CHANGELOG
43
+ - bin/condom
44
+ has_rdoc: true
45
+ homepage:
46
+ licenses: []
47
+
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ requirements: []
72
+
73
+ rubyforge_project:
74
+ rubygems_version: 1.3.7
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: A Ruby gem to create a skeleton for a LaTeX document.
78
+ test_files: []
79
+