Skip to content

Commit 3f4bde4

Browse files
committed
Code blocks in PDF are now formatted using minted
1 parent 882e00a commit 3f4bde4

6 files changed

Lines changed: 79 additions & 53 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ coverage/*
7272

7373
# Infer
7474
infer-out/*
75+
76+
# minted
77+
**/_minted-index/*

docs/index.html

Lines changed: 49 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/sac-format_manual.pdf

7.39 KB
Binary file not shown.

make_docs.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
;; For information on publishing variables see
44
;; https://orgmode.org/manual/Publishing-options.html
55

6+
;; Allow the website style to be obtained from github
67
(setq org-safe-remote-resources '("\\`https://fniessen\\.github\\.io\\(?:/\\|\\'\\)"))
8+
;; Allow Minted to be executed
9+
(setq org-latex-listings 'minted
10+
org-latex-packages-alist '(("" "minted"))
11+
org-latex-pdf-process
12+
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
13+
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
14+
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
715

816
;; Define the publishing project
917
(setq org-publish-project-alist

src/docs/index.org

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ build tool, and then building.
118118

119119
**** GCC
120120

121+
#+attr_latex: :options frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize
121122
#+begin_src bash :returns code :eval no
122123
git clone https://github.com/arbCoding/sac-format.git
123124
cmake --preset gcc-release
@@ -126,10 +127,11 @@ cmake --build ./build/release/gcc
126127

127128
**** Clang
128129

130+
#+attr_latex: :options frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize
129131
#+begin_src bash :returns code :eval no
130132
git clone https://github.com/arbCoding/sac-format.git
131133
cmake --preset clang-release
132-
cmaek --build ./build/release/clang
134+
cmake --build ./build/release/clang
133135
#+end_src
134136

135137
*** Use
@@ -148,7 +150,10 @@ well as the true size of the [[=data1=][=data1=]] and [[=data2=][=data2=]] vecto
148150
** CMake Integration
149151

150152
To integrate sac-format into your CMake project, add it to your =CMakeLists.txt=.
151-
#+begin_example
153+
154+
#+latex: \begin{center}\begin{minipage}[t]{0.75\textwidth}
155+
#+attr_latex: :options frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize, linenos
156+
#+begin_src cmake :eval no
152157
include(FetchContent)
153158
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
154159
FetchContent_Declare(sac-format
@@ -166,13 +171,16 @@ add_executable(your_executable
166171

167172
target_link_libraries_library(your_executable
168173
PRIVATE sac-format)
169-
#+end_example
174+
#+end_src
175+
#+latex: \end{minipage}\end{center}
170176

171177
** Example
172178

173179
*** Reading and Writing
174180

181+
#+latex: \begin{center}\begin{minipage}[t]{0.75\textwidth}
175182
#+name: empty_trace_example
183+
#+attr_latex: :options frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize, linenos
176184
#+begin_src cpp :cache yes :returns code :results verbatim :flags -std=c++20 -L../../bin/libsac-format.a -I../ :eval no
177185
#include <filesystem>
178186
#include <iostream>
@@ -196,6 +204,7 @@ int main() {
196204
return EXIT_SUCCESS;
197205
}
198206
#+end_src
207+
#+latex: \end{minipage}\end{center}
199208

200209
* Documentation
201210

@@ -209,6 +218,8 @@ The =Trace= class provides easy access to SAC-files in C++. Each SAC-file is a
209218
SAC-files can be read in by using the parameterized constructor with a [[https://en.cppreference.com/w/cpp/filesystem/path][=std::filesystem::path=]] ([[https://en.cppreference.com/w/cpp/header/filesystem][=<filesystem>=]]) or a [[https://en.cppreference.com/w/cpp/string/basic_string][=std::string=]] ([[https://en.cppreference.com/w/cpp/header/string][=<string>=]]) variable that corresponds to the location of the SAC-file.
210219

211220
For example:
221+
#+latex: \begin{center}\begin{minipage}[t]{0.75\textwidth}
222+
#+attr_latex: :options frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize, linenos
212223
#+begin_src C++ :eval no
213224
#include <filesystem>
214225
#include <sac_foramt.hpp>
@@ -219,6 +230,7 @@ int main() {
219230
return EXIT_SUCCESS;
220231
}
221232
#+end_src
233+
#+latex: \end{minipage}\end{center}
222234

223235
*** Writing SAC
224236

src/docs/misc/settings.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#+latex_class: article
1414
#+latex_class_options:
1515
#+latex_header: \usepackage{times}
16+
#+latex_header: \usepackage{minted}
17+
#+latex_header: \setminted{breaklines}
18+
#+latex_header: \usepackage{xcolor}
19+
#+latex_header: \usemintedstyle{emacs}
1620
#+latex_header: \usepackage{mathtools}
1721
#+latex_header: \usepackage[twoside, letterpaper, lmargin=1.0in, rmargin=0.75in, bmargin=0.75in, tmargin=1.0in]{geometry}
1822
#+latex_header: \usepackage{fancyhdr}

0 commit comments

Comments
 (0)