aspose_pdf_cloud 18.6.0 → 18.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +4 -4
  4. data/aspose_pdf_cloud.gemspec +49 -49
  5. data/lib/aspose_pdf_cloud.rb +145 -145
  6. data/lib/aspose_pdf_cloud/api/pdf_api.rb +11705 -10569
  7. data/lib/aspose_pdf_cloud/api_client.rb +60 -6
  8. data/lib/aspose_pdf_cloud/api_error.rb +47 -47
  9. data/lib/aspose_pdf_cloud/configuration.rb +185 -185
  10. data/lib/aspose_pdf_cloud/models/annotation.rb +260 -260
  11. data/lib/aspose_pdf_cloud/models/annotation_response.rb +222 -222
  12. data/lib/aspose_pdf_cloud/models/annotations.rb +211 -211
  13. data/lib/aspose_pdf_cloud/models/annotations_response.rb +222 -222
  14. data/lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb +43 -43
  15. data/lib/aspose_pdf_cloud/models/append_document.rb +228 -228
  16. data/lib/aspose_pdf_cloud/models/attachment.rb +270 -270
  17. data/lib/aspose_pdf_cloud/models/attachment_response.rb +222 -222
  18. data/lib/aspose_pdf_cloud/models/attachments.rb +211 -211
  19. data/lib/aspose_pdf_cloud/models/attachments_response.rb +222 -222
  20. data/lib/aspose_pdf_cloud/models/color.rb +244 -244
  21. data/lib/aspose_pdf_cloud/models/color_depth.rb +45 -45
  22. data/lib/aspose_pdf_cloud/models/compression_type.rb +46 -46
  23. data/lib/aspose_pdf_cloud/models/doc_format.rb +43 -43
  24. data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +43 -43
  25. data/lib/aspose_pdf_cloud/models/document.rb +220 -220
  26. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +222 -222
  27. data/lib/aspose_pdf_cloud/models/document_privilege.rb +298 -298
  28. data/lib/aspose_pdf_cloud/models/document_properties.rb +211 -211
  29. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +222 -222
  30. data/lib/aspose_pdf_cloud/models/document_property.rb +227 -227
  31. data/lib/aspose_pdf_cloud/models/document_property_response.rb +222 -222
  32. data/lib/aspose_pdf_cloud/models/document_response.rb +233 -233
  33. data/lib/aspose_pdf_cloud/models/document_text_replace_response.rb +231 -231
  34. data/lib/aspose_pdf_cloud/models/epub_recognition_mode.rb +44 -44
  35. data/lib/aspose_pdf_cloud/models/field.rb +254 -254
  36. data/lib/aspose_pdf_cloud/models/field_response.rb +222 -222
  37. data/lib/aspose_pdf_cloud/models/field_type.rb +1 -1
  38. data/lib/aspose_pdf_cloud/models/fields.rb +211 -211
  39. data/lib/aspose_pdf_cloud/models/fields_response.rb +222 -222
  40. data/lib/aspose_pdf_cloud/models/font_encoding_rules.rb +43 -43
  41. data/lib/aspose_pdf_cloud/models/font_saving_modes.rb +45 -45
  42. data/lib/aspose_pdf_cloud/models/font_styles.rb +1 -1
  43. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +1 -1
  44. data/lib/aspose_pdf_cloud/models/html_document_type.rb +43 -43
  45. data/lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb +43 -43
  46. data/lib/aspose_pdf_cloud/models/http_status_code.rb +1 -1
  47. data/lib/aspose_pdf_cloud/models/image.rb +220 -220
  48. data/lib/aspose_pdf_cloud/models/image_response.rb +222 -222
  49. data/lib/aspose_pdf_cloud/models/image_src_type.rb +43 -43
  50. data/lib/aspose_pdf_cloud/models/image_template.rb +281 -281
  51. data/lib/aspose_pdf_cloud/models/image_templates_request.rb +230 -230
  52. data/lib/aspose_pdf_cloud/models/images.rb +211 -211
  53. data/lib/aspose_pdf_cloud/models/images_list_request.rb +205 -205
  54. data/lib/aspose_pdf_cloud/models/images_response.rb +222 -222
  55. data/lib/aspose_pdf_cloud/models/letters_positioning_methods.rb +43 -43
  56. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -43
  57. data/lib/aspose_pdf_cloud/models/link.rb +228 -228
  58. data/lib/aspose_pdf_cloud/models/link_action_type.rb +1 -1
  59. data/lib/aspose_pdf_cloud/models/link_annotation.rb +236 -236
  60. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +222 -222
  61. data/lib/aspose_pdf_cloud/models/link_annotations.rb +211 -211
  62. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +222 -222
  63. data/lib/aspose_pdf_cloud/models/link_element.rb +200 -200
  64. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +1 -1
  65. data/lib/aspose_pdf_cloud/models/margin_info.rb +244 -244
  66. data/lib/aspose_pdf_cloud/models/merge_documents.rb +200 -200
  67. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -293
  68. data/lib/aspose_pdf_cloud/models/page.rb +228 -228
  69. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +231 -231
  70. data/lib/aspose_pdf_cloud/models/page_word_count.rb +218 -218
  71. data/lib/aspose_pdf_cloud/models/pages.rb +211 -211
  72. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -303
  73. data/lib/aspose_pdf_cloud/models/parts_embedding_modes.rb +44 -44
  74. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +43 -43
  75. data/lib/aspose_pdf_cloud/models/raster_images_saving_modes.rb +44 -44
  76. data/lib/aspose_pdf_cloud/models/rectangle.rb +244 -244
  77. data/lib/aspose_pdf_cloud/models/rotation.rb +1 -1
  78. data/lib/aspose_pdf_cloud/models/saa_spose_response.rb +213 -213
  79. data/lib/aspose_pdf_cloud/models/segment.rb +206 -206
  80. data/lib/aspose_pdf_cloud/models/shape_type.rb +44 -44
  81. data/lib/aspose_pdf_cloud/models/signature.rb +333 -333
  82. data/lib/aspose_pdf_cloud/models/signature_type.rb +1 -1
  83. data/lib/aspose_pdf_cloud/models/signature_verify_response.rb +223 -223
  84. data/lib/aspose_pdf_cloud/models/split_result.rb +200 -200
  85. data/lib/aspose_pdf_cloud/models/split_result_document.rb +238 -238
  86. data/lib/aspose_pdf_cloud/models/split_result_response.rb +223 -223
  87. data/lib/aspose_pdf_cloud/models/stamp.rb +413 -413
  88. data/lib/aspose_pdf_cloud/models/stamp_type.rb +1 -1
  89. data/lib/aspose_pdf_cloud/models/text_format.rb +227 -227
  90. data/lib/aspose_pdf_cloud/models/text_format_response.rb +222 -222
  91. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -47
  92. data/lib/aspose_pdf_cloud/models/text_item.rb +218 -218
  93. data/lib/aspose_pdf_cloud/models/text_item_response.rb +222 -222
  94. data/lib/aspose_pdf_cloud/models/text_items.rb +211 -211
  95. data/lib/aspose_pdf_cloud/models/text_items_response.rb +222 -222
  96. data/lib/aspose_pdf_cloud/models/text_line.rb +210 -210
  97. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -220
  98. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -199
  99. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -222
  100. data/lib/aspose_pdf_cloud/models/text_replace.rb +253 -253
  101. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +232 -232
  102. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +262 -262
  103. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -222
  104. data/lib/aspose_pdf_cloud/models/text_state.rb +248 -248
  105. data/lib/aspose_pdf_cloud/models/tiff_export_options.rb +348 -348
  106. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -45
  107. data/lib/aspose_pdf_cloud/models/word_count.rb +199 -199
  108. data/lib/aspose_pdf_cloud/models/word_count_response.rb +223 -223
  109. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -44
  110. data/lib/aspose_pdf_cloud/version.rb +24 -24
  111. data/test/pdf_tests.rb +3 -3
  112. data/test_data/.gitattributes +1 -0
  113. data/test_data/TexExample.tex +304 -304
  114. metadata +13 -12
