make more versatile configuration
This commit is contained in:
parent
0caedf5588
commit
41c9bc2060
5 changed files with 36 additions and 19 deletions
11
README.md
11
README.md
|
@ -28,7 +28,7 @@ To prove my point, simply compare a %latex_ and a %markdown file.
|
|||
|
||||
\begin{document}
|
||||
This is a test file.
|
||||
I begin by making a list of bullet:
|
||||
I begin by making a list of bullet points:
|
||||
\begin{itemize}
|
||||
\item the first point is
|
||||
\LaTeX is a bit verbose
|
||||
|
@ -42,7 +42,7 @@ I begin by making a list of bullet:
|
|||
|
||||
~~~
|
||||
This is a test file
|
||||
I begin by making a list of bullet:
|
||||
I begin by making a list of bullet points:
|
||||
|
||||
- the first point is LaTeX is a bit verbose
|
||||
- the second point is LaTeX has _more_ \ than Markdown
|
||||
|
@ -58,7 +58,7 @@ LLL endbox LLL \hrule\end{minipage}\medskip LLL
|
|||
%beginbox
|
||||
|
||||
This is a test file
|
||||
I begin by making a list of bullet:
|
||||
I begin by making a list of bullet points:
|
||||
|
||||
- the first point is %latex_ is a bit verbose
|
||||
- the second point is %latex_ has _more_ \ than Markdown
|
||||
|
@ -91,7 +91,7 @@ First, install %latex, ruby and the `kramdown`[^1] gem.
|
|||
[^1]: `kramdown` is an amelioration of the original markdown format.
|
||||
|
||||
- Download this source.
|
||||
- Change the title of your document and the author name in the `template.tex` file.
|
||||
- Edit the `config.rb` file (set title, author name and pdf filename)
|
||||
- Create and write in `kramdown` format
|
||||
- run `rake` (or `rake compile`) to create and show a `.pdf` file.
|
||||
|
||||
|
@ -108,9 +108,7 @@ This is not a problem, I've done this. Here is how you can declare macros inside
|
|||
%%% amacro %%% a
|
||||
macro
|
||||
on many lines %%%
|
||||
|
||||
%%% code %%% ruby: "a"*3 %%%
|
||||
|
||||
%%% complex %%% ruby: (1..5).map do |x|
|
||||
x*x
|
||||
end.join(" : ") %%%
|
||||
|
@ -156,4 +154,3 @@ and
|
|||
|
||||
rake clobber
|
||||
|
||||
The inclusion of files is done naturally by `Dir[content/**/*.md]` . If you want a more versatile way of doing it, simply look at the Rakefile and do a bit of ruby to sort file as you wish.
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -37,7 +37,7 @@ task :compile do
|
|||
end
|
||||
|
||||
def process_template
|
||||
template=File.new(@templateFile,"r")
|
||||
template=File.new(@template_file,"r")
|
||||
txt=template.read
|
||||
template.close
|
||||
|
||||
|
@ -47,7 +47,8 @@ task :compile do
|
|||
end.join("\n")
|
||||
end.
|
||||
sub!(%{\\author\{\}},'\author{'+@author+'}').
|
||||
sub!(%{\\title\{\}},'\title{'+@title+'}')
|
||||
sub!(%{\\title\{\}},'\title{'+@title+'}').
|
||||
sub!( /%%# LATEX HEADER FROM config\.rb #%%/,@latex_headers)
|
||||
fic=File.new("tmp/#{@pdfname}.tex","w")
|
||||
fic.write(txt)
|
||||
fic.close
|
||||
|
@ -94,6 +95,7 @@ task :compile do
|
|||
|
||||
# launch the xelatex process
|
||||
system("cp -rf include tmp/")
|
||||
|
||||
system("cd tmp; xelatex #{@pdfname}; cd ..")
|
||||
# on Ubuntu replace by
|
||||
# system("gnome-open #{@pdfname}.pdf")
|
||||
|
|
27
config.rb
27
config.rb
|
@ -1,6 +1,29 @@
|
|||
@pdfname="krambook"
|
||||
# Use this file to configure some general variables
|
||||
|
||||
@title='\Huge{\textbf{Krambook}}\\\\\\' + "\n" +
|
||||
'\small\textit{Write Books like an }'+
|
||||
'\texttt{UB3R 1337}\textit{ (Hacker)}'
|
||||
|
||||
@author="Yann Esposito"
|
||||
@templateFile="include/template.tex"
|
||||
|
||||
# file name
|
||||
@pdfname="krambook"
|
||||
|
||||
# LaTeX headers (before \begin{document})
|
||||
@latex_headers=''
|
||||
|
||||
# Comment the following line if you haven't
|
||||
# Hoefler Text font installed on your system
|
||||
@latex_headers<<='\setmainfont{Hoefler Text}'
|
||||
|
||||
# Make italic and emphasis text gray
|
||||
@latex_headers<<='\usepackage{color}
|
||||
\definecolor{italiccolor}{rgb}{0.4,0.4,0.4}
|
||||
\renewcommand{\textit}[1]{\textcolor{italiccolor}{\it #1}}
|
||||
\renewcommand{\emph}[1]{\textcolor{italiccolor}{\em #1}}'
|
||||
|
||||
# change the template file in case latex_headers is not enough
|
||||
# Remember to not remove lines begining by %%#
|
||||
# look at include/template.tex for example
|
||||
@template_file="include/template.tex"
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
% -- XeLaTeX --
|
||||
\XeTeXdefaultencoding utf-8
|
||||
\usepackage{xltxtra,fontspec,xunicode}
|
||||
\setmainfont{Hoefler Text}
|
||||
% \setmainfont{Georgia}
|
||||
|
||||
% -- Kramdown necessary includes --
|
||||
\usepackage{listings}
|
||||
|
@ -20,9 +18,3 @@
|
|||
\usepackage{fancyvrb}
|
||||
\usepackage{fontspec}
|
||||
|
||||
% -- Personal style --
|
||||
\usepackage{color}
|
||||
\definecolor{italiccolor}{rgb}{0.4,0.4,0.4}
|
||||
\renewcommand{\textit}[1]{\textcolor{italiccolor}{\it #1}}
|
||||
\renewcommand{\emph}[1]{\textcolor{italiccolor}{\em #1}}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
\include{include/main}
|
||||
|
||||
% -- Personal style --
|
||||
%%# LATEX HEADER FROM config.rb #%%
|
||||
|
||||
\author{}
|
||||
|
||||
\title{}
|
||||
|
|
Loading…
Reference in a new issue