Compare commits

...

95 commits

Author SHA1 Message Date
Kenneth Moreland
6c55769501 Get first line of release notes
The previous version of release-version.sh was dropping the first
line of the release notes. This change adds that first line to
the release notes.
2019-10-03 12:34:52 -06:00
Kenneth Moreland
0c21bd7f75 Update documentation pdf 2019-10-03 12:14:56 -06:00
Kenneth Moreland
ddcaa05f5c Merge branch 'input-directories' into 'master'
INPUT_DIRECTORIES option

See merge request kmorel/UseLATEX!2
2019-10-03 14:12:47 -04:00
Kenneth Moreland
6999f191fa Add documentation for INCLUDE_DIRECTORIES option 2019-10-01 09:52:38 -06:00
Kenneth Moreland
3c3ce51454 Add INCLUDE_DIRECTORIES option 2019-09-30 21:33:43 -06:00
Eric Doenges
adf9530897 Add support for setting the TEXINPUTS environment variable 2019-09-30 15:13:28 -06:00
Kenneth Moreland
4bfb138e33 Add test for multiply defined labels 2019-09-11 16:38:20 -07:00
Kenneth Moreland
e0e6028757 Update version in documentation 2019-09-11 16:28:21 -07:00
Kenneth Moreland
7e1e03b4c0 Fix issue with detecting long undefined reference warnings
LaTeX "helpfully" split across lines (and which fowled up our regex).
Get around the problem by instead searching for "LaTeX Warning:" at
the beginning of the line. Hopefully (1) all versions of LaTeX
actually write this out and (2) it is not used for trivial
warnings.
2019-09-11 16:24:56 -07:00
Kenneth Moreland
193d64b3c4 Fix typo 2019-09-04 13:18:15 -06:00
Kenneth Moreland
b99d970ef1 Update documentation to new version 2019-09-04 13:14:59 -06:00
Kenneth Moreland
b6e3317aaf Add tests for image handling with FORCE_* options 2019-09-04 13:13:51 -06:00
Kenneth Moreland
acc9ac7762 Disable unneeded image conversions when forcing DVI 2019-09-04 12:59:30 -06:00
Martin Wetzel
d0d4d59ff5 disable image conversions for DVI targets if only building PDF target
This prevents a needless dependency on ImageMagick if all images are already
in formats suitable for pdflatex, but would need to be converted to .eps for DVI builds.
2019-09-04 12:47:00 -06:00
Kenneth Moreland
88facfc81c Make version tags annotated 2019-08-05 17:40:07 -06:00
Kenneth Moreland
aa36c16f99 Parse through biber output for warnings
Important to find undefined citations
2019-08-05 15:04:05 -06:00
Kenneth Moreland
56d5753c84 Update pdf document 2018-09-11 17:38:18 -06:00
Kenneth Moreland
ac4d21d0b3 Fix issues with release-version.sh script 2018-09-11 17:36:20 -06:00
Kenneth Moreland
ca926d851c Update version in documentation 2018-09-11 17:32:38 -06:00
Kenneth Moreland
cdec9a8944 Support a custom biblatex.cfg file when using biblatex 2018-09-11 17:31:02 -06:00
Kenneth Moreland
64034cf48b Add comment about repository location to readme 2018-04-30 16:04:13 -06:00
Kenneth Moreland
8dd1878f7a Merge branch 'self-documenting-project-page' into 'master'
Self documenting project page

See merge request kmorel/UseLATEX!1
2018-04-30 17:59:01 -04:00
Kenneth Moreland
5c0fd3da23 Add script to update the version in git 2018-04-30 15:52:04 -06:00
Kenneth Moreland
dc2e6b8931 Add pdf to repo
This will help self document the project.
2018-04-30 13:10:02 -06:00
Kenneth Moreland
3945141c70 Update documentation for project page 2018-04-30 12:06:48 -06:00
Kenneth Moreland
a564114f2b Fix issue with converting synctex paths
When using the synctex option with pdflatex, it writes out a file
containing paths to the input files. The problem is that
UseLATEX.cmake copies all the input files, so you get a link to
the copy, not the original. To correct for this UseLATEX.cmake
changed the directories back to the input files, but it only
did so for relative paths. pdflatex writes out absolute paths,
so these were not properly converted. This should fix that issue.

I also noticed that some of the "input" files are actually those
produced by latex programs (e.g. .aux, .bbl). Trying to convert
these paths to the input would cause pointers to files that do
not exist. To try to correct for this I only convert paths of
files of known extensions.
2018-04-30 11:29:58 -06:00
Kenneth Moreland
091a7a3409 Update version in documentation 2018-04-30 10:11:29 -06:00
Kenneth Moreland
6577150a41 Fix issue with spaces in the working directory 2018-04-30 10:08:45 -06:00
Kenneth Moreland
1c817c70f2 Fix parse error for older versions of CMake
There was a reference to using VERSION_GREATER_EQUAL. However, this
conditional is only supported in CMake 3.7 and better. Instead,
use VERSION_GREATER, which is supported in much older versions
of CMake.
2017-10-16 16:31:52 -06:00
Kenneth Moreland
c8eb18ad32 Fix issues with paths that contain spaces 2017-08-21 15:12:38 -06:00
Kenneth Moreland
b36810fe9a Add warnings for missing characters 2017-07-27 14:23:33 -06:00
Kenneth Moreland
0c9f0c7822 Improve behavior when LaTeX fails 2017-07-27 12:11:07 -06:00
Kenneth Moreland
d03bb459ea Check for natbib package warnings
This is necessary to see if you are missing any bibliography entries while using natbib.
2017-06-08 18:43:27 -06:00
Kenneth Moreland
3a66f0e5e5 Update version number in documentation 2017-02-13 12:30:47 -07:00
Kenneth Moreland
6895ba6d37 Merge pull request #29 from kmorel/magick-argument-order
Fix the order of arguments for magick in ImageMagick 7.0
2017-02-13 12:25:24 -07:00
Kenneth Moreland
c5394a7263 Fix the order of arguments for magick in ImageMagick 7.0
You now have to give flags like -resize after the input file.
2017-02-13 11:09:14 -07:00
Kenneth Moreland
2fd11379ab Merge pull request #25 from taketwo/master
Update list of automatically copied file extensions in documentation
2016-12-23 17:00:16 -07:00
Sergey Alexandrov
abad1ed145 Update list of automatically copied file extensions in documentation
Files with extensions .sty, .ist, and .fd were not mentioned, although
they are automatically copied as well.
2016-12-22 12:24:20 +01:00
Kenneth Moreland
0eb452382a Output full log file on LaTeX error
When running LaTeX in batch mode, it might not print any output when a
failure occurs. So, when running in this mode, cat out the log failure
if a LaTeX error occurs.

The implementation for this wraps the latex call in a CMake script
that runs latex and checks the return value. If not a success value,
reads and then prints the log.
2016-12-14 21:43:39 -07:00
Kenneth Moreland
9d39cbdadc Remove latex2html and fix some issues with htlatex 2016-11-22 14:29:02 -07:00
Kenneth Moreland
f1d6102b39 Bump up version to 2.4.0
The feature of checking the LaTeX build for important warnings is enough
to use a minor revision rather than a patch release.
2016-11-22 13:14:44 -07:00
Kenneth Moreland
52de6837a4 Document the default latex arguments 2016-11-22 13:08:58 -07:00
Kenneth Moreland
63a8a4f49e After build, grep log file for most important warnings
Currently checking for overfull warnings and bad references. This should
make it easier to identify problems with LaTeX files.
2016-11-22 13:06:36 -07:00
Kenneth Moreland
e80946efba Change default LaTeX arguments
They make the output much less verbose and also add file/line numbers
to errors. This mode is much nicer output for build systems. Thanks to
Nikos Koukis for the suggestion.
2016-11-22 11:45:00 -07:00
Kenneth Moreland
22eacee5cd Use # instead of = in ps2pdf args on Windows
The ps2pdf command is really just a script, and on the Windows port
it is a bat file. The Windows command interpreter for bat files treat
= as a special character, so on Windows you should use # instead.
2016-11-22 09:42:16 -07:00
Kenneth Moreland
66ca3a5cac Correct how program flags are separated
The _FLAGS CMake variables are specified as space-separated arguments
to make them easier to type. However, they have to be converted to CMake
lists to pass them to CMake commands that run programs. Otherwise they
will be interpreted as a single argument.

There were some separate_arguments commands to do just that. However,
I think when I changed over from defining macros to defining functions,
the scope of the separated arguments broke. This should fix that.
2016-11-21 14:48:56 -07:00
Kenneth Moreland
f4546b6d8e Remove resolution argument from pdftops
A user reported that converting a pdf to an eps was failing because his
pdftops program, which was a recent build/release, did not support the
-r flag, which sets the resolution used when objects are rasterized.
After some searching, I believe the issue is that there are two versions
of pdftops running around: one from Poppler and one from Xpdf. The former
supports the raster resolution flag, the latter does not.

Rather than jump through hoops trying to identify which one is installed
on a system, I just removed the flag. The consequence is that rasterized
objects will use a smaller resolution (the default is 300 dpi, and we were
setting it to 600 dpi). However, if you start engaging rasterization, then
the result probably is not looking as good anyway.
2016-11-21 14:05:48 -07:00
Kenneth Moreland
c190c19cae Add more image file types to image types test 2016-11-21 13:51:43 -07:00
Kenneth Moreland
7c6ea36464 Update documentation to 2.3.2 2016-09-08 11:21:14 -06:00
Kenneth Moreland
46e7d83b2a Fix issue with HTML targets when main tex file is in subdirectory 2016-09-08 11:14:23 -06:00
Kenneth Moreland
844394a066 Add LaTeX inputs as sources to targets
This allows the files to show up in IDEs like Qt Creator.
2016-09-08 09:07:36 -06:00
Kenneth Moreland
9b5271a10f Update documentation for changes in ImageMagick 2016-09-07 15:42:46 -06:00
Kenneth Moreland
e6358ec349 Support the use of magick instead of convert
It looks like with the release of ImageMagick 7.0 that the name of the
convert program has been renamed to magick. Most implementation have a
link from convert to magick, but the windows install by default does
not provide a convert program. To make sure it works everywhere, search
for both programs (searching for magick first).
2016-09-07 15:24:10 -06:00
Kenneth Moreland
18390f6a94 Add FAQ on the use of FORCE_DVI for ps and safepdf targets. 2016-04-04 11:57:30 -06:00
Kenneth Moreland
73515335f5 Add documentation for USE_BIBLATEX command. 2016-02-15 23:34:35 -07:00
Kenneth Moreland
1a9d75a3b5 Add test for bibliographies. 2016-02-15 23:22:28 -07:00
Kenneth Moreland
54d2bdfe71 Change BIBLATEX_COMPILER to BIBER_COMPILER
Previously, UseLATEX.cmake was calling latex_needit for the
BIBLATEX_COMPILER variable. However, this variable was never set
because the FindLATEX module sets the BIBER_COMPILER variable instead.
Look for that variable.