@@ -1,24 +1,24 @@
1
- =begin
2
- --------------------------------------------------------------------------------------------------------------------
3
- Copyright (c) 2018 Aspose.Pdf for Cloud
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
- SOFTWARE.
19
- --------------------------------------------------------------------------------------------------------------------
20
- =end
21
-
22
- module AsposePdfCloud
23
- VERSION = "18.6.0"
24
- end
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.PDF Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ module AsposePdfCloud
23
+ VERSION = "18.7.0"
24
+ end
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
  --------------------------------------------------------------------------------------------------------------------
3
- Copyright (c) 2018 Aspose.Pdf for Cloud
3
+ Copyright (c) 2018 Aspose.PDF Cloud
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
6
6
  in the Software without restriction, including without limitation the rights
@@ -1664,7 +1664,7 @@ class PdfTests < Minitest::Test
1664
1664
  def test_put_pdf_in_storage_to_html
1665
1665
  file_name = '4pages.pdf'
1666
1666
  upload_file(file_name)
1667
- res_file = 'result.html'
1667
+ res_file = 'result.zip'
1668
1668
 
1669
1669
  opts = {
1670
1670
  :folder => @temp_folder
@@ -1676,7 +1676,7 @@ class PdfTests < Minitest::Test
1676
1676
  def test_put_pdf_in_request_to_html
1677
1677
  file_name = '4pages.pdf'
1678
1678
 
1679
- res_file = 'result.html'
1679
+ res_file = 'result.zip'
1680
1680
 
1681
1681
  opts = {
1682
1682
  :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
@@ -0,0 +1 @@
1
+ *.mht -crlf -diff
@@ -1,305 +1,305 @@
1
- %% Introduction to latex facilities.
2
- %% Sat 31 Dec 2005
3
- %% Stephen Eglen.
4
-
5
- %% Text following a percent sign (%) until the end of line is treated
6
- %% as a comment.
7
-
8
- \documentclass{article}
9
-
10
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
- %% This section is called the preamble, where we can specify which
12
- %% latex packages we required. Most (but not of all) of the packages
13
- %% below should be fairly standard in most latex documents. The
14
- %% exception is xspace and the new \latex command, which you probably
15
- %% do not need.
16
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
-
18
- %% Better math support:
19
- \usepackage{amsmath}
20
-
21
- %% Bibliography style:
22
- \usepackage{mathptmx} % Use the Times font.
23
- \usepackage{graphicx} % Needed for including graphics.
24
- \usepackage{url} % Facility for activating URLs.
25
-
26
- %% Set the paper size to be A4, with a 2cm margin
27
- %% all around the page.
28
- \usepackage[a4paper,margin=2cm]{geometry}
29
-
30
- %% Natbib is a popular style for formatting references.
31
- \usepackage{natbib}
32
- %% bibpunct sets the punctuation used for formatting citations.
33
- \bibpunct{(}{)}{;}{a}{,}{,}
34
-
35
- %% textcomp provides extra control sequences for accessing text symbols:
36
- \usepackage{textcomp}
37
- \newcommand*{\micro}{\textmu}
38
- %% Here, we define the \micro command to print a text "mu".
39
- %% "\newcommand" returns an error if "\micro" is already defined.
40
-
41
- %% This is an example of a new macro that I've created to save me
42
- %% having to type \LaTeX each time. The xspace command provides space
43
- %% after the word LaTeX where appropriate.
44
- \usepackage{xspace}
45
- \providecommand*{\latex}{\LaTeX\xspace}
46
- %% "\providecommand" does nothing if "\latex" is already defined.
47
-
48
-
49
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
- %% Start of the document.
51
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
-
53
- \begin{document}
54
-
55
- \author{Stephen J. Eglen\\
56
- Department of Applied Mathematics and Theoretical Physics\\
57
- University of Cambridge\\
58
- Wilberforce Road\\
59
- Cambridge CB3 0WA U.K.}
60
- \date{\today}
61
- \title{A short example of how to use \latex for scientific reports}
62
- \maketitle
63
-
64
- \begin{abstract}
65
- The purpose of this short document is to provide a brief overview of
66
- the facilities that \latex offers for formatting scientific reports.
67
- Furthermore, the source files for regenerating this report are
68
- freely available so that users can easily start writing their own
69
- reports using \latex.
70
- \end{abstract}
71
-
72
- \section{Introduction}
73
-
74
- \latex is a typesetting program; given an input file with formatting
75
- instructions (e.g intro.tex), the program will create your document in
76
- one of several formats (DVI, Postscript or PDF). It is therefore not
77
- a WYSIWYG word processor. \latex is known as a logical markup
78
- language, similar for example to HTML, so that you describe a piece of
79
- text as a ``section heading'' rather than saying that it should be
80
- formatted in a certain way. It has excellent facilities for
81
- typesetting mathematics, and handles large documents (such as theses)
82
- well. The aim of this document is not to provide an overview of
83
- \latex, since many other guides have already been written (see
84
- Section~\ref{sec:summary}). Instead, it has been written primarily to
85
- provide simple workable examples that you can cut and paste to help
86
- you get started with \latex. The examples have been selected to be
87
- those most likely to be useful when writing a scientific report. This
88
- document is best read by comparing the source code with the resulting
89
- output.
90
-
91
- \section{Running \latex}
92
-
93
- The files to accompany this paper are at:
94
- \url{http://www.damtp.cam.ac.uk/user/eglen/texintro}. Get the
95
- following files and put them into a new directory.
96
-
97
- \begin{enumerate}
98
- \item \url{intro.tex}: the main \latex document.
99
- \item \url{example.bib}: a short bibliography.
100
- \item \url{sigmoid.ps}: example postscript image.
101
- \item \url{sigmoid.pdf}: example PDF image.
102
- \end{enumerate}
103
-
104
- Change directory to where you stored the files and type the
105
- following (ignoring comments placed after \#\#):
106
-
107
- \begin{verbatim}
108
- latex intro ## Run latex 1st time.
109
- bibtex intro ## Extract required references
110
- latex intro ## Run latex 2nd to resolve references.
111
- latex intro ## Probably need to run latex a 3rd time.
112
- xdvi intro ## View the DVI (device independent) file.
113
- dvips -o intro.ps intro ## Create a postscript file for printing.
114
- \end{verbatim}
115
-
116
- You will notice that you run latex several times here; this is so that
117
- references can be resolved, and references can be extracted from your
118
- bibtex file. After running latex, you will be told if you need to run
119
- it again to resolve references. After a while, you will get the idea
120
- of how many times you need to run latex to resolve all your
121
- references.
122
-
123
- If instead you would like to generate PDF files (see
124
- Section~\ref{sec:graphics} for a discussion of file formats for
125
- included images), you can try the following shorter sequence:
126
-
127
- \begin{verbatim}
128
- pdflatex intro
129
- bibtex intro
130
- pdflatex intro
131
- pdflatex intro
132
- xpdf intro.pdf ## View the resulting PDF
133
- \end{verbatim}
134
-
135
- Whether you prefer to generate DVI or PDF is up to you. The xdvi
136
- viewer has some nice features, such as it can reload your document
137
- easily and has a ``magnifying glass'' that is activated by the mouse.
138
- On the other hand, xpdf will display the document more accurately as
139
- it will be printed.
140
-
141
- \section{Tables}
142
-
143
- Tables are relatively straightforward to generate. Note that tables
144
- and figures are not always placed exactly where you wish, as
145
- they can \textit{float} to other parts of the document. Rather than
146
- trying to battle with \latex as to where they are placed, concentrate
147
- first on getting the right content and let \latex worry about the
148
- positioning. Instead, use labels to your tables to refer to them.
149
- See Table~\ref{tab:simple} and Table~\ref{tab:pars} for examples.
150
-
151
- \begin{table}
152
- \centering
153
- \begin{tabular}{ccc}
154
- year & min temp (\textdegree C) & max temp (\textdegree C)\\
155
- \hline
156
- 1970 & $-5$ & 35\\
157
- 1975 & $-7$ & 29\\
158
- 1980 & $-3$ & 30\\
159
- 1985 & $-2$ & 32\\
160
- \end{tabular}
161
- \caption{Fictional minimal and maximal temperatures recorded in
162
- Cambridge over several years.}
163
- \label{tab:simple}
164
- \end{table}
165
- %% Why are the negative numbers above enclosed in math mode?
166
- %% Hint: consider the difference between "-" in text and in math.
167
-
168
- \begin{table}[htbp]
169
- \centering
170
- \begin{tabular}{lccc}\\ \hline
171
- & \multicolumn{1}{c}{$\phi$ (\micro m)}
172
- & \multicolumn{1}{c}{$\alpha$}
173
- & $\delta_{12}$ (\micro m)\\ \hline
174
- W81S1\\
175
- $h_{11}(u)$ & 67.94 & 7.81\\
176
- $h_{22}(u)$ & 66.27 & 5.40\\
177
- $h_{12}(u)$ & & &18\\
178
- \hline
179
- M623\\
180
- $h_{11}(u)$ &112.79 & 3.05\\
181
- $h_{22}(u)$ & 65.46 & 8.11\\
182
- $h_{12}(u)$ & & &20\\
183
- \hline
184
- \end{tabular}
185
- \caption{Summary of parameter estimates for the univariate
186
- functions $h_{11}(u)$, $h_{22}(u)$ and the bivariate function
187
- $h_{12}(u)$. For the univariate fits, $\alpha$ and $\phi$ are
188
- least-square estimates (assuming $\delta$ was fixed at 15 \micro m).
189
- The final column gives the
190
- maximum likelihood estimate of $\delta_{12}$ assuming that the
191
- interaction between types is simple inhibition.
192
- \label{tab:pars}}
193
- \end{table}
194
-
195
-
196
- \section{Bibliography management}
197
-
198
- Scientific reports normally require a section where your references
199
- are listed. Bibtex is an excellent system for maintaining references,
200
- especially for large documents. Each reference needs a unique key;
201
- you can then refer to the reference in your \latex document by using
202
- this key within a cite command.
203
-
204
- Take care when formatting your references, especially when it comes to
205
- writing authors names and the case of letters in journal titles. In
206
- our examples, the files are found in \url{example.bib}. As an example
207
- of a citation, see \citep{ihaka1996} or \citep{ihaka1996,venables1999}.
208
-
209
- Bibtex is flexible enough to format your references in a wide number
210
- of different styles to suit your needs. In this file I have used the
211
- ``natbib'' package, which is suitable for the natural sciences.
212
- Depending on the type of cite command you get (and the package that
213
- you use for citations), you can get different styles of citation. See
214
- Table~\ref{tab:cite} for some examples.
215
-
216
- \begin{table}
217
- \centering
218
- \begin{tabular}{ll}
219
- \hline
220
- command & result\\ \hline
221
- \verb+\citep{ihaka1996}+ & \citep{ihaka1996}\\
222
- \verb+\citet{ihaka1996}+ & \citet{ihaka1996}\\
223
- \verb+\citep[see][p. 300]{ihaka1996}+ &
224
- \citep[see][p. 300]{ihaka1996}
225
- \\
226
- \verb+\citeauthor{ihaka1996}+ & \citeauthor{ihaka1996}
227
- \\
228
- \verb+\citeyear{ihaka1996}+ & \citeyear{ihaka1996}
229
- \\
230
- \hline
231
- \end{tabular}
232
- \caption{Examples of different citation commands available in the
233
- natbib package.}
234
- \label{tab:cite}
235
- \end{table}
236
-
237
-
238
- \section{Graphics}
239
- \label{sec:graphics}
240
-
241
- \latex can include images in one of several format, depending on
242
- whether you use latex (postscript format required) or pdflatex (either
243
- jpeg, png or pdf required). Figures can be included either at their
244
- natural size, or you can specify e.g. the figure width.
245
- Figure~\ref{fig:example} shows an example image which intentionally
246
- looks slightly different depending on whether you compile the document
247
- with latex or pdflatex. Note that in this example the suffix of the
248
- image file is not included so that this document compiles under both
249
- latex and pdflatex.
250
-
251
- \begin{figure}
252
- \centering
253
- \includegraphics[width=6cm]{sigmoid}
254
- \caption{Example of a sigmoidal curve generated by the R programming
255
- environment. The title above the curve indicates whether you have
256
- included the postscript or the pdf version of the figure.}
257
- \label{fig:example}
258
- \end{figure}
259
-
260
- \section{Mathematics}
261
-
262
- \latex can format mathematics with ease, either in line, such as
263
- $x \times y$, or on separate lines, such as:
264
- \[ x^2 +y^2 = z^2 \]
265
-
266
- If you are writing several lines of equations, you can use statements
267
- like the following:
268
-
269
- \begin{align}
270
- b(t) & = s(t) - \int_{0}^{T} a(t') \cdot i(T-t') dt'
271
- \\
272
- a(t) & = \int_{0}^{T} b(t) \cdot e(T-t') dt' \label{eq:am}
273
- \\
274
- g(t) & = b(t) \ast e(t) \nonumber
275
- \end{align}
276
-
277
- By using labels on certain equations, we can refer to equations by
278
- number, such as equation~(\ref{eq:am}).
279
-
280
- \section{Summary}
281
- \label{sec:summary}
282
- This short guide should give you a flavour of what can be done with
283
- \latex. It is by no means complete, or supposed to be
284
- self-explanatory. It is, however, hopefully enough to get you
285
- started! Try experimenting by editing the source file and then
286
- recompiling this document. As mentioned earlier, there are many
287
- guides for latex. Two that I can recommend are
288
- \url{http://www.andy-roberts.net/misc/latex/index.html} and
289
- `` The (Not So) Short Introduction to LaTeX2e''
290
- (\url{http://ctan.tug.org/tex-archive/info/lshort/english/lshort.pdf}).
291
-
292
-
293
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294
- %% Finally we specify the format required for our references and the
295
- %% name of the bibtex file where our references should be taken from.
296
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297
-
298
- \bibliographystyle{plainnat}
299
- \bibliography{example}
300
-
301
- \end{document}
302
-
303
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304
- %% The end.
1
+ %% Introduction to latex facilities.
2
+ %% Sat 31 Dec 2005
3
+ %% Stephen Eglen.
4
+
5
+ %% Text following a percent sign (%) until the end of line is treated
6
+ %% as a comment.
7
+
8
+ \documentclass{article}
9
+
10
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
+ %% This section is called the preamble, where we can specify which
12
+ %% latex packages we required. Most (but not of all) of the packages
13
+ %% below should be fairly standard in most latex documents. The
14
+ %% exception is xspace and the new \latex command, which you probably
15
+ %% do not need.
16
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
+
18
+ %% Better math support:
19
+ \usepackage{amsmath}
20
+
21
+ %% Bibliography style:
22
+ \usepackage{mathptmx} % Use the Times font.
23
+ \usepackage{graphicx} % Needed for including graphics.
24
+ \usepackage{url} % Facility for activating URLs.
25
+
26
+ %% Set the paper size to be A4, with a 2cm margin
27
+ %% all around the page.
28
+ \usepackage[a4paper,margin=2cm]{geometry}
29
+
30
+ %% Natbib is a popular style for formatting references.
31
+ \usepackage{natbib}
32
+ %% bibpunct sets the punctuation used for formatting citations.
33
+ \bibpunct{(}{)}{;}{a}{,}{,}
34
+
35
+ %% textcomp provides extra control sequences for accessing text symbols:
36
+ \usepackage{textcomp}
37
+ \newcommand*{\micro}{\textmu}
38
+ %% Here, we define the \micro command to print a text "mu".
39
+ %% "\newcommand" returns an error if "\micro" is already defined.
40
+
41
+ %% This is an example of a new macro that I've created to save me
42
+ %% having to type \LaTeX each time. The xspace command provides space
43
+ %% after the word LaTeX where appropriate.
44
+ \usepackage{xspace}
45
+ \providecommand*{\latex}{\LaTeX\xspace}
46
+ %% "\providecommand" does nothing if "\latex" is already defined.
47
+
48
+
49
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
+ %% Start of the document.
51
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
+
53
+ \begin{document}
54
+
55
+ \author{Stephen J. Eglen\\
56
+ Department of Applied Mathematics and Theoretical Physics\\
57
+ University of Cambridge\\
58
+ Wilberforce Road\\
59
+ Cambridge CB3 0WA U.K.}
60
+ \date{\today}
61
+ \title{A short example of how to use \latex for scientific reports}
62
+ \maketitle
63
+
64
+ \begin{abstract}
65
+ The purpose of this short document is to provide a brief overview of
66
+ the facilities that \latex offers for formatting scientific reports.
67
+ Furthermore, the source files for regenerating this report are
68
+ freely available so that users can easily start writing their own
69
+ reports using \latex.
70
+ \end{abstract}
71
+
72
+ \section{Introduction}
73
+
74
+ \latex is a typesetting program; given an input file with formatting
75
+ instructions (e.g intro.tex), the program will create your document in
76
+ one of several formats (DVI, Postscript or PDF). It is therefore not
77
+ a WYSIWYG word processor. \latex is known as a logical markup
78
+ language, similar for example to HTML, so that you describe a piece of
79
+ text as a ``section heading'' rather than saying that it should be
80
+ formatted in a certain way. It has excellent facilities for
81
+ typesetting mathematics, and handles large documents (such as theses)
82
+ well. The aim of this document is not to provide an overview of
83
+ \latex, since many other guides have already been written (see
84
+ Section~\ref{sec:summary}). Instead, it has been written primarily to
85
+ provide simple workable examples that you can cut and paste to help
86
+ you get started with \latex. The examples have been selected to be
87
+ those most likely to be useful when writing a scientific report. This
88
+ document is best read by comparing the source code with the resulting
89
+ output.
90
+
91
+ \section{Running \latex}
92
+
93
+ The files to accompany this paper are at:
94
+ \url{http://www.damtp.cam.ac.uk/user/eglen/texintro}. Get the
95
+ following files and put them into a new directory.
96
+
97
+ \begin{enumerate}
98
+ \item \url{intro.tex}: the main \latex document.
99
+ \item \url{example.bib}: a short bibliography.
100
+ \item \url{sigmoid.ps}: example postscript image.
101
+ \item \url{sigmoid.pdf}: example PDF image.
102
+ \end{enumerate}
103
+
104
+ Change directory to where you stored the files and type the
105
+ following (ignoring comments placed after \#\#):
106
+
107
+ \begin{verbatim}
108
+ latex intro ## Run latex 1st time.
109
+ bibtex intro ## Extract required references
110
+ latex intro ## Run latex 2nd to resolve references.
111
+ latex intro ## Probably need to run latex a 3rd time.
112
+ xdvi intro ## View the DVI (device independent) file.
113
+ dvips -o intro.ps intro ## Create a postscript file for printing.
114
+ \end{verbatim}
115
+
116
+ You will notice that you run latex several times here; this is so that
117
+ references can be resolved, and references can be extracted from your
118
+ bibtex file. After running latex, you will be told if you need to run
119
+ it again to resolve references. After a while, you will get the idea
120
+ of how many times you need to run latex to resolve all your
121
+ references.
122
+
123
+ If instead you would like to generate PDF files (see
124
+ Section~\ref{sec:graphics} for a discussion of file formats for
125
+ included images), you can try the following shorter sequence:
126
+
127
+ \begin{verbatim}
128
+ pdflatex intro
129
+ bibtex intro
130
+ pdflatex intro
131
+ pdflatex intro
132
+ xpdf intro.pdf ## View the resulting PDF
133
+ \end{verbatim}
134
+
135
+ Whether you prefer to generate DVI or PDF is up to you. The xdvi
136
+ viewer has some nice features, such as it can reload your document
137
+ easily and has a ``magnifying glass'' that is activated by the mouse.
138
+ On the other hand, xpdf will display the document more accurately as
139
+ it will be printed.
140
+
141
+ \section{Tables}
142
+
143
+ Tables are relatively straightforward to generate. Note that tables
144
+ and figures are not always placed exactly where you wish, as
145
+ they can \textit{float} to other parts of the document. Rather than
146
+ trying to battle with \latex as to where they are placed, concentrate
147
+ first on getting the right content and let \latex worry about the
148
+ positioning. Instead, use labels to your tables to refer to them.
149
+ See Table~\ref{tab:simple} and Table~\ref{tab:pars} for examples.
150
+
151
+ \begin{table}
152
+ \centering
153
+ \begin{tabular}{ccc}
154
+ year & min temp (\textdegree C) & max temp (\textdegree C)\\
155
+ \hline
156
+ 1970 & $-5$ & 35\\
157
+ 1975 & $-7$ & 29\\
158
+ 1980 & $-3$ & 30\\
159
+ 1985 & $-2$ & 32\\
160
+ \end{tabular}
161
+ \caption{Fictional minimal and maximal temperatures recorded in
162
+ Cambridge over several years.}
163
+ \label{tab:simple}
164
+ \end{table}
165
+ %% Why are the negative numbers above enclosed in math mode?
166
+ %% Hint: consider the difference between "-" in text and in math.
167
+
168
+ \begin{table}[htbp]
169
+ \centering
170
+ \begin{tabular}{lccc}\\ \hline
171
+ & \multicolumn{1}{c}{$\phi$ (\micro m)}
172
+ & \multicolumn{1}{c}{$\alpha$}
173
+ & $\delta_{12}$ (\micro m)\\ \hline
174
+ W81S1\\
175
+ $h_{11}(u)$ & 67.94 & 7.81\\
176
+ $h_{22}(u)$ & 66.27 & 5.40\\
177
+ $h_{12}(u)$ & & &18\\
178
+ \hline
179
+ M623\\
180
+ $h_{11}(u)$ &112.79 & 3.05\\
181
+ $h_{22}(u)$ & 65.46 & 8.11\\
182
+ $h_{12}(u)$ & & &20\\
183
+ \hline
184
+ \end{tabular}
185
+ \caption{Summary of parameter estimates for the univariate
186
+ functions $h_{11}(u)$, $h_{22}(u)$ and the bivariate function
187
+ $h_{12}(u)$. For the univariate fits, $\alpha$ and $\phi$ are
188
+ least-square estimates (assuming $\delta$ was fixed at 15 \micro m).
189
+ The final column gives the
190
+ maximum likelihood estimate of $\delta_{12}$ assuming that the
191
+ interaction between types is simple inhibition.
192
+ \label{tab:pars}}
193
+ \end{table}
194
+
195
+
196
+ \section{Bibliography management}
197
+
198
+ Scientific reports normally require a section where your references
199
+ are listed. Bibtex is an excellent system for maintaining references,
200
+ especially for large documents. Each reference needs a unique key;
201
+ you can then refer to the reference in your \latex document by using
202
+ this key within a cite command.
203
+
204
+ Take care when formatting your references, especially when it comes to
205
+ writing authors names and the case of letters in journal titles. In
206
+ our examples, the files are found in \url{example.bib}. As an example
207
+ of a citation, see \citep{ihaka1996} or \citep{ihaka1996,venables1999}.
208
+
209
+ Bibtex is flexible enough to format your references in a wide number
210
+ of different styles to suit your needs. In this file I have used the
211
+ ``natbib'' package, which is suitable for the natural sciences.
212
+ Depending on the type of cite command you get (and the package that
213
+ you use for citations), you can get different styles of citation. See
214
+ Table~\ref{tab:cite} for some examples.
215
+
216
+ \begin{table}
217
+ \centering
218
+ \begin{tabular}{ll}
219
+ \hline
220
+ command & result\\ \hline
221
+ \verb+\citep{ihaka1996}+ & \citep{ihaka1996}\\
222
+ \verb+\citet{ihaka1996}+ & \citet{ihaka1996}\\
223
+ \verb+\citep[see][p. 300]{ihaka1996}+ &
224
+ \citep[see][p. 300]{ihaka1996}
225
+ \\
226
+ \verb+\citeauthor{ihaka1996}+ & \citeauthor{ihaka1996}
227
+ \\
228
+ \verb+\citeyear{ihaka1996}+ & \citeyear{ihaka1996}
229
+ \\
230
+ \hline
231
+ \end{tabular}
232
+ \caption{Examples of different citation commands available in the
233
+ natbib package.}
234
+ \label{tab:cite}
235
+ \end{table}
236
+
237
+
238
+ \section{Graphics}
239
+ \label{sec:graphics}
240
+
241
+ \latex can include images in one of several format, depending on
242
+ whether you use latex (postscript format required) or pdflatex (either
243
+ jpeg, png or pdf required). Figures can be included either at their
244
+ natural size, or you can specify e.g. the figure width.
245
+ Figure~\ref{fig:example} shows an example image which intentionally
246
+ looks slightly different depending on whether you compile the document
247
+ with latex or pdflatex. Note that in this example the suffix of the
248
+ image file is not included so that this document compiles under both
249
+ latex and pdflatex.
250
+
251
+ \begin{figure}
252
+ \centering
253
+ \includegraphics[width=6cm]{sigmoid}
254
+ \caption{Example of a sigmoidal curve generated by the R programming
255
+ environment. The title above the curve indicates whether you have
256
+ included the postscript or the pdf version of the figure.}
257
+ \label{fig:example}
258
+ \end{figure}
259
+
260
+ \section{Mathematics}
261
+
262
+ \latex can format mathematics with ease, either in line, such as
263
+ $x \times y$, or on separate lines, such as:
264
+ \[ x^2 +y^2 = z^2 \]
265
+
266
+ If you are writing several lines of equations, you can use statements
267
+ like the following:
268
+
269
+ \begin{align}
270
+ b(t) & = s(t) - \int_{0}^{T} a(t') \cdot i(T-t') dt'
271
+ \\
272
+ a(t) & = \int_{0}^{T} b(t) \cdot e(T-t') dt' \label{eq:am}
273
+ \\
274
+ g(t) & = b(t) \ast e(t) \nonumber
275
+ \end{align}
276
+
277
+ By using labels on certain equations, we can refer to equations by
278
+ number, such as equation~(\ref{eq:am}).
279
+
280
+ \section{Summary}
281
+ \label{sec:summary}
282
+ This short guide should give you a flavour of what can be done with
283
+ \latex. It is by no means complete, or supposed to be
284
+ self-explanatory. It is, however, hopefully enough to get you
285
+ started! Try experimenting by editing the source file and then
286
+ recompiling this document. As mentioned earlier, there are many
287
+ guides for latex. Two that I can recommend are
288
+ \url{http://www.andy-roberts.net/misc/latex/index.html} and
289
+ `` The (Not So) Short Introduction to LaTeX2e''
290
+ (\url{http://ctan.tug.org/tex-archive/info/lshort/english/lshort.pdf}).
291
+
292
+
293
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294
+ %% Finally we specify the format required for our references and the
295
+ %% name of the bibtex file where our references should be taken from.
296
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297
+
298
+ \bibliographystyle{plainnat}
299
+ \bibliography{example}
300
+
301
+ \end{document}
302
+
303
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304
+ %% The end.
305
305
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%