-
Notifications
You must be signed in to change notification settings - Fork 17
/
BuildPDFDocs.nb
215 lines (190 loc) · 7.77 KB
/
BuildPDFDocs.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
Notebook[{
Cell[BoxData["Quit"], "Input",
CellChangeTimes->{{3.764990729809279*^9, 3.7649907306687*^9}, {
3.7906219225056963`*^9,
3.7906219226195*^9}},ExpressionUUID->"f0bc3e8f-268e-414b-a01f-640c8c2390ea"],
Cell[CellGroupData[{
Cell["Generate PDF documentation", "Section",
CellChangeTimes->{{3.764990732090185*^9,
3.764990735992363*^9}},ExpressionUUID->"2470d666-491b-4bf3-98e5-\
94a2973e0a2d"],
Cell["Run this in Mathematica 12.0 or later.", "Text",
CellChangeTimes->{{3.7649929660274143`*^9,
3.764992971229802*^9}},ExpressionUUID->"fdc734ff-0686-4425-8ad6-\
b504ae577adf"],
Cell[BoxData["$Version"], "Input",
CellChangeTimes->{{3.764990328798558*^9, 3.764990329682598*^9}},
CellLabel->"In[2]:=",ExpressionUUID->"4fddb902-7c26-4b5f-b2f0-c7b678939c75"],
Cell[BoxData[
RowBox[{"SetDirectory", "@",
RowBox[{"NotebookDirectory", "[", "]"}]}]], "Input",
CellChangeTimes->{{3.764990320418201*^9, 3.76499032565524*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"0211c683-a34c-476f-82fd-b77b70d6834a"],
Cell[BoxData[
RowBox[{"nb", "=",
RowBox[{"NotebookOpen", "@",
RowBox[{
"AbsoluteFileName", "[",
"\"\<IGraphM/Documentation/English/Tutorials/IGDocumentation.nb\>\"",
"]"}]}]}]], "Input",
CellChangeTimes->{{3.764990331549747*^9, 3.76499040548578*^9}},
CellLabel->"In[3]:=",ExpressionUUID->"62742fa7-8a23-4781-8ca9-8bea337d65a3"],
Cell["\<\
Ensure that Information boxes are printed in the old style, even in \
Mathematica 12.0+.\
\>", "Text",
CellChangeTimes->{{3.766070383460309*^9,
3.766070396260013*^9}},ExpressionUUID->"13db37aa-ec00-41a6-b88e-\
6810c64e0730"],
Cell[BoxData[
RowBox[{"Block", "[",
RowBox[{
RowBox[{"{",
RowBox[{"Information", "=", "Internal`SymbolInformation"}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"SetOptions", "[",
RowBox[{"Information", ",",
RowBox[{"LongForm", "\[Rule]", "False"}]}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"$Line", "=", "0"}], ";", "\[IndentingNewLine]",
RowBox[{"NotebookEvaluate", "[",
RowBox[{"nb", ",",
RowBox[{"InsertResults", "\[Rule]", "True"}]}], "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}]], "Input",
CellChangeTimes->{3.7649916904297237`*^9},
CellLabel->"In[4]:=",ExpressionUUID->"ffd5e376-51e7-4a34-b7ac-6bde4d705f2a"],
Cell["Open all sections.", "Text",
CellChangeTimes->{{3.766070400429679*^9,
3.766070402310788*^9}},ExpressionUUID->"8b47d1db-a39e-4a7e-bc2d-\
f5493b602ec3"],
Cell[BoxData[{
RowBox[{"SelectionMove", "[",
RowBox[{"nb", ",", "All", ",", "Notebook"}], "]"}], "\n",
RowBox[{"FrontEndTokenExecute", "[",
RowBox[{"nb", ",", "\"\<SelectionOpenAllGroups\>\""}], "]"}]}], "Input",
CellChangeTimes->{{3.764990577113941*^9, 3.7649905987892523`*^9}, {
3.764991057645553*^9, 3.764991060225121*^9}, {3.7649911199772053`*^9,
3.764991134605487*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"92d3d163-a939-41e0-b8f5-6ccc23b76a46"],
Cell["Delete list of all IGraph/M symbols.", "Text",
CellChangeTimes->{{3.766070406601098*^9,
3.766070424554109*^9}},ExpressionUUID->"f0a0947c-51f4-4ea5-b979-\
1fa15661772d"],
Cell[BoxData[
RowBox[{"NotebookDelete", "@",
RowBox[{"NextCell", "@",
RowBox[{"First", "@",
RowBox[{"Cells", "[",
RowBox[{"nb", ",",
RowBox[{"CellLabel", "\[Rule]", "\"\<In[2]:=\>\""}]}],
"]"}]}]}]}]], "Input",
CellChangeTimes->{{3.764992343741222*^9, 3.7649923464852543`*^9}},
CellLabel->"In[3]:=",ExpressionUUID->"7ada961e-cf73-4e92-85e3-e71b8b808168"],
Cell["Delete setup cells.", "Text",
CellChangeTimes->{{3.790193067874372*^9,
3.790193078158207*^9}},ExpressionUUID->"b4b1a815-9da8-4d70-9da7-\
4861329b7077"],
Cell[BoxData[
RowBox[{"NotebookDelete", "@",
RowBox[{"Cells", "[",
RowBox[{"nb", ",",
RowBox[{"CellTags", "\[Rule]", "\"\<DeleteCell\>\""}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.790268853802835*^9,
3.790268854265957*^9}},ExpressionUUID->"1abededc-6efe-458f-8f8c-\
77dd5b04dd01"],
Cell[TextData[{
"Select ",
Cell[BoxData[
FormBox[
RowBox[{"PageBreakBelow", "\[Rule]", "False"}], TraditionalForm]],
ExpressionUUID->"3374aadc-7312-4e87-a3e3-df3e7d76af21"],
" on Text cells followed by Input cells. We must do it this way, and not set \
",
Cell[BoxData[
FormBox[
RowBox[{"PageBreakAbove", "\[Rule]", "False"}], TraditionalForm]],
ExpressionUUID->"89609800-bd2b-44b4-a564-0436bb5d473d"],
" on Input cells preceded by Text cells. If we did that, some of the outputs \
would be faded due to modified input cells."
}], "Text",
CellChangeTimes->{{3.766070428430016*^9,
3.766070486831792*^9}},ExpressionUUID->"5eecdd9d-13f4-4419-b25f-\
65907eb75188"],
Cell[BoxData[
RowBox[{"Scan", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Quiet", "[",
RowBox[{"\"\<Style\>\"", "/.",
RowBox[{"Developer`CellInformation", "@",
RowBox[{"NextCell", "[", "#", "]"}]}]}], "]"}], "===",
"\"\<Input\>\""}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"CurrentValue", "[",
RowBox[{"#", ",", "PageBreakBelow"}], "]"}], "=", "False"}]}],
"\[IndentingNewLine]", "]"}], "&"}], ",", "\[IndentingNewLine]",
RowBox[{"Cells", "[",
RowBox[{"nb", ",",
RowBox[{"CellStyle", "\[Rule]", "\"\<Text\>\""}]}], "]"}]}],
"\[IndentingNewLine]", "]"}]], "Input",
CellChangeTimes->{{3.7649908919124804`*^9, 3.7649909346885767`*^9}, {
3.766068862830669*^9, 3.7660688854142733`*^9}, {3.766069407781562*^9,
3.766069411948389*^9}},
CellLabel->"In[4]:=",ExpressionUUID->"792be7b9-e1ab-4281-b235-2fa063a2bbbb"],
Cell["Hide cell tags.", "Text",
CellChangeTimes->{{3.766070491142112*^9,
3.766070494072329*^9}},ExpressionUUID->"d858a26c-b647-4a7f-9549-\
172072855cb3"],
Cell[BoxData[
RowBox[{
RowBox[{"CurrentValue", "[",
RowBox[{"nb", ",", "ShowCellTags"}], "]"}], "=", "False"}]], "Input",
CellChangeTimes->{{3.76499136050252*^9, 3.7649913676107187`*^9}},
CellLabel->"In[5]:=",ExpressionUUID->"d94681e3-c55c-4f9e-bb71-8138260b99f3"],
Cell["Create PDF.", "Text",
CellChangeTimes->{{3.766070496490641*^9,
3.766070498126829*^9}},ExpressionUUID->"dc47c899-cd83-4624-abad-\
423405dc945e"],
Cell[BoxData[{
RowBox[{"SetDirectory", "@",
RowBox[{"NotebookDirectory", "[", "]"}]}], "\[IndentingNewLine]",
RowBox[{"Export", "[",
RowBox[{"\"\<IGDocumentation.pdf\>\"", ",", "nb", ",",
RowBox[{"ImageResolution", "\[Rule]", "450"}]}], "]"}]}], "Input",
CellChangeTimes->{{3.7649913409972773`*^9, 3.7649913548458347`*^9}, {
3.764991542138734*^9, 3.764991546343018*^9}, {3.7902343719797297`*^9,
3.790234377630802*^9}},ExpressionUUID->"581d0512-dc17-471a-bd67-\
2e0af6fa739d"],
Cell["Close notebook without saving.", "Text",
CellChangeTimes->{{3.766070500028552*^9,
3.7660705031408157`*^9}},ExpressionUUID->"ddc34994-36b4-45c1-9c87-\
923b07a191ba"],
Cell[BoxData[
RowBox[{"NotebookClose", "[", "nb", "]"}]], "Input",
CellChangeTimes->{{3.764991497957252*^9, 3.764991501274312*^9}},
CellLabel->"In[7]:=",ExpressionUUID->"e04e1539-077e-4fc9-b7cb-bc5165d7d686"],
Cell["\<\
Open PDF and manually verify that it is correct. Occasionally, Mathematica \
produces invalid PDFs.\
\>", "Text",
CellChangeTimes->{{3.76607050480709*^9,
3.7660705230928793`*^9}},ExpressionUUID->"3ebbc003-be90-4e17-a01b-\
087115d638c9"],
Cell[BoxData[
RowBox[{"SystemOpen", "[", "\"\<IGDocumentation.pdf\>\"", "]"}]], "Input",
CellChangeTimes->{{3.76499293074282*^9, 3.7649929362362823`*^9}},
CellLabel->"In[8]:=",ExpressionUUID->"ad4472c2-5896-491e-b136-c44fb95ccd81"]
}, Open ]]
},
WindowSize->{808, 755},
WindowMargins->{{4, Automatic}, {Automatic, 4}},
PrivateNotebookOptions->{"FileOutlineCache"->False},
TrackCellChangeTimes->True,
FrontEndVersion->"12.1 for Mac OS X x86 (64-bit) (February 11, 2020)",
StyleDefinitions->"Default.nb",
ExpressionUUID->"80af44fa-5568-485b-8cc9-e0a40b960f61"
]