Other minor changes include updating the documenting comments and calling
wantit rather than needit on the biber compiler just in case there are
latex installations without it.
2016-02-15 23:19:51 -07:00
David Tracey
2c570eea4d Add [USE_BIBLATEX] to description in file header. 2016-02-14 18:04:35 +00:00
David Tracey
4177f43744 Refactor integration of biblatex support. 2016-02-14 17:51:22 +00:00
David Tracey
763d730275 Add usage comment. 2016-02-12 23:56:00 +00:00
David Tracey
2d71bffed5 Add support for biblatex/biber 2016-02-12 23:43:44 +00:00
Kenneth Moreland
3d6a7a93d3 Add STRINGS property to LATEX_DEFAULT_BUILD
This makes it easier to select the default build in the CMake GUI.
2015-12-01 15:48:27 -07:00
Kenneth Moreland
d83fd902b5 Add documentation for TARGET_NAME option. 2015-10-19 14:41:12 -06:00
Kenneth Moreland
82357b7dde Add TARGET_NAME option.
A user requested the ability to make the target names created by UseLATEX
different than the name of the main tex file. The use case was for a
multi-directory project with two or more subdirectories containing LaTeX
files with the same name.
2015-10-19 14:22:34 -06:00
Kenneth Moreland
47ba871b8e Correct README for MultiIndex test. 2015-10-19 14:21:26 -06:00
Kenneth Moreland
b662bf887f Forgot to update version in document. 2015-09-09 10:23:42 -06:00
Kenneth Moreland
18abbfebc1 Support bmp and other image formats. 2015-09-08 10:54:57 -06:00
Kenneth Moreland
26426e23ec Support for multind package (thanks to Dan Lipsa) 2015-09-03 13:46:10 -06:00
Kenneth Moreland
7c30cef708 Fix issue where pdf, etc. where declared each time UseLATEX was loaded.
In a large project, it is not uncommon to have LaTeX documents built in
different subdirectories and to have each subdirectory include
UseLATEX.cmake. However, loading UseLATEX.cmake multiple times caused
the pdf, dvi, etc. targets to be created multiple times even though the
intention is to have them loaded once. This change creates each target
only once.
2015-08-25 13:46:56 -06:00
Kenneth Moreland
8ecd472518 Merge pull request #14 from anatolyborodin/cmake_version
Require CMake version >= 2.8.4

Let the documentation and example builds reflect the actual minimum CMake version.
2015-07-23 22:47:24 -04:00
Anatoly Borodin
fb07aa109f Require CMake version >= 2.8.4
The newest 3.* CMake versions may be missing in some distributions.

The most recent feature required by UseLATEX and its tests is
ced1d5eccd:
"Skip file-level dependencies on custom targets (#11332)". The commit is
included in the release version 2.8.4.

The following error messages are produced during compilation with
earlier CMake versions:

	[100%] Built target UseLATEX_pdf
	make[2]: *** No rule to make target `UseLATEX_pdf', needed by `UseLATEX_build/CMakeFiles/UseLATEX'.  Stop.

Signed-off-by: Anatoly Borodin <anatoly.borodin@gmail.com>
2015-07-23 22:40:31 +02:00
Kenneth Moreland
dc6efbb2b8 Merge pull request #13 from gruenich/patch-1
Fix typos in comments
2015-07-20 12:48:18 -06:00
Christoph Grüninger
640891fd25 Fix typos
and a trailing white space.
2015-07-11 17:13:32 +02:00
Kenneth Moreland
74ae43a968 Add explicit errors when using removed options. 2015-04-09 14:24:31 -06:00
Kenneth Moreland
2ce9fb7097 Update copyright and license information. 2015-04-09 13:53:09 -06:00
Kenneth Moreland
5bb6a7a638 Add EXCLUDE_FROM_DEFAULTS option
Previously, the EXCLUDE_FROM_ALL option broke both the dependency from
the all target and the dependency from the dvi, pdf, etc. targets. However,
there is plenty of reason to want only one or the other, so the
EXCLUDE_FROM_ALL option was broken up into a second EXCLUDE_FROM_DEFAULTS
that controls the second set of dependencies.
2015-04-09 11:46:56 -06:00
Kenneth Moreland
e603d1f003 Typo.
Pointed out by Izaak Beekman.
2015-02-20 23:25:31 -07:00
Kenneth Moreland
59cc0e32ce Forgot to add dependency from auxclean target to mangled targed. 2014-12-19 14:52:55 +05:30
Kenneth Moreland
5f7c265521 Update documentation for mangled naming. 2014-12-15 17:18:54 +05:30
Kenneth Moreland
78a7233a33 Automatically mangle LaTeX targets.
This way when you call add_latex_document multiple times you do not get
multiply defined targets.
2014-12-15 16:34:59 +05:30
Kenneth Moreland
9e1f62b5dc Update documentation for how default builds work. 2014-12-15 14:49:22 +05:30
Kenneth Moreland
a01764abf1 Add FORCE_* arguments. 2014-12-15 00:25:02 -05:00
Kenneth Moreland
9778983e16 Change how default builds are specified.
Removed the DEFAULT_* arguments. Instead, have a CMake variable named
LATEX_DEFAULT_BUILD that specifies what the default build should be.
This CMake variable is initialized with an environment variable of the
same name or PDF if none is specified. This allows each user to specify
a default build without having to change the configuration.

There is also an EXCLUDE_FROM_ALL option that, like the same option in
add_executable, keeps the document from being built in the default all
target.
2014-12-14 23:33:03 -05:00
Kenneth Moreland
11e29805bc Mark variables for executables advanced.
UseLATEX.cmake finds several executables for compiling documents and
converting files. Previously these were not marked as advanced, but
CMake now conventionally makes them advanced to avoid cluttering the
GUI.
2014-12-14 16:40:34 -05:00
Kenneth Moreland
91cc27cbc3 Remove some deprecated features. 2014-12-14 16:33:40 -05:00
Kenneth Moreland
5468246176 Explicitly list the main tex file as an argument.
Should make errors easier to trace.
2014-12-14 15:55:34 -05:00
Kenneth Moreland
f77b563329 Clean up some set commands.
Change "set (" to "set("

