footnote_test

This commit is contained in:
nik gaffney 2015-06-17 13:20:41 +00:00
parent 92d799c783
commit 7890b54e9b
3 changed files with 224 additions and 0 deletions

48
doku2tex.rb Normal file
View file

@ -0,0 +1,48 @@
#!/usr/local/bin/ruby
#
# dokuwiki -> pdf conversion for futurist fieldguide
require "slop"
opts = Slop.parse do |o|
o.string '-f','--file', 'source file basename'
o.bool '-v', '--verbose', 'enable verbose mode'
o.bool '-g', '--git', 'commit new files to git repo'
end
repo="/home/nik/pandoc/futurist-fieldguide/"
doku="/var/www/libarynth/dokuwiki/data/pages/futurist_fieldguide/"
user="www-data"
#file=ARGV[0] # dokuwiki pagenme as argument (no opts)
file = opts[:file]
puts file
# parse dokuwiki -> html
`php /var/www/libarynth/dokuwiki/bin/dokucli.php < #{doku}/#{file}.txt > /tmp/#{file}.html`
# convert html -> pdf with pandoc
# extra html step to create self-contained (local) images
`pandoc /tmp/#{file}.html --self-contained -o /tmp/#{file}.html`
`pandoc /tmp/#{file}.html -S --template=#{repo}/pandoc/templates/fieldguide.tex \
--include-in-header=#{repo}/pandoc/header.tex \
--metadata=title-meta:#{file} \
--latex-engine=xelatex -o #{repo}/print/#{file}.tex`
# merge single pdfs with 'assemble.rb'
# gittery
# - assuming the script is run in #{repo} and has origin ssh://git@repo.fo.am:foam/futurist-fieldguide.git
# - otherwise perhaps https://github.com/schacon/ruby-git
if opts.git?
`git add -A`
`git commit -m "#{file}"`
`git pull --commit`
`git push`
end

48
doku2tex.rb~ Normal file
View file

@ -0,0 +1,48 @@
#!/usr/local/bin/ruby
#
# dokuwiki -> pdf conversion for futurist fieldguide
require "slop"
opts = Slop.parse do |o|
o.string '-f','--file', 'source file basename'
o.bool '-v', '--verbose', 'enable verbose mode'
o.bool '-g', '--git', 'commit new files to git repo'
end
repo="/home/nik/pandoc/futurist-fieldguide/"
doku="/var/www/libarynth/dokuwiki/data/pages/futurist_fieldguide/"
user="www-data"
#file=ARGV[0] # dokuwiki pagenme as argument (no opts)
file = opts[:file]
puts file
# parse dokuwiki -> html
`php /var/www/libarynth/dokuwiki/bin/dokucli.php < #{doku}/#{file}.txt > /tmp/#{file}.html`
# convert html -> pdf with pandoc
# extra html step to create self-contained (local) images
`pandoc /tmp/#{file}.html --self-contained -o /tmp/#{file}.html`
`pandoc /tmp/#{file}.html -S --template=#{repo}/pandoc/templates/fieldguide.tex \
--include-in-header=#{repo}/pandoc/header.tex \
--metadata=title-meta:#{file} \
--latex-engine=xelatex -o #{repo}/print/#{file}.pdf`
# merge single pdfs with 'assemble.rb'
# gittery
# - assuming the script is run in #{repo} and has origin ssh://git@repo.fo.am:foam/futurist-fieldguide.git
# - otherwise perhaps https://github.com/schacon/ruby-git
if opts.git?
`git add -A`
`git commit -m "#{file}"`
`git pull --commit`
`git push`
end

128
print/footnote_test.tex Normal file
View file

@ -0,0 +1,128 @@
\documentclass[]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\usepackage{xltxtra,xunicode}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\newcommand{\euro}{}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex]{hyperref}
\else
\usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true,
bookmarks=true,
hyperfootnotes=true,
pdfauthor={},
pdftitle={footnote_test},
colorlinks=true,
citecolor=blue,
urlcolor=blue,
linkcolor=magenta,
pdfborder={0 0 0}}
\urlstyle{same} % don't use monospace font for urls
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{0}
\usepackage{fontspec}
\usepackage[pagestyles]{titlesec}
\usepackage{graphicx}
\usepackage{datetime}
\usepackage[iso,english]{isodate}
%\usepackage[perpage]{footmisc}
% page geometry
\usepackage{geometry}
\geometry{
a4paper,
total={210mm,297mm},
left=30mm,
right=30mm,
top=20mm,
bottom=20mm,
}
% http://tex.stackexchange.com/questions/246174/dynamic-title-size-using-titlesec
\newcommand{\resizetitle}[1]{\resizebox{\sectionwidth}{!}{#1}}
\newlength{\sectionwidth}
\AtBeginDocument{%
\setlength{\sectionwidth}{0.7\textwidth}%
}
% unix shell date
%\immediate\write18{date >\jobname.date}
% no page numbers
\pagenumbering{gobble}
% font setup
\setmainfont{Quattrocento Sans}
\newfontfamily\sectionfont{Encode Sans ExtraLight}
% header & footer data
\newpagestyle{main}[\small]{
\setheadrule{.55pt}%
\sethead{Quattrocento Sans / Encode Sans ExtraLight}{}{\subsectiontitle} % left, centre, right
\setfoot{}{}{\sectionfont\small{printed: \isodate{\today} \currenttime \selectfont}}
}
\pagestyle{main}
%\titleformat*{\subsection}{\sectionfont\fontsize{32}{20}\selectfont}
\titleformat*{\subsubsection}{\sectionfont\fontsize{32}{12}\selectfont}
\titleformat{\subsection}
{\sectionfont\Large\bfseries}
{\thesection}
{1em}
{\resizetitle}
% url & hyperlink formatting
%\DeclareUrlCommand\url{}
% urls as footnotes
\renewcommand{\href}[2]{#2\footnote{. #2 \url{#1}}}
%\setfnsymbol{lamport}
\begin{document}
\subsection{Footnote Test}\label{footnoteux5ftest}
DRAFT
a test of how various footnotes and \href{/another_page}{references} are
handled by \href{http://pandoc.org/README.html}{pandoc} and
\href{https://en.wikipedia.org/wiki/XeTeX}{XeTeX} after
\href{https://en.wikipedia.org/wiki/Boundary_\%28cricket\%29\#Scoring_runs}{four}
or
\href{https://en.wikipedia.org/wiki/Discordianism\#Law_of_Fives}{five}
or \href{https://en.wikipedia.org/wiki/Carbon}{six} footnotes are
created (when using \href{http://pandoc.org/README.html}{pandoc} to
generate pdfs set in Quattrocento Sans with XeTeX) and with
\href{/eight}{eight}, \href{/nine}{nine}, \href{/ten}{ten},
\href{/eleven}{eleven}, \href{/twelve}{twelve},
\href{/thirteen}{thirteen} or \href{/fourteen}{fourteen}
(\href{/fifteen}{fifteen}?) footnotes.
\end{document}