Skip to content

Commit 421991c

Browse files
author
Clément
committed
Adding command to insert pdf easily.
1 parent f1a3fc3 commit 421991c

File tree

7 files changed

+109
-9
lines changed

7 files changed

+109
-9
lines changed

md_version/main.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,35 @@ You can easily represent formal proofs using \LaTeX's ebproof or bussproof packa
193193
\end{prooftree}
194194
\end{center}
195195

196-
# Figures, Tables, (Code) Listings and Landscape Pages
196+
# Inserting PDFs, Figures, Tables and (Code) Listings
197197

198-
## Figures
198+
## Inserting PDFs
199+
200+
PDF documents can be inserted using `pdfpages`'s `\includepdf` command.
201+
For commodity, a `\modifiedincludepdf` is provided:
202+
203+
```tex
204+
\modifiedincludepdf{options for includepdf}%
205+
{label}%
206+
{full path to the document}%
207+
{title of the document}%
208+
{"level" (e.g., section, subsection, etc.)}
209+
```
210+
211+
Note that using `label.x` will refer to the page `x` of the inserted document (starting with 1): refer to the source code of this current document for an example usage.
212+
We insert [in the following pages](#pdf:Gluck13) (p. \pageref{pdf:Gluck13.1}--\pageref{pdf:Gluck13.9}) an article as an example of PDF insertion.
213+
214+
\modifiedincludepdf{}{pdf:Gluck13}{pdf/simulation_of_two_ways_pushdown_automata_revisited.pdf}{A paper proving concisely a result in automata theory that helped solve a real programming problem~\cite{DBLP:journals/corr/Gluck13}}{subsection}
215+
216+
## Inserting Figures
199217

200218
Markdown only
201219
~ You can easily insert [images and figures](https://pandoc.org/MANUAL.html#images) using Pandoc, as in \autoref{fig:d_un_autre_age}, a painting by [Jérôme Minard](http://jeromeminard.com/travaux/) under [copyleft](https://forceg.jimdofree.com/licence-art-libre/).
202220

203221
![_D'un autre âge_\label{fig:d_un_autre_age}](pictures/D_un_autre_age.jpg){width=80%}
204222

205223

206-
## Tables
224+
## Inserting Tables
207225

208226
Markdown only
209227
~ You can write tables using [pandoc's syntax*es*](https://pandoc.org/MANUAL.html#tables), as in Tables \ref{tbl:demo1}, \ref{tbl:demo2} and \ref{tbl:demo3} (all borrowed from <https://www.flutterbys.com.au/stats/tut/tut17.3.html>).
@@ -241,7 +259,7 @@ Markdown only
241259
+---------------+---------------+--------------------+
242260
: The price and advantages of fruits \label{tbl:demo3}
243261

244-
## Code Listings
262+
## Inserting Code Listings
245263

246264
Code is displayed using the listings package.
247265
Check the "Table 1: Predefined languages" of the listings package documentation to see the list of supported languages by default.
@@ -278,7 +296,7 @@ for num in {000..2}; do echo "$num"; done
278296
\lstinputlisting[language=C, caption={"\emph{Hello World}" in C}, label={lst:demo3}]{code/hello_world.c}
279297

280298

281-
## Landscape Pages
299+
# Landscape Pages
282300

283301
You can obtain landscape pages using the landscape package in \LaTeX.
284302

md_version/main.pdf

86.2 KB
Binary file not shown.

md_version/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ clean:
3737
tex: main.md
3838
@pandoc $(PANDOC_OPTIONS) -s $< -o main.tex
3939
@mkdir -p ../tex_version/
40-
@cp -r main.tex fonts/ references/ pictures/ code/ ../tex_version/
40+
@cp -r main.tex fonts/ references/ pictures/ pdf/ code/ ../tex_version/
4141
@echo "Your .tex version is available at ../tex_version/. Compile with latexmk -pdf -xelatex main.tex"
4242

97.8 KB
Binary file not shown.

md_version/references/references.bib

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,24 @@ @online{gradschool_policies
1313
url = {https://www.augusta.edu/gradschool/student-resources.php},
1414
urldate = {2021-11-01}
1515
}
16+
@inproceedings{DBLP:journals/corr/Gluck13,
17+
author = {Robert Gl{\"{u}}ck},
18+
editor = {Anindya Banerjee and
19+
Olivier Danvy and
20+
Kyung{-}Goo Doh and
21+
John Hatcliff},
22+
title = {Simulation of Two-Way Pushdown Automata Revisited},
23+
booktitle = {Semantics, Abstract Interpretation, and Reasoning about Programs:
24+
Essays Dedicated to David A. Schmidt on the Occasion of his Sixtieth
25+
Birthday, Manhattan, Kansas, USA, 19-20th September 2013},
26+
series = {{EPTCS}},
27+
volume = {129},
28+
pages = {250--258},
29+
year = {2013},
30+
url = {https://doi.org/10.4204/EPTCS.129.15},
31+
doi = {10.4204/EPTCS.129.15},
32+
timestamp = {Sun, 02 Jun 2019 20:54:28 +0200},
33+
biburl = {https://dblp.org/rec/journals/corr/Gluck13.bib},
34+
bibsource = {dblp computer science bibliography, https://dblp.org}
35+
}
36+

md_version/templates/head_c.tex

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
\normalsize
3737
}
3838

39-
%%%%%
40-
% Emoji support for latex
41-
%%%%%
39+
%%%%%%%%%%%%%%%%%%%%%%%%%%%
40+
% Emoji support for latex %
41+
%%%%%%%%%%%%%%%%%%%%%%%%%%%
4242

4343
\usepackage[verbose]{newunicodechar}
4444

@@ -297,3 +297,63 @@
297297
% We recommend using the more modern ebproof over
298298
% the more "traditional" bussproofs,
299299
\usepackage{ebproof}
300+
301+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302+
% Nice frames, for the documents we will be including %
303+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304+
305+
\usepackage[breakable]{tcolorbox} % Will be used for frame around included documents.
306+
% https://tex.stackexchange.com/a/66156
307+
\DeclareRobustCommand\titleforcurrentframe{temp} % Title for the current page of the frame.
308+
% This macro is re-defined in \modifiedincludepdf
309+
% and \modifiedincludetxt
310+
\newcommand{\mybox}[1]{%
311+
\begin{tcolorbox}[
312+
colframe=augustablue,
313+
colback=white,
314+
width={\dimexpr\textwidth},
315+
breakable,
316+
adjusted title={\hypersetup{citecolor=white}\titleforcurrentframe}
317+
]
318+
#1
319+
\end{tcolorbox}
320+
}
321+
322+
%%%%%%%%%%%%%%%%%%%%%%%%%%%
323+
% Commands to include pdf %
324+
%%%%%%%%%%%%%%%%%%%%%%%%%%%
325+
326+
\usepackage{pdfpages}
327+
% https://tex.stackexchange.com/questions/198091/get-number-of-pages-of-external-pdf/198095#198095
328+
\newcommand*{\numberofpages}[1]{%
329+
\the\XeTeXpdfpagecount"#1" %
330+
}
331+
332+
% Counter to add label to individual pages of the pdf.
333+
% https://tex.stackexchange.com/a/25113
334+
\newcounter{currentpagecounter}
335+
\newcounter{totaldocpages}
336+
% Command to include pdf document.
337+
% Usage:
338+
% \modifiedincludepdf{options for includepdf}{label}{full path to the document}{title of the document}{"level" (e.g., section, subsection, etc.)}
339+
\newcommand{\modifiedincludepdf}[6]{
340+
\let\fbox\mybox % includepsf, with the option "frame", use \fbox
341+
% to draw the frame. We change the command, to use
342+
% our custom frame, that uses tcolorbox.
343+
\setcounter{currentpagecounter}{0}
344+
\setcounter{totaldocpages}{\numberofpages{#3}}
345+
\renewcommand{\titleforcurrentframe}{#4 (p.\ \thecurrentpagecounter\ / \thetotaldocpages) \hfill #6} % #6 acts as a subtitle
346+
\includepdf[#1,%
347+
width=\textwidth,%
348+
pages=-,%
349+
frame,
350+
clip,
351+
pagecommand={
352+
\stepcounter{currentpagecounter} % We increment the counter for the number of pages.
353+
\label{#2.\thecurrentpagecounter}% We add a label of the form "label.pagenumber".
354+
},
355+
link = true,
356+
linkname = {#2},
357+
addtotoc={1, #5, 1, #4, #2} % We add an entry to the table of content.
358+
]{#3}
359+
}

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Please, refer to the [Thesis/PhD Dissertation Preparation Booklet](https://www.a
8181
- This template uses and redistributes the [TeX Gyre Termes](http://www.gust.org.pl/projects/e-foundry/tex-gyre/termes) font (version 2.004), placed under the [GUST Font License](https://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt), which is an extension of the [The LaTeX Project Public License](https://www.latex-project.org/lppl.txt).
8282
- This template uses and redistributes the [Symbola](http://web.archive.org/web/20180307012615/http://users.teilar.gr/~g1951d/Symbola.zip) font (version 10.24), which is "free for any use".
8383
- The file code/hello_world.c is courtesy of Brian Kernighan.
84+
- The file pdf/simulation_of_two_ways_pushdown_automata_revisited.pdf is courtesy of Robert Glück and under Creative Commons Attribution License.
8485
- The file pictures/D_un_autre_age.jpg is courtesy of [Jérôme Minard](http://jeromeminard.com/travaux/) and under [copyleft](https://forceg.jimdofree.com/licence-art-libre/).
8586
- Unless otherwise noted, this template is under [Creative Commons Attribution 4.0 International](LICENSE.md).
8687
- © [Our contributors](https://github.com/the-au-forml-lab/au_ccs_dissertation_template/graphs/contributors), 2021-2025

0 commit comments

Comments
 (0)