Change some set commands that were actually appending a list to a list(append
command, which shows better the point of the command and could be faster.
2014-12-14 15:40:16 -05:00
Kenneth Moreland
2eb8826243 Use the parse argument function that comes with CMake.
That module is actually based off the code that originally came from
UseLATEX.cmake, but now that it exists and is supported by the CMake
community, there is no reason to have a second copy here.
2014-12-14 15:16:19 -05:00
Kenneth Moreland
2cf610a36b Update else/endif arguments.
The arguments for else and endif commands are now no longer necessary. In
fact, the are no longer encouraged. This is because, in addition to it
being annoying to exactly match expressions, it becomes confusing when
there is an else clause. (The expression is actually the inverse of the
case for the else clause.)
2014-12-14 11:08:31 -06:00
Kenneth Moreland
77fe49f7c1 Change capitalized function names to lower case function names.
This is the "new" style in CMake. It's actually been around a while, but
UseLATEX.cmake was not updated previously.
2014-12-14 10:56:29 -06:00
Martin Baute
3264be4f0f Fix check for Window's convert.
Older versions of Windows use the path C:\Windows\system32. Newer ones
use the path C:\Windows\System32 (with a capitol S). They are somewhat
equivalent because Windows file system is not case sensitive, but it
made the check for the system32 directory fail. This change first converts
the path the lowercase to do a non case sensitive comparison.
2014-06-12 11:36:37 -06:00
Christoph Grüninger
fa0fc39926 White space changes: Replace tabs and remove trailing spaces.
Remove an old commented line.
2014-05-25 15:35:03 +02:00
Kenneth Moreland
4627adc1e4 Attribution for LuaLaTeX. 2014-03-19 14:21:48 -06:00
Kenneth Moreland
582d86ccbd Merge pull request #7 from theMarix/master
Document how to use the lualatex program.
2014-03-19 14:15:50 -06:00
Matthias Bach
4dbbc765d6 Document how to use the lualatex program. 2014-03-19 21:05:10 +01:00
65 changed files with 2976 additions and 980 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.swp
*~

View file

@ -1,13 +1,13 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.4)
PROJECT(UseLATEX_DOC NONE)
project(UseLATEX_DOC NONE)
INCLUDE(UseLATEX.cmake)
include(UseLATEX.cmake)
# Note that normally CMakeLists.txt would not be considered an
# input to the document, but in this special case of documenting
# UseLATEX.cmake the contents of this file is actually included
# in the document.
ADD_LATEX_DOCUMENT(UseLATEX.tex
add_latex_document(UseLATEX.tex
INPUTS CMakeLists.txt
)

34
README
View file

@ -1,34 +0,0 @@
Compiling LaTeX files into readable documents is actually a very involved
process. Although CMake comes with FindLATEX.cmake, it does nothing for
you other than find the commands associated with LaTeX. I like using CMake
to build my LaTeX documents, but creating targets to do it is actually a
pain. Thus, I've compiled a bunch of macros that help me create targets in
CMake into a file I call "UseLATEX.cmake". Here
are some of the things UseLATEX.cmake handles:
* Runs LaTeX multiple times to resolve links.
* Can run bibtex, makeindex, and makeglossaries to make bibliographies,
indexes, and/or glossaries.
* Optionally runs configure on your latex files to replace @VARIABLE@ with
the equivalent CMake variable.
* Automatically finds png, jpeg, eps, and pdf files and converts them to
formats latex and pdflatex understand.
This repository contains the CMake macros in the UseLATEX.cmake file. To
get started, copy this file to your own LaTeX project and include it in
your build process.
You will also find a LaTeX document, UseLATEX.tex, that contains all of the
documentation for UseLATEX.cmake. You will also find a CMake build file,
CMakeLists.txt, that uses UseLATEX.cmake to build UseLATEX.tex. It also
serves as a good example for using UseLATEX.cmake.
You can find the latest information on UseLATEX.cmake on the CMake Wiki at
the following URL.
http://www.cmake.org/Wiki/CMakeUserUseLATEX

42
README.md Normal file
View file

@ -0,0 +1,42 @@
Compiling LaTeX files into readable documents is actually a very involved
process. Although CMake comes with FindLATEX.cmake, it does nothing for you
other than find the commands associated with LaTeX. I like using CMake to
build my LaTeX documents, but creating targets to do it is actually a pain.
Thus, I've compiled a bunch of macros that help me create targets in CMake
into a file I call [UseLATEX.cmake](UseLATEX.cmake). Here are some of the
things [UseLATEX.cmake](UseLATEX.cmake) handles:
* Runs LaTeX multiple times to resolve links.
* Can run bibtex, makeindex, and makeglossaries to make bibliographies,
indexes, and/or glossaries.
* Optionally runs configure on your latex files to replace `@VARIABLE@`
with the equivalent CMake variable.
* Automatically finds png, jpeg, eps, and pdf files and converts them to
formats latex and pdflatex understand.
## Download
The files can be downloaded directly from the UseLATEX project page. If you
are viewing this from a web page, you can follow the following links.
* Click here to get a copy of [UseLATEX.cmake](https://gitlab.kitware.com/kmorel/UseLATEX/raw/master/UseLATEX.cmake).
* Click here to get the documentation [UseLATEX.pdf](https://gitlab.kitware.com/kmorel/UseLATEX/raw/master/UseLATEX.pdf).
## Repository
This repository contains the CMake macros in the
[UseLATEX.cmake](UseLATEX.cmake) file. To get started, copy this file to
your own LaTeX project and include it in your build process.
You will also find a LaTeX document, [UseLATEX.tex](UseLATEX.tex), that
contains all of the documentation for [UseLATEX.cmake](UseLATEX.cmake). You
will also find a CMake build file, [CMakeLists.txt](CMakeLists.txt), that
uses [UseLATEX.cmake](UseLATEX.cmake) to build
[UseLATEX.tex](UseLATEX.tex). It also serves as a good example for using
[UseLATEX.cmake](UseLATEX.cmake).
There has been some requests to incorporate UseLATEX.cmake into the CMake
repository and distribution. Nobody thinks this is a bad idea, but it
hasn't yet happened mostly out of laziness. Keep bugging me to show
interest in moving UseLATEX.cmake. (See the author contact information at
the top of [UseLATEX.cmake](UseLATEX.cmake).)

File diff suppressed because it is too large Load diff

BIN
UseLATEX.pdf Normal file

Binary file not shown.

View file

@ -2,7 +2,7 @@
\documentclass{article}
\newcommand{\UseLATEXVersion}{1.10.4}
\newcommand{\UseLATEXVersion}{2.7.0}
\newcommand{\SANDNumber}{SAND 2008-2743P}
% This wonderful package allows hyphenation in tt fonts and hyphenation of
@ -40,7 +40,8 @@
\newcommand*{\synctex}{SyncTeX\xspace}
\fi
\newcommand*{\xelatex}{\Hologo{XeLaTeX}\xspace}
\newcommand*{\ald}{\textcmake{ADD\_LATEX\_DOCUMENT}\xspace}
\newcommand*{\lualatex}{\Hologo{LuaLaTeX}\xspace}
\newcommand*{\ald}{\textcmake{add\_latex\_document}\xspace}
% Environments for listing CMake and other types of code.
\definecolor{listingframecolor}{cmyk}{0,0,0,0.25}
@ -84,9 +85,11 @@
glossaries.
\item Optionally runs configure on your \latex files to replace
\textcmake{@\textvar{VARIABLE}@} with the equivalent CMake variable.
\item Automatically finds png, jpeg, eps, pdf, svg, tiff, and gif files
and converts them to formats \textprog{latex} and \textprog{pdflatex}
understand.
\item Automatically finds png, jpeg, eps, pdf, svg, tiff, gif, bmp, and
other image files and converts them to formats \textprog{latex} and
\textprog{pdflatex} understand.
\item Reduces \latex's overly verbose output and searches for messages
that are more likely to require attention.
\end{itemize}
%-----------------------------------------------------------------------------
@ -111,10 +114,10 @@
simple \textfile{CMakeLists.txt}.
\begin{CodeListing}
PROJECT(MyDoc NONE)
project(MyDoc NONE)
INCLUDE(UseLATEX.cmake)
ADD_LATEX_DOCUMENT(MyDoc.tex)
include(UseLATEX.cmake)
add_latex_document(MyDoc.tex)
\end{CodeListing}
The \ald adds the following targets to create a readable document from
@ -132,7 +135,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex)
pdfs are created this way. Requires the
\textcmakevar{PS2PDF\_CONVERTER} CMake variable to be set.
\item[\textmaketarget{html}] Creates html pages. Requires the
\textcmakevar{LATEX2HTML\_CONVERTER} CMake variable to be set.
\textcmakevar{HTLATEX\_COMPILER} CMake variable to be set.
\item[\textmaketarget{clean}] To CMake's default \textmaketarget{clean}
target, the numerous files that \latex often generates are added.
\item[\textmaketarget{auxclean}] Deletes the auxiliary files from
@ -162,7 +165,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex)
the \ald command.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex BIBFILES MyDoc.bib)
add_latex_document(MyDoc.tex BIBFILES MyDoc.bib)
\end{CodeListing}
This will automatically add targets to build your bib file and link it
@ -190,7 +193,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex BIBFILES MyDoc.bib)
macro to point to them. \UseLATEX will take care of the rest.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
)
@ -198,10 +201,10 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
If you want to break up your image files in several different
directories, you can do that, too. Simply provide multiple directories
after the \textcmake{IMAGE\_DIRS} command.
after the \textcmake{IMAGE\_DIRS} option.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS icons figures
)
@ -211,40 +214,27 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
\textcmake{IMAGES} option.
\begin{CodeListing}
SET(MyDocImages
set(MyDocImages
logo.eps
icons/next.png
icons/previous.png
figures/flowchart.eps
figures/team.jpeg
)
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
IMAGES ${MyDocImages}
)
\end{CodeListing}
%$
Both the \textcmake{IMAGE\_DIRS} and \textcmake{IMAGES} can be used
together. The combined set of image files will be processed. If you wish
to provide a separate eps file and pdf or png file, that is OK,
too. \UseLATEX will handle that by copying over the correct file instead
of converting.
Once you establish the images directory, CMake will automatically find
all files with known image extensions (currently eps, pdf, png, jpeg, and
jpg) in it and add makefile targets to use ImageMagick's
\textprog{convert} to convert the file times to those appropriate for the
build. (One exception is that \textprog{ps2pdf} will be used when
converting eps to pdf to get around a problem where ImageMagick drops the
bounding box information.) If you do not have ImageMagick, you can get
it for free from
\href{http://www.imagemagick.org}{http://www.imagemagick.org}. CMake will
also give you a \textcmakevar{LATEX\_SMALL\_IMAGES} option that, when on,
will downsample raster images. This can help speed up building and
viewing documents. It will also make the output image sizes smaller.
For every image file specified and found with the \textcmake{IMAGE\_DIRS} and \textcmake{IMAGES} options, \UseLATEX adds makefile targets to use ImageMagick's \textprog{magick} or \textprog{convert} to convert the file types to those appropriate for the build.\footnote{The \textprog{convert} program was essentially renamed \textprog{magick} in ImageMagick 7.0. Most, but not all, recent installations provide both. \UseLATEX looks for both just in case.}
If you do not have ImageMagick, you can get it for free from \href{http://www.imagemagick.org}{http://www.imagemagick.org}.
CMake will also give you a \textcmakevar{LATEX\_SMALL\_IMAGES} option that, when on, will downsample raster images.
This can help speed up building and viewing documents.
It will also make the output image sizes smaller.
\UseLATEX will occasionally use a conversion program other than
ImageMagick's \textprog{convert}. For example, \textprog{ps2pdf} will be
ImageMagick's \textprog{magick}. For example, \textprog{ps2pdf} will be
used when converting eps to pdf to get around a problem where ImageMagick
drops the bounding box information. When available, the
\textprog{pdftops} from the Poppler utilities will be used to convert pdf
@ -253,6 +243,21 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
conversion program. \UseLATEX will automatically select the best one and
issue errors or warnings if there is a problem.
The \textcmake{IMAGE\_DIRS} option tries to identify image files by their
extensions. The current list of image extensions \UseLATEX checks for is:
.bmp, .bmp2, .bmp3, .dcm, .dcx, .ico, .gif, .jpeg, .jpg, .eps, .pdf,
.pict, .png, .ppm, .tif, and .tiff. If you are trying to use an image
format that is supported by ImageMagick but is not recognized by
\UseLATEX, you can specify the files directly with the \textcmake{IMAGES}
option instead. \UseLATEX will assume that any file specified with the
\textcmake{IMAGES} option is an image file regardless of its extension.
Both the \textcmake{IMAGE\_DIRS} and \textcmake{IMAGES} can be used
together. The combined set of image files will be processed. If you wish
to provide a separate eps file and pdf or png file, that is OK,
too. \UseLATEX will handle that by copying over the correct file instead
of converting.
Depending on what program is launched to build your \latex file (either
\textprog{latex} or \textprog{pdflatex}, and \UseLATEX supports both), a
particular format for your image is required. As stated, \UseLATEX
@ -268,47 +273,71 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
\$\{CMAKE\_CURRENT\_SOURCE\_DIR\}/images} will fail. Use
\textcmake{IMAGE\_DIRS images} instead.
\subsection{Create a PDF or PS by Default}
\label{sec:CreateAPDFOrPSByDefault}
\subsection{Selecting a Default Build}
\label{sec:SelectingADefaultBuild}
By default, when you use \ald and then run make with no arguments, the
dvi file will be created. You have to specifically build the pdf target
to use \textprog{pdflatex} to create a pdf file. However, oftentimes we
want the pdf to be generated by default. To do that, simply use the
\textcmake{DEFAULT\_PDF} option to \ald:
By default, when you use \ald and then run make with no arguments,
\textprog{pdflatex} is used to create a pdf file. You can of course
always specify a target described at the top of
Section~\ref{sec:BasicUsage} to build a different document
format. However, for convenience you can change the default build.
\UseLATEX defines the CMake variable \textcmakevar{LATEX\_DEFAULT\_BUILD}
that controls which build is performed by default. Valid values for this
variable are \textcmake{pdf}, \textcmake{dvi}, \textcmake{ps},
\textcmake{safepdf}, and \textcmake{html}. This variable is usually
initialized to \textcmake{pdf}, but you can override this behavior by
setting the \textcmakevar{LATEX\_DEFAULT\_BUILD} environment variable
before the first configuration. Thus, if you have a preference for a
particular default build, you can set your system environment to use it
by default for all \UseLATEX builds.
\subsection{Force a Type of Build}
\label{sec:ForceATypeOfBuild}
\UseLATEX does its best to make \latex builds as portable as possible,
but there might be a number of technical reasons why a particular
document can only be built using one type of system. If that is the case,
it is best if the configuration only supports one type of build.
\ald has several options to force the document generation to a particular
type of build. If you give the option \textcmake{FORCE\_PDF}, only the
pdf targets that use the \textprog{pdflatex} command are created.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
DEFAULT_PDF
FORCE_PDF
)
\end{CodeListing}
If you still want to use the \textprog{latex} program to compile your
documents but by default want to create pdf files (that is, build the
safepdf target by default), then use the \textcmake{DEFAULT\_SAFEPDF}
option to \ald:
Likewise, the \textcmake{FORCE\_DVI} option restricts \ald to targets that
use the \textprog{latex} command. In addition to building dvi files,
\textcmake{FORCE\_DVI} also allows ps generation from the dvi files and
``safe'' pdf generation from the ps files.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
DEFAULT_SAFEPDF
FORCE_PS
)
\end{CodeListing}
It is also possible to make postscript files by default by using the
\textcmake{DEFAULT\_PS} option.
Finally, the \textcmake{FORCE\_HTML} option will restrict targets that are
used for html generation.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
DEFAULT_PS
FORCE_HTML
)
\end{CodeListing}
The behavior is undefined if more than one force option is given.
\subsection{Create Nothing by Default}
\label{sec:CreateNothingByDefault}
@ -316,21 +345,17 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
by default (that is, not build it with the \textmaketarget{all} target).
This is convenient when including \latex documentation with some other
source to build such as when you are documenting a library. To remove
all targets from the default, simply add the \textcmake{NO\_DEFAULT}
option to \ald.
all targets from the default, simply add the
\textcmake{EXCLUDE\_FROM\_ALL} option to \ald.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
NO_DEFAULT
EXCLUDE_FROM_ALL
)
\end{CodeListing}
It is undefined what happens if you combine the \textcmake{NO\_DEFAULT}
option with any of the other default build target options like
\textcmake{DEFAULT\_PDF}.
\subsection{\synctex-Enabled Editors}
\label{sec:SynctexEnabledEditors}
@ -382,18 +407,51 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
You can make an index in a \latex document by using the
\textlatexpackage{makeidx} package. However, this package requires you to
run the \textprog{makeindex} command. Simply add the
run the \textprog{makeindex} program. Simply add the
\textcmake{USE\_INDEX} option anywhere in the \ald arguments, and
\textprog{makeindex} will automatically be added to the build.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
USE_INDEX
)
\end{CodeListing}
\subsection{Making Multiple Indexes}
\label{sec:MakingMultipleIndexes}
The \textlatexpackage{multind} package allows you to create multiple
indexes in a single \latex document. For example, when documenting a
software library you might want to have a general index of terms and a
second index of function names.
The way the \textlatexpackage{multind} package works is that it creates a
separate index file for each of the indexes being created, and the
\textprog{makeindex} program must be run independently on each of them.
To get \UseLATEX to run \textprog{makeindex} on all of the required index
file, list all of the indexes created with the \textcmake{INDEX\_NAMES}
option of \ald. For example, in a \latex document that declares two
indexes like the following
\begin{CodeListing}
\usepackage{multind}
\makeindex{general}
\makeindex{functions}
\end{CodeListing}
you would name the indexes in \ald like the following.
\begin{CodeListing}
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
USE_INDEX
INDEX_NAMES general functions
)
\end{CodeListing}
\subsection{Making a Glossary}
\label{sec:MakingAGlossary}
@ -410,7 +468,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
handled for you.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
USE_GLOSSARY
@ -433,7 +491,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
build the nomenclature.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
USE_NOMENCL
@ -494,12 +552,34 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
arguments, respectively.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
BIBFILES own.bib submitted.bib techreports.bib theses.bib
MULTIBIB_NEWCITES own submitted internal
)
\end{CodeListing}
\subsection{\textlatexpackage{biblatex} Support}
\label{sec:biblatexSupport}
The \textlatexpackage{biblatex} package provides an alternate mechanism
for building bibliographies that has many options not available to the
standard bibliography commands. The package (typically) requires an
external program named \textprog{biber}, which is an alternative to the
standard \textprog{bibtex} command.
Thus, to support the \textlatexpackage{biblatex} package, the build
system must run \textprog{biber} instead of \textprog{bibtex}. This is
done simply with \UseLATEX by adding the \textcmake{USE\_BIBLATEX} option
to \ald.
\begin{CodeListing}
add_latex_document(MyDoc.tex
BIBFILES MyDoc.bib
USE_BIBLATEX
)
\end{CodeListing}
%-----------------------------------------------------------------------------
\section{Advanced Configurations}
@ -522,7 +602,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
target tex file. Build dependencies to these files is also established.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
INPUTS Chapter1.tex Chapter2.tex Chapter3.tex Chapter4.tex
BIBFILES MyDoc.bib
IMAGE_DIRS images
@ -545,7 +625,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
\textcmake{CONFIGURE} argument to \ald.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
INPUTS Chapter1.tex Chapter2.tex Chapter3.tex Chapter4.tex
CONFIGURE MyDoc.tex
BIBFILES MyDoc.bib
@ -565,7 +645,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
\textcmake{INPUTS} argument.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
INPUTS Ch1Config.tex Ch1.tex Ch2Config.tex
Ch2.tex Ch3Config Ch3.tex
CONFIGURE Ch1Config.tex Ch2Config.tex Ch3Config.tex
@ -591,35 +671,64 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
The most common use for \UseLATEX is to build a single document, such as
a paper you are working on. However, some use cases involve building
several documents at one time. To do this, you must call \ald multiple
times. However, if you do this, the dvi, pdf, etc. targets will be
generated multiple times, and that is illegal in CMake. To get around
this, you need to mangle the names of the targets that \ald creates. To
do this, use the \textcmake{MANGLE\_TARGET\_NAMES} option.
several documents at one time.
Multiple \latex documents in the same CMake project can be created by
simply calling \ald multiple times. Each call to \ald will create its own
set of unique targets that will be added as dependencies of
\textmaketarget{dvi}, \textmaketarget{pdf}, \textmaketarget{ps},
\textmaketarget{safepdf} and \textmaketarget{html}.
Consider the following code.
\begin{CodeListing}
ADD_LATEX_DOCUMENT(MyDoc1.tex MANGLE_TARGET_NAMES)
ADD_LATEX_DOCUMENT(MyDoc2.tex MANGLE_TARGET_NAMES)
add_latex_document(MyDoc1.tex)
add_latex_document(MyDoc2.tex)
\end{CodeListing}
In the example above, the first call to \ald will create targets named
\textmaketarget{MyDoc1\_dvi}, \textmaketarget{MyDoc1\_pdf},
\textmaketarget{MyDoc1\_ps}, etc. whereas the second call will create
targets named \textmaketarget{MyDoc2\_*}.
targets named \textmaketarget{MyDoc2\_*}. Calling \textmaketarget{dvi},
\textmaketarget{pdf}, etc. will execute the respective targets for the
two documents.
If you still want the simple, short targets to build all of the
documents, you can add them yourself with custom targets that depend on
the targets created by \ald
The \textcmake{EXCLUDE\_FROM\_DEFAULTS} option suppresses these links to the
document's targets.
\begin{CodeListing}
ADD_CUSTOM_TARGET(dvi)
ADD_DEPENDENCIES(MyDoc1_dvi MyDoc2_dvi)
ADD_CUSTOM_TARGET(pdf)
ADD_DEPENDENCIES(MyDoc1_pdf MyDoc2_pdf)
ADD_CUSTOM_TARGET(ps)
ADD_DEPENDENCIES(MyDoc1_ps MyDoc2_ps)
add_latex_document(MyDoc1.tex)
add_latex_document(MyDoc2.tex)
add_latex_document(MyDoc3.tex EXCLUDE_FROM_DEFAULTS)
\end{CodeListing}
In this augmented example, MyDoc1 and MyDoc2 are built when targets such
as \textmaketarget{dvi} and \textmaketarget{pdf} are called, but MyDoc3
is not. Note, however, that in this example MyDoc3 is still built as part
of the \textmaketarget{all} target that CMake sets as the default build
target. Use \textcmake{EXCLUDE\_FROM\_ALL} to remove a document from the
default \textmaketarget{all} build. \textcmake{EXCLUDE\_FROM\_ALL} and
\textcmake{EXCLUDE\_FROM\_DEFAULTS} can be used together or
independently.
An issue that can come up in larger builds with multiple \latex documents
is a name collision. If two subdirectories each have a \latex document
with the same \textfile{.tex} file in it, then the respective calls to
\ald will create the same target names, which CMake does not allow. One
way around this problem is to rename the files to be unique (so that \ald
will create unique target names). But a more convenient way is to use the
\textcmake{TARGET\_NAME} option to change the target names. For example,
consider the following use of \textcmake{TARGET\_NAME}.
\begin{CodeListing}
add_latex_document(doc.tex TARGET_NAME MyDoc1)
\end{CodeListing}
This will change the behavior of \ald to create targets named
\textmaketarget{MyDoc1\_dvi}, \textmaketarget{MyDoc1\_pdf},
\textmaketarget{MyDoc1\_ps}, etc. instead of \textmaketarget{doc\_dvi},
\textmaketarget{doc\_pdf}, \textmaketarget{doc\_ps}, etc.
\subsection{Identifying Dependent Files}
\label{sec:IdentifyingDependentFiles}
@ -627,23 +736,47 @@ ADD_DEPENDENCIES(MyDoc1_ps MyDoc2_ps)
creating input files. Input \latex files might be auto-generated by any
number of other mechanisms.
If this is the case, simply add the appropriate CMake commands to
generate the input files, and then add that file to the DEPENDS option of
\ald. To help you build the CMake commands to place the generated files
in the correct place, you can use the LATEX\_GET\_OUTPUT\_PATH convenience
function to get the output path.
If this is the case, simply add the appropriate CMake commands to generate the input files, and then add that file to the \textcmake{DEPENDS} option of \ald.
To help you build the CMake commands to place the generated files in the correct place, you can use the LATEX\_GET\_OUTPUT\_PATH convenience function to get the output path.
\begin{CodeListing}
LATEX_GET_OUTPUT_PATH(output_dir)
latex_get_output_path(output_dir)
ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/generated_file.tex
add_custom_command(OUTPUT ${output_dir}/generated_file.tex
COMMAND tex_file_generate_exe
ARGS ${output_dir}/generated_file.tex
)
ADD_LATEX_DOCUMENT(MyDoc.tex DEPENDS generated_file.tex)
add_latex_document(MyDoc.tex DEPENDS generated_file.tex)
\end{CodeListing}
\subsection{Adding Include Directories}
\label{sec:AddingIncludeDirectories}
It is usually best practice to collect \latex input files in a single directory with a logical set of subdirectories, which can be referenced within the \latex document using relative paths.
However, it is sometimes convenient to search for files in directories other than the build directory.
For example, let us say that we have two reports that you want to combine into a single combined report.
For any number of technical reasons, it could be desirable to place the two original reports untouched in subdirectories and have the tex file for the combine report in the main directory and including the sub-reports.
However, if those sub-reports are including files that are relative to their respective subdirectories, for example including images for figures, then \latex will produce an error because it will be looking for those files in the main directory.
We can get around this problem by using the \textcmake{INCLUDE\_DIRECTORIES} option to \ald.
Simply add the subdirectories to the \textcmake{INCLUDE\_DIRECTORIES} list and \latex will look for included files locally in those directories.
Here is an example of how that might look to include image files.
\begin{CodeListing}
add_latex_document(UberReport.tex
INPUTS report1/Report1.tex report2/Report2.tex
IMAGE_DIRS report1/images report2/images
INCLUDE_DIRECTORIES report1 report2
)
\end{CodeListing}
Note that the \textcmake{INCLUDE\_DIRECTORIES} option should be used with care.
If a file with the same name exists in multiple included directories, \latex might not pick up the file you are expecting.
(\latex will first look in the build directory, then the directories listed in \textcmake{INCLUDE\_DIRECTORIES} in the order given, and then system directories.)
Thus, in the previous example if both reports had image files with the same name, the second report will likely include images from the first report.
%-----------------------------------------------------------------------------
\section{Frequently Asked Questions}
@ -666,7 +799,7 @@ ADD_LATEX_DOCUMENT(MyDoc.tex DEPENDS generated_file.tex)
you must use the CMake from
\href{http://www.cmake.org/HTML/Download.html}{http://www.cmake.org/HTML/Download.html},
the ImageMagick port from
\href{http://www.imagemagick.org/script/index.php}{http://www.imagemagick.org/script/index.php},
\href{http://www.imagemagick.org/script/binary-releases.php#windows}{http://www.imagemagick.org/script/binary-releases.php\#windows},
and a native build tool like MSVC or the GNU make port at
\href{http://unxutils.sourceforge.net/}{http://unxutils.sourceforge.net/}.
\emph{Do not use the ``native'' CMake program with any cygwin programs or
@ -711,6 +844,15 @@ ADD_LATEX_DOCUMENT(MyDoc.tex DEPENDS generated_file.tex)
variable to the \textprog{xelatex} program and build the
\textmaketarget{pdf} target.
\subsection{How do I process with \lualatex?}
\label{sec:How_do_I_process_with_LuaLaTeX}
\UseLATEX was not designed with \lualatex in mind, but the
interface of that program is similar enough to \latex that you should be
able to use it. Simply change the \textcmakevar{PDFLATEX\_COMPILER} CMake
variable to the \textprog{lualatex} program and build the
\textmaketarget{pdf} target.
\subsection{Why does \UseLATEX have to copy my tex files?}
\label{sec:Why_does_UseLATEX_have_to_copy_my_tex_files}
@ -778,10 +920,9 @@ CMake Error at UseLATEX.cmake:377 (MESSAGE):
version of ImageMagick (as specified in
Section~\ref{sec:How_do_I_process_latex_files_on_Windows}), there are several
other problems that users can run into the created build files attempt to
run the \textprog{convert} program.
run the \textprog{magick} or \textprog{convert} program.
A common error is that \textprog{convert} not finding a file that
is clearly there.
A common error is that \textprog{magick} or \textprog{convert} not finding a file that is clearly there.
\begin{CodeListing}
convert: unable to open image `filename'
@ -813,17 +954,14 @@ convert.exe: unable to open image `C:': Permission denied.
Invalid Parameter - filename
\end{CodeListing}
This is probably because CMake has found the wrong \textprog{convert}
program. Windows is installed with a program named \textprog{convert} in
\textfile{\%SYSTEMROOT\%$\backslash$system32}. This \textprog{convert}
program is used to change the filesystem type on a hard drive. Since the
windows \textfile{convert} is in a system binary directory, it is usually
found in the path before the installed ImageMagick \textfile{convert}
program. (Don't get me started about the logic behind this.) Make sure
that the \textcmakevar{IMAGEMAGICK\_CONVERT} CMake variable is pointing
to the correct \textprog{convert} program. Recent versions of \UseLATEX
should give a specific warning about this with instructions on how to fix
it.
This is probably because CMake has found the wrong \textprog{convert} program.
Windows is installed with a program named \textprog{convert} in \textfile{\%SYSTEMROOT\%$\backslash$system32}.
This \textprog{convert} program is used to change the filesystem type on a hard drive.
Since the windows \textfile{convert} is in a system binary directory, it is usually found in the path before the installed ImageMagick \textfile{convert} program.
(Don't get me started about the logic behind this.)
Make sure that the \textcmakevar{IMAGEMAGICK\_CONVERT} CMake variable is pointing to the correct \textprog{convert} program.
Or better yet, make sure you have ImageMagick 7.0 or higher and use the \textprog{magick} program instead of \textprog{convert}.
Recent versions of \UseLATEX should give a specific warning about this with instructions on how to fix it.
\subsection{How do I automate plot generation with command line programs?}
\label{How_do_I_automate_plot_generation_with_command_line_programs}
@ -854,33 +992,33 @@ Invalid Parameter - filename
\begin{CodeListing}
# Set GRI executable
SET(GRI_COMPILE "/usr/bin/gri")
set(GRI_COMPILE "/usr/bin/gri")
# Set the location of data files
SET(DATA_DIR data)
set(DATA_DIR data)
# Set the location of the directory for image files
SET(IMAGE_DIR graphics)
set(IMAGE_DIR graphics)
# Get a list of gri files
FILE(GLOB_RECURSE GRI_FILES "*.gri")
file(GLOB_RECURSE GRI_FILES "*.gri")
FOREACH(file ${GRI_FILES})
GET_FILENAME_COMPONENT(basename "${file}" NAME_WE)
foreach(file ${GRI_FILES})
get_filename_component(basename "${file}" NAME_WE)
# Replace stings in gri file so data files can be found
FILE(READ
file(READ
${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${basename}.gri
file_contents
)
STRING(REPLACE "${DATA_DIR}" "${IMAGE_DIR}/${DATA_DIR}"
string(REPLACE "${DATA_DIR}" "${IMAGE_DIR}/${DATA_DIR}"
changed_file_contents ${file_contents}
)
FILE(WRITE
file(WRITE
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.gri
${changed_file_contents}
)
# Command to run gri
IF(GRI_COMPILE)
ADD_CUSTOM_COMMAND(
if(GRI_COMPILE)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
DEPENDS
@ -893,15 +1031,15 @@ FOREACH(file ${GRI_FILES})
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.gri
)
ENDIF(GRI_COMPILE)
endif()
# Make a list of all gri files (for ADD_LATEX_DOCUMENT depend)
SET(ALL_GRI_FILES ${ALL_GRI_FILES}
set(ALL_GRI_FILES ${ALL_GRI_FILES}
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${basename}.eps
)
ENDFOREACH(file)
endforeach(file)
# Copy over all data files needed to generate gri graphs
ADD_CUSTOM_COMMAND(
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${IMAGE_DIR}/${DATA_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory
@ -909,7 +1047,7 @@ ADD_CUSTOM_COMMAND(
${CMAKE_CURRENT_BINARY_DIR}/${IMAGE_DIR}/${DATA_DIR}
)
ADD_LATEX_DOCUMENT(MyDoc.tex
add_latex_document(MyDoc.tex
IMAGE_DIRS ${IMAGE_DIR}
DEPENDS ${ALL_GRI_FILES}
)
@ -949,11 +1087,11 @@ ADD_LATEX_DOCUMENT(MyDoc.tex
\textfile{CMakeLists.txt} file. For example:
\begin{CodeListing}
SET(LATEX_COMPILER_FLAGS
set(LATEX_COMPILER_FLAGS
"-interaction=nonstopmode --enable-write18"
CACHE STRING "Flags passed to latex."
)
INCLUDE(UseLATEX.cmake)
include(UseLATEX.cmake)
\end{CodeListing}
The disadvantage of this latter approach is the reduction of portability.
@ -970,8 +1108,8 @@ INCLUDE(UseLATEX.cmake)
\begin{CodeListing}
Some LaTeX distributions have problems with image file names
with multiple extensions. Consider changing my.image.pdf to
something like my-image.pdf.
with multiple extensions or spaces. Consider changing
my.image.pdf to something like my-image.pdf.
\end{CodeListing}
This is because, just as the warning reports, some versions of \latex
@ -1002,6 +1140,151 @@ something like my-image.pdf.
distributions or build on other computers. Your best course of action is
to simply heed the warning and rename your files.
\subsection{Why are there no \textcmake{FORCE\_PS} or \textcmake{FORCE\_SAFEPDF} options?}
\label{sec:Why_are_there_no_FORCE_PS_or_FORCE_SAFEPDF_options}
Because you should just use the \textcmake{FORCE\_DVI} option instead.
Both the \textmaketarget{ps} and \textmaketarget{safepdf} targets are
built by first creating a \textfile{.dvi} file using the standard
\textprog{latex} program. The \textfile{.dvi} file is then converted to
\textfile{.ps} and subsequently to a \textfile{.pdf} file. Thus, you can
just enable the \textcmake{FORCE\_DVI} option to force \UseLATEX on this
build path.
The force options are really disabling compile paths that do not work for
your document. For example, \textprog{pdflatex} does not support all
postscript packages, so that program can fail for some documents. The
\textcmake{FORCE\_DVI} ensures that the document can only be built in
ways that support the postscript features.
\subsection{Why is my image file not being automatically converted?}
\label{sec:Why_is_my_image_file_not_being_automatically_converted}
\UseLATEX has the ability to find image files and automatically convert
them to a format \latex understands. Usually this conversion happens with
the ImageMagick \textprog{magick} program.
Users occasionally report that image formats that should be supported
because ImageMagick can convert them are ignored by \UseLATEX. This can
happen even when the \textcmake{IMAGE\_DIRS} option points to the
directory containing the image files.
The problem here is that \UseLATEX only considers files in
\textcmake{IMAGE\_DIRS} directories that it identifies as a bona fide
image. This prevents \UseLATEX from picking up another type of file, such
as a README text file, and erroneously trying to do image conversion on
it.
\UseLATEX checks for image files by looking for a known set of image
extensions. This extension list is maintained separately from
ImageMagick's extension list and is generally a small subset of all the
potential formats ImageMagick supports. Consequently, it is possible for
\UseLATEX to ignore an image file that could be converted.
You can work around this problem by specifying images independently with
the \textcmake{IMAGES} option. \UseLATEX will assume any image specified
under the \textcmake{IMAGES} option is in fact an image that can be
converted with ImageMagick regardless of the extension. See
Section~\ref{sec:IncoporatingImages} for more details.
If there is a file extension that you think should be added to the list
of image extensions to check, send a note to the \UseLATEX maintainers.
\subsection{Why is the \textcmake{MANGLE\_TARGET\_NAMES} option deprecated?}
\label{sec:Why_is_the_MANGLE_TARGET_NAMES_option_deprecated}
The original concept for \UseLATEX was part of a build system for a
single document. As such, \ald created generically named targets (like
\textmaketarget{dvi} and \textmaketarget{pdf}). This became problematic
when \UseLATEX was used in larger projects that built multiple targets.
The multiple documents would each try to create their own
\textmaketarget{dvi}, \textmaketarget{pdf}, etc. targets, and this would
create CMake errors when they conflicted with each other.
To solve this problem, in 2006 the \textcmake{MANGLE\_TARGET\_NAMES} was
added to \ald. When this option was given, \ald would create ``mangled''
targets that are unique to the name of the document so that they would
not conflict with each other.
This option solved the problem for projects building multiple documents,
but a couple of undesirable elements were later discovered. The first was
that \latex documents built with the \textcmake{MANGLE\_TARGET\_NAMES}
option were never built by default. To build the document, the user had
to specifically request the target, which had an unwieldy name, to be
built or to explicitly set up dependencies to those targets. The second
and more serious issue was that if a project incorporated one or more
sub-projects (not uncommon) and more than one of these projects used
\UseLATEX, you were likely to get conflicting targets again.
Consequently, in 2015 a change was made to \ald to mangle all targets.
The \UseLATEX package establishes a single set of default target names
(\textmaketarget{dvi}, \textmaketarget{pdf}, etc.), and \ald sets up
dependencies from these default targets to the mangled target names.
Thus, when \UseLATEX is used for a single document, the same simple
targets work fine. When multiple documents are added, the default targets
are automatically set up for all documents without conflicts. See
Section~\ref{sec:BuldingMultipleLatexDocuments} for more details on
building multiple \latex documents in a project.
So, \textcmake{MANGLE\_TARGET\_NAMES} is deprecated because it is
redundant. All targets are mangled. The only difference is that \ald
establishes dependencies to the default target names. If these dependency
targets are not desired, use the \textcmake{EXCLUDE\_FROM\_DEFAULTS}
option. (Once again, see Section~\ref{sec:BuldingMultipleLatexDocuments}
for more details.)
\subsection{What is the point of the default \latex arguments?}
\label{sec:What_is_the_point_of_the_default_latex_arguments}
The \latex commands (e.g. \textprog{latex} and \textprog{pdflatex}) were originally designed to be run interactively.
The \textfile{tex} file is fed to the interpreter and verbose responses are generated.
When an error is encountered, \latex stops and provides a prompt to type commands to resolve the problem.
This interactive mode of building a \latex file is problematic when attempting to automate it in a batch or build system.
Thus, the \textcmakevar{LATEX\_COMPILER\_FLAGS} and \textcmakevar{PDFLATEX\_COMPILER\_FLAGS}, which contain the command line flags passed to the \latex program, are initialized to modify the behavior to work better in a build system.
The first flag added is \mbox{\textcmake{-interaction=batchmode}}.
This flag does two major things.
The first thing this flag does is hide most of the \latex output.
A typical \latex build contains extremely verbose status messages that provide all sorts of useless information.
Any important information (like a syntax error) is easily lost.
Instead, you have to consult the \textfile{.log} file to see the full output.
Because important warnings can be hidden along with the unimportant, \UseLATEX performs several greps of the log file after the build to look for the most important warnings encountered with \latex.
The second thing the \mbox{\textcmake{-interaction=batchmode}} flag does is to change the behavior of \latex when an error occurs.
Rather than enter an interactive prompt, the \latex program simply quits.
This is how pretty much every build system expects a compiler to behave.
The second flag added is \mbox{\textcmake{-file-line-error}}.
For some odd reason the default behavior of \latex is to simply print out a message and leave it you to trace the location of the error.
Instead, this flag instructs \latex to prepend the filename and line number to every error to simplify finding the error.
\subsection{Why do the \textprog{ps2pdf} arguments have the \textcmake{\#} character in them?}
\label{sec:Why_do_the_ps2pdf_arguments_have_the_hash_character_in_them}
When calling the \textprog{ps2pdf} program, it is typical to use several arguments that are passed to the underlying ghostscript system.
These arguments often take the form of an option followed by an equal (\textcmake{=}) character and then the value for that option.
For example, arguments like \mbox{\textcmake{-dCompatibilityLevel=1.3}}, \mbox{\textcmake{-dEmbedAllFonts=true}}, and \mbox{\textcmake{-dColorImageFilter=/FlateEncode}} are common.
This is a standard convention for command line arguments in systems using Unix-like shells.
In truth, the \textprog{ps2pdf} program and its variants are actually shell scripts that provide a simplified interface for calling the \textprog{gs} ghostscript program.
On Unix-like systems they are naturally enough implemented as shell scripts.
However, the standard Windows port instead uses \textprog{bat} scripts, which are native to that system.
Unfortunately, the interpreter for \textprog{bat} scripts treats the \textcmake{=} character as special.
Ultimately it will split the arguments on the \textcmake{=} character, and that will lead to strange errors from \textprog{ps2pdf}.
For example, on Windows the \mbox{\textcmake{-dCompatibilityLevel=1.3}} argument will be split into the arguments \mbox{\textcmake{-dCompatibilityLevel}} and \mbox{\textcmake{1.3}}.
\textprog{ps2pdf} will think \mbox{\textcmake{1.3}} is referring to the input file name and give an obtuse error about the file not being found.
The workaround is that \textprog{gs} (and therefore all its derived scripts like \textprog{ps2pdf}) support using the \textcmake{\#} character in lieu of \textcmake{=}.
Thus, on Windows machines, \UseLATEX defaults to an alternate set of arguments for \textprog{ps2pdf} that use \textcmake{\#} in them.
An issue you might encounter is that the \textcmake{\#} character is also frequently treated as special by script and build interpreter.
It is most often used to define a comment.
For this reason the \textcmake{\#} variant is only used on Windows where it is most likely to be needed.
The build systems I have tried seem pretty resilient to using \textcmake{\#} in commands.
If you have issues running \textprog{ps2pdf} with either character, you can attempt to resolve the problem by switching back and forth.
If you do notice a problem, please let us know so that we can fix it for other users.
%-----------------------------------------------------------------------------
@ -1010,22 +1293,29 @@ something like my-image.pdf.
Thanks to all of the following contributors.
\begin{description}
\item[Matthias Bach] Instructions for using \lualatex.
\item[Martin Baute] Check for Windows version of convert being used
instead of ImageMagick's version.
\item[Izaak Beekman]
Help in fixing the order of arguments for \textcmakevar{LATEX\_SMALL\_IMAGES} with Imagemagick 7.0.
\item[Arnout Boelens] Example of using gri in conjunction with \latex.
\item[Mark de Wever] Fixes for interactions between the
\textprog{makeglossaries} and \bibtex commands.
\item[Eric D\"{o}nges] Support for include directories.
\item[Alin Elena] Suggestions on removing dependence on makeglossaries
command.
\item[Myles English] Support for the \textlatexpackage{nomencl} package.
\item[Tomasz Grzegurzko] Support for htlatex.
\item[\O{}ystein S. Haaland] Support for making glossaries.
\item[Sven Klomp] Help with \synctex support.
\item[Nikos Koukis]
Suggestions for default \textprog{latex} options.
\item[Thimo Langbehn] Support for pstricks with the
\textcmake{--enable-write18} option.
\item[Antonio LaTorre] Support for the \textlatexpackage{multibib}
package.
\item[Edwin van Leeuwen] Fix for a bug when copying \bibtex files.
\item[Dan Lipsa] Support for the \textlatexpackage{multind} package.
\item[Lukasz Lis] Workaround for problem with ImageMagick dropping the
BoundingBox of eps files by using the \textprog{ps2pdf} program
instead.
@ -1035,6 +1325,8 @@ something like my-image.pdf.
\item[Jorge Gerardo Pe\~{n}a Pastor] Support for SVG files.
\item[Julien Schueller] Check for existence of Imagemagick convert only
when used.
\item[David Tracey] Support for using \textprog{biber} command with the
\textcmake{USE\_BIBLATEX} option.
\item[Raymod Wan] \textcmake{DEFAULT\_SAFEPDF} option.
\end{description}

183
scripts/release-version.sh Executable file
View file

@ -0,0 +1,183 @@
#!/bin/bash
#
# Checks to make sure that the version number is consistent across all
# files, then issues the git commands to tag the version.
# A simple function to ask the user if they want to continue.
function ask_keep_going {
read -ep "Are you sure you want to continue? [y/N] " keep_going
if [ "$keep_going" != "y" -a "$keep_going" != "Y" ]
then
echo "Aborting"
exit 1
fi
echo
}
# Run in repo base directory
cd `dirname $0`/..
echo "Fetching origin..."
git fetch origin
echo
# Extract the version number from UseLATEX.cmake
version_line=`head -n 3 UseLATEX.cmake | tail -n 1`
version=`echo $version_line | sed -n 's/# Version: \([0-9]*\.[0-9]*\.[0-9]*\)/\1/p'`
if [ -z $version ]
then
echo "Could not extract version number from UseLATEX.cmake."
echo "The third line should be of the form '# Version: X.X.X'."
exit 1
fi
echo "Found version $version in UseLATEX.cmake"
echo
echo -n "Checking for $version in UseLATEX.tex..."
if fgrep -q '\newcommand{\UseLATEXVersion}{'$version'}' UseLATEX.tex
then
echo "OK"
else
echo "FAIL"
echo
echo "Could not find $version in UseLATEX.tex."
echo "There should be a line in UseLATEX.tex like the following:"
echo ' \newcommand{\UseLATEXVersion}{'$version'}'
echo "Add it."
exit 1
fi
echo -n "Checking for $version in UseLATEX.pdf..."
if pdftotext UseLATEX.pdf - | grep -q 'Version *'$version
then
echo "OK"
else
echo "FAIL"
echo
echo "Could not find $version in UseLATEX.pdf (using pdftotext)."
echo "Rebuild the pdf documentation and copy it to the working repo."
exit 1
fi
git_version_tag="Version$version"
echo -n "Checking for git tag $git_version_tag..."
if git rev-list $git_version_tag.. > /dev/null 2>&1
then
echo "FAIL"
echo
echo "Version tag $git_version_tag already exists in git repository."
echo "Either change the version in UseLATEX.cmake or remove the version"
echo "tag (with 'git tag -d $git_version_tag')."
exit 1
else
echo "OK"
fi
echo -n "Checking for tabs in UseLATEX.cmake..."
if fgrep -q "$(printf '\t')" UseLATEX.cmake
then
echo "FAIL"
echo
echo "Tab characters were found in UseLATEX.cmake. For consistent style"
echo "replace all tab characters with spaces to the desired column."
exit 1
else
echo "OK"
fi
echo -n "Extracting notes for $version..."
version_notes=`sed -n "/# $version/,/# [0-9]/{
s/^# $version *//
/^# [0-9]/d
s/^# *//
p
}" UseLATEX.cmake`
if [ \( $? -eq 0 \) -a \( -n "$version_notes" \) ]
then
echo "OK"
else
echo "FAIL"
echo
echo "Could not find the notes for this release in the History list."
echo "Make sure an item has been added to the release history."
ask_keep_going
fi
version_notes="
$version_notes"
echo -n "Checking that the working directory is clean..."
if [ -z "`git status --porcelain`" ]
then
echo "OK"
else
echo "FAIL"
echo
echo "There are uncommitted changes to your repository. Make sure that the"
echo "working directory is clean before running this script."
exit 1
fi
echo -n "Checking that we are on the master branch..."
if [ "`git rev-parse --abbrev-ref HEAD`" = "master" ]
then
echo "OK"
else
echo "FAIL"
echo
echo "Not currently on the master branch."
ask_keep_going
fi
echo -n "Checking that we are up to date on master..."
if git merge-base --is-ancestor origin/master HEAD
then
echo "OK"
else
echo "FAIL"
echo
echo "The local repository does not have the latest version from the"
echo "central repository. This is OK if you are retroactively tagging"
echo "a version but might be in error if you are tagging new changes."
ask_keep_going
fi
echo -n "Checking that master is up to date on origin..."
if git merge-base --is-ancestor HEAD origin/master
then
echo "OK"
else
echo "FAIL"
echo
echo "Your latest changes do not appear to be in the central repository."
echo "It is recommended to update the remote repository before tagging"
echo "a version."
ask_keep_going
fi
# We are finished with all the checks. Do the tag.
echo -n "Tagging with $git_version_tag..."
if git tag --annotate --edit --message="UseLATEX.cmake Release $version
$version_notes
# Write a message for tag:
# $git_version_tag
# Lines starting with '#' will be ignored.
" $git_version_tag
then
echo "OK"
else
echo "FAIL"
echo
echo "Could not tag repository for some reason."
exit 1
fi
echo
echo "Finished tagging to version $version."
echo "To push the tags to the remote repository, execute"
echo
echo " git push --tags"
echo

View file

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.4)
project(Bibliography NONE)
include(../../UseLATEX.cmake)
add_latex_document(DocWithBib.tex
BIBFILES References.bib
)
add_latex_document(DocWithBibLatex.tex
BIBFILES References.bib
USE_BIBLATEX
)

View file

@ -0,0 +1,10 @@
\documentclass{article}
\begin{document}
This document tests citations such as these \cite{Moreland2008}.
\bibliographystyle{plain}
\bibliography{References}
\end{document}

View file

@ -0,0 +1,14 @@
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{References.bib}
\begin{document}
This document tests citations through the biblatex package such as these
\cite{Moreland2008}.
\printbibliography
\end{document}

View file

@ -0,0 +1,4 @@
This test exercises the ability to build documents with bibliographies
built from bib files. There are two documents. The first builds the
bibliography with the typical bibtex program. The second uses the
biblatex package and builds the bibliography with biber.

View file

@ -0,0 +1,7 @@
@techreport{Moreland2008,
Author = {Kenneth Moreland},
Title = {{UseLATEX.cmake}: {\LaTeX} Document Building Made Easy},
Institution = {Sandia National Laboratories},
Number = {SAND 2008-2743P},
Year = {2008}
}

View file

@ -1,11 +1,10 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.4)
project(DefaultTargets NONE)
include(../../UseLATEX.cmake)
add_latex_document(DefaultDvi.tex MANGLE_TARGET_NAMES)
add_latex_document(DefaultPdf.tex DEFAULT_PDF MANGLE_TARGET_NAMES)
add_latex_document(DefaultSafePdf.tex DEFAULT_SAFEPDF MANGLE_TARGET_NAMES)
add_latex_document(DefaultPs.tex DEFAULT_PS MANGLE_TARGET_NAMES)
add_latex_document(NoDefault.tex NO_DEFAULT MANGLE_TARGET_NAMES)
add_latex_document(DefaultDvi.tex IMAGE_DIRS images FORCE_DVI)
add_latex_document(DefaultPdf.tex IMAGE_DIRS images FORCE_PDF)
add_latex_document(DefaultHtml.tex IMAGE_DIRS images FORCE_HTML)
add_latex_document(NoDefault.tex IMAGE_DIRS images EXCLUDE_FROM_ALL)

View file

@ -1,9 +1,15 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\Large
\noindent
This document builds \textbf{\Huge dvi} by default.
\includegraphics[width=2in]{images/Circles_pdf}
\includegraphics[width=2in]{images/Circles_eps}
\includegraphics[width=2in]{images/Cool2WarmBar}
\end{document}

View file

@ -0,0 +1,15 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\Large
\noindent
This document builds \textbf{\Huge html} by default.
\includegraphics[width=2in]{images/Circles_pdf}
\includegraphics[width=2in]{images/Circles_eps}
\includegraphics[width=2in]{images/Cool2WarmBar}
\end{document}

View file

@ -1,9 +1,15 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\Large
\noindent
This document builds \textbf{\Huge pdf} by default.
\includegraphics[width=2in]{images/Circles_pdf}
\includegraphics[width=2in]{images/Circles_eps}
\includegraphics[width=2in]{images/Cool2WarmBar}
\end{document}

View file

@ -1,9 +0,0 @@
\documentclass{article}
\begin{document}
\Large
\noindent
This document builds \textbf{\Huge ps} by default.
\end{document}

View file

@ -1,9 +0,0 @@
\documentclass{article}
\begin{document}
\Large
\noindent
This document builds \textbf{\Huge pdf through ps} by default.
\end{document}

View file

@ -1,9 +1,15 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\Large
\noindent
This document should \emph{\Huge not} be built by default.
\includegraphics[width=2in]{images/Circles_pdf}
\includegraphics[width=2in]{images/Circles_eps}
\includegraphics[width=2in]{images/Cool2WarmBar}
\end{document}

View file

@ -1,19 +1,18 @@
This test checks to make sure that the appropriate targets are being made
by default. It specifically checks the DEFAULT_* and NO_DEFAULT options as
well as appropriate behavior when none of these are used.
by default for LaTeX documents with forced builds.
The following documents exist and the default targets (made with no
arguments to make) should create the following files (in addition to the
standard auxileary files).
standard auxileary files). This is assuming LATEX_DEFAULT_BUILD is not set
to Ps or SafePdf.
NoDefault.tex: -nothing-
DefaultDvi.tex: DefaultDvi.dvi
DefaultPdf.tex: DefaultPdf.pdf
DefaultSafePdf.tex: DefaultSafePDF.pdf, DefaultSafePdf.ps, DefaultSafePdf.dvi
DefaultPs.tex: DefaultPs.ps, DefaultPs.dvi
DefaultHtml.tex: DefaultHtml.html DefaultHtml.dvi
Looking at the transpose, here are the files expected per extention.
*.dvi: DefaultDvi.dvi, DefaultSafePDF.dvi, DefaultPs.dvi
*.pdf: DefaultPdf.pdf, DefaultSafePDF.pdf
*.ps: DefaultPs.ps, DefaultSafePDF.ps
*.dvi: DefaultDvi.dvi DefaultHtml.dvi
*.pdf: DefaultPdf.pdf
*.html: DefaultHtml.html

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 2.8.4)
project(FileNameSpaces NONE)
include(../../UseLATEX.cmake)
add_latex_document("My Document.tex"
)

View file

@ -0,0 +1,9 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
This is some text.
\end{document}

View file

@ -0,0 +1,4 @@
This test checks to make sure there are no problems with compiling a LaTeX
file in a directory with spaces in the name or a file with spaces in the
name. LaTeX itself is pretty intolerant about including files with spaces
in the name, but our CMake code should not be.

View file

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.8.4)
project(FindWarnings NONE)
include(../../UseLATEX.cmake)
add_latex_document(UndefinedReference.tex)
add_latex_document(UndefinedReferenceLong.tex)
add_latex_document(Natbib.tex)
add_latex_document(Overfull.tex)
add_latex_document(DuplicateLabel.tex)

View file

@ -0,0 +1,9 @@
\documentclass{article}
\begin{document}
Define the label once. \label{DefinedTwice}
Define the label again. \label{DefinedTwice}
\end{document}

View file

@ -0,0 +1,9 @@
\documentclass{article}
\usepackage{natbib}
\begin{document}
This is an undefined citation: \cite{NoSuchCite}.
\end{document}

View file

@ -0,0 +1,7 @@
\documentclass{article}
\begin{document}
This is an overfull box: \framebox[14in]{Box too big.}
\end{document}

View file

@ -0,0 +1,4 @@
This test exercises the ability for UseLATEX.cmake to make sure that
important warnings from LaTeX are printed (whereas unimportant are
suppressed). Each of the documents should compile successfully, but they
all have a warning that should be reported clearly in the build.

View file

@ -0,0 +1,7 @@
\documentclass{article}
\begin{document}
This is an undefined reference: \ref{sec:DoesNotExist}.
\end{document}

View file

@ -0,0 +1,7 @@
\documentclass{article}
\begin{document}
This is an undefined reference: \ref{sec:AVeryLongReferenceNameThatCausesTheWarningLineToBreakAcrossLines}.
\end{document}

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.4)
project(ImageTypes NONE)

View file

@ -4,14 +4,26 @@
\begin{document}
\fbox{\includegraphics[width=2in]{images/Circles}}
\fbox{\includegraphics[width=2in]{images/Circles_svg}}
SVG
\fbox{\includegraphics[width=2in]{images/Circles_pdf}}
PDF
\fbox{\includegraphics[width=2in]{images/Circles_eps}}
EPS
\fbox{\includegraphics[width=2in]{images/RainbowBar}}
TIFF
\fbox{\includegraphics[width=2in]{images/Cool2WarmBar}}
GIF
\fbox{\includegraphics[width=2in]{images/Blue2TanBar}}
BMP
\fbox{\includegraphics[width=2in]{images/Green2RedDivBar}}
PPM
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

Before After
Before After

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 2.8.4)
project(IncludeDirectory NONE)
include(../../UseLATEX.cmake)
set(UseLATEX_TEST_NAME "adding include directories")
add_latex_document(IncludeStuff.tex
INPUTS CopiedInput.tex copied-subdir/CopiedInSubdir.tex
INCLUDE_DIRECTORIES
copied-subdir
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/uncopied-subdir
CONFIGURE IncludeStuff.tex CopiedInput.tex copied-subdir/CopiedInSubdir.tex
)

View file

@ -0,0 +1,4 @@
% -*- latex -*-
% This should only compile if working with the "copied" version of the latex file.
This is a copied input for @UseLATEX_TEST_NAME@.

View file

@ -0,0 +1,22 @@
% -*- latex -*-
\documentclass{article}
\begin{document}
% Make a line that will get a parse error if this file is not configured. This makes sure that the configured file is read first.
Running tests for @UseLATEX_TEST_NAME@.
Included from CopiedInput:
\input{CopiedInput}
Included from copied-subdir/CopiedInSubdir:
\input{CopiedInSubdir}
Included from source dir:
\input{UncopiedInput}
Included from source subdirectory:
\input{UncopiedInSubdir}
\end{document}

View file

@ -0,0 +1,3 @@
This test makes sure that the INCLUDE_DIRECTORIES option works correctly.
It tests to make sure that it works against directories that are copied to
the build directory and those that remain in the source directory.

View file

@ -0,0 +1,3 @@
% -*- latex -*-
This comes from a file in the source directory.

View file

@ -0,0 +1,4 @@
% -*- latex -*-
% This should only compile if working with the "copied" version of the latex file.
This is a copied input for @UseLATEX_TEST_NAME@.

View file

@ -0,0 +1,3 @@
% -*- latex -*-
This comes from a file in a source subdirectory.

View file

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 2.8.4)
project(MultiDocuments NONE)
add_subdirectory(subdir1)
add_subdirectory(subdir2)
add_subdirectory(subdir2_2)

View file

@ -0,0 +1,10 @@
This tests appropriate behavior when a project (or multi-project) tries to
create multiple documents with multiple add_latex_document calls. It also
creates them in separate subdirectories, with each subdirectory
independently loading UseLATEX.cmake. This is typical in a large project
that might bring in several subprojects.
When running this project, 3 documents should be built, one in each
subdirectory. You should not get errors or warnings about a target being
defined multiple times. You should be able to build using the pdf, dvi, ps,
and safepdf targets.

View file

@ -0,0 +1,6 @@
include(../../../UseLATEX.cmake)
add_latex_document(Subdirectory1.tex
IMAGE_DIRS images
INPUTS IncludedFile.tex
)

View file

@ -0,0 +1 @@
This text comes from an included file.

View file

@ -0,0 +1,15 @@
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\textbf{Document from subdirectory 1}
Here is an image:
\fbox{\includegraphics[width=2in]{images/Cool2WarmBar}}
This included file should show up on the next page.
\include{IncludedFile}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,3 @@
include(../../../UseLATEX.cmake)
add_latex_document(Subdirectory2.tex)

View file

@ -0,0 +1,7 @@
\documentclass{article}
\begin{document}
\textbf{Document from subdirectory 2}
\end{document}

View file

@ -0,0 +1,5 @@
include(../../../UseLATEX.cmake)
add_latex_document(Subdirectory2.tex
TARGET_NAME RenamedTargetForSubdirectory2_2
)

View file

@ -0,0 +1,7 @@
\documentclass{article}
\begin{document}
\textbf{Document from subdirectory 2\_2}
\end{document}

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.4)
project(MultiDotFilename NONE)

View file

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.4)
project(MultiIndex NONE)
include(../../UseLATEX.cmake)
add_latex_document(SingleIndex.tex
USE_INDEX
)
add_latex_document(MultiIndex.tex
USE_INDEX
INDEX_NAMES terms people
)

View file

@ -0,0 +1,25 @@
\documentclass{article}
\usepackage{blindtext}
\usepackage{multind}
\makeindex{terms}
\makeindex{people}
\begin{document}
\index{terms}{foo}
\index{terms}{bar}
\index{terms}{baz}
\index{people}{Homer}
\index{people}{Marge}
\index{people}{Bart}
\index{people}{Lisa}
\index{people}{Maggie}
\blindtext
\printindex{terms}{Term Index}
\printindex{people}{People Index}
\end{document}

4
tests/MultiIndex/README Normal file
View file

@ -0,0 +1,4 @@
This test exercises the building of files that use multiple indices with
the multind package. For completeness, making a single index with the
makeindex package is also tested. If both documents builds, then the test
passes.

View file

@ -0,0 +1,18 @@
\documentclass{article}
\usepackage{blindtext}
\usepackage{makeidx}
\makeindex
\begin{document}
\index{foo}
\index{bar}
\index{baz}
\blindtext
\printindex
\end{document}

View file

@ -0,0 +1,65 @@
% indexes document style option for producing multiple indexes
% for use with the modified bbok style, CHbook.sty
% Written by F.W. Long, Version 1.1, 12 August 1991.
% Modified by F.W. Long, Version 1.1a, 29 August 1991
% to get the index heading correctly spaced.
% Modified by F.W. Long, Version 1.1b, 31 August 1991
% to remove the abbreviation \ix (which should be in the document, not here).
% Modified \makeindex and \index commands to allow multiple indexes
% in both cases the first parameter is the index name.
% They now work more like \@starttoc and \addcontentsline.
% \index is no longer defined inside \makeindex but determines
% whether the appropriate file is defined before writing to it.
\def\makeindex#1{\begingroup
\makeatletter
\if@filesw \expandafter\newwrite\csname #1@idxfile\endcsname
\expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
\typeout{Writing index file #1.idx }\fi \endgroup}
\def\index#1{\@bsphack\begingroup
\def\protect##1{\string##1\space}\@sanitize
\@wrindex{#1}}
% \@wrindex now checks that the appropriate file is defined.
\def\@wrindex#1#2{\let\thepage\relax
\xdef\@gtempa{\@ifundefined{#1@idxfile}{}{\expandafter
\write\csname #1@idxfile\endcsname{\string
\indexentry{#2}{\thepage}}}}\endgroup\@gtempa
\if@nobreak \ifvmode\nobreak\fi\fi\@esphack}
% Modified \printindex command to allow multiple indexes.
% This now takes over much of the work of \theindex.
% Again, the first parameter is the index name.
% The second parameter is the index title (as printed).
\newif\if@restonecol
\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@ \columnsep 35pt
\newpage \twocolumn[{\Large\bf #2 \vskip4ex}]
\markright{\uppercase{#2}}
\addcontentsline{toc}{section}{#2}
\@input{#1.ind}}
% The following index commands are taken from book.sty.
% \theindex is modified to not start a chapter.
\def\theindex{\parindent\z@
\parskip\z@ plus .3pt\relax\let\item\@idxitem}
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}
% the command \ix allows an abbreviation for the general index
%\def\ix#1{#1\index{general}{#1}}
% define the \see command from makeidx.sty
\def\see#1#2{{\em see\/} #1}

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.4)
project(Subdirectory NONE)