Compare commits

..

No commits in common. "master" and "Version2.3.0" have entirely different histories.

36 changed files with 188 additions and 1534 deletions

34
README Normal file
View file

@ -0,0 +1,34 @@
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

View file

@ -1,42 +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](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).)

View file

@ -1,6 +1,6 @@
# File: UseLATEX.cmake
# CMAKE commands to actually use the LaTeX compiler
# Version: 2.7.0
# Version: 2.3.0
# Author: Kenneth Moreland <kmorel@sandia.gov>
#
# Copyright 2004, 2015 Sandia Corporation.
@ -42,18 +42,17 @@
# add_latex_document(<tex_file>
# [BIBFILES <bib_files>]
# [INPUTS <input_tex_files>]
# [IMAGE_DIRS <image_directories>]
# [IMAGES <image_files>]
# [CONFIGURE <tex_files>]
# [DEPENDS <tex_files>]
# [MULTIBIB_NEWCITES <suffix_list>]
# [IMAGE_DIRS] <image_directories>
# [IMAGES] <image_files>
# [CONFIGURE] <tex_files>
# [DEPENDS] <tex_files>
# [MULTIBIB_NEWCITES] <suffix_list>
# [USE_BIBLATEX]
# [USE_INDEX]
# [INDEX_NAMES <index_names>]
# [USE_GLOSSARY] [USE_NOMENCL]
# [FORCE_PDF] [FORCE_DVI] [FORCE_HTML]
# [TARGET_NAME <name>]
# [INCLUDE_DIRECTORIES <directories>]
# [TARGET_NAME] <name>
# [EXCLUDE_FROM_ALL]
# [EXCLUDE_FROM_DEFAULTS])
# Adds targets that compile <tex_file>. The latex output is placed
@ -62,15 +61,15 @@
# so all input files are copied from the source directory to the
# output directory. This includes the target tex file, any tex file
# listed with the INPUTS option, the bibliography files listed with
# the BIBFILES option, and any .cls, .bst, .clo, .sty, .ist, and .fd
# files found in the current source directory. Images found in the
# IMAGE_DIRS directories or listed by IMAGES are also copied to the
# output directory and converted to an appropriate format if necessary.
# Any tex files also listed with the CONFIGURE option are also processed
# with the CMake CONFIGURE_FILE command (with the @ONLY flag). Any file
# listed in CONFIGURE but not the target tex file or listed with INPUTS
# has no effect. DEPENDS can be used to specify generated files that are
# needed to compile the latex target.
# the BIBFILES option, and any .cls, .bst, and .clo files found in
# the current source directory. Images found in the IMAGE_DIRS
# directories or listed by IMAGES are also copied to the output
# directory and converted to an appropriate format if necessary. Any
# tex files also listed with the CONFIGURE option are also processed
# with the CMake CONFIGURE_FILE command (with the @ONLY flag). Any
# file listed in CONFIGURE but not the target tex file or listed with
# INPUTS has no effect. DEPENDS can be used to specify generated files
# that are needed to compile the latex target.
#
# The following targets are made. The name prefix is based off of the
# base name of the tex file unless TARGET_NAME is specified. If
@ -114,96 +113,8 @@
# support the extra auxiliary files created with the \newcite command
# in the multibib package.
#
# INCLUDE_DIRECTORIES provides a list of directories in which LaTeX
# should look for input files. It accepts both files relative to the
# binary directory and absolute paths.
#
# History:
#
# 2.7.0 Add INCLUDE_DIRECTORIES parameters. (Thanks to Eric Dönges.)
#
# 2.6.1 Fix issue with detecting long undefined reference warnings that
# LaTeX "helpfully" split across lines (and which fowled up our
# regex).
#
# 2.6.0 Skip image conversion targets that are not used when a force option
# is given. This helps prevent errors for missing conversion programs
# that are not needed. (Thanks to Martin Wetzel.)
#
# 2.5.0 Parse biber output for warnings.
#
# For regular bibtex, you get warnings about undefined references
# when you run latex. However, when using biber, biber itself prints
# out the said warning and latex sees nothing. Thus, when using biber
# the regular output is now suppressed and the log file is scanned
# for potential issues.
#
# 2.4.9 Use biblatex.cfg file if it exists and the USE_BIBLATEX option is ON.
#
# 2.4.8 Fix synctex issue with absolute paths not being converted.
#
# 2.4.7 Fix some issues with spaces in the path of the working directory where
# LaTeX is executed.
#
# 2.4.6 Fix parse issue with older versions of CMake.
#
# 2.4.5 Fix issues with files and paths containing spaces.
#
# 2.4.4 Improve error reporting message when LaTeX fails.
#
# When LaTeX fails, delete the output file, which is invalid.
#
# Add warnings for "missing characters." These usually mean that a
# non-ASCII character is in the document and will not be printed
# correctly.
#
# 2.4.3 Check for warnings from the natbib package. When using natbib,
# warnings for missing bibliography references look different. So
# far, natbib seems to be quiet unless something is important, so
# look for all natbib warnings. (We can change this later if
# necessary.)
#
# 2.4.2 Fix an issue where new versions of ImageMagick expect the order of
# options in command line execution of magick/convert. (See, for
# example, http://www.imagemagick.org/Usage/basics/#why.)
#
# 2.4.1 Add ability to dump LaTeX log file when using batch mode. Batch
# mode suppresses most output, often including error messages. To
# make sure critical error messages get displayed, show the full log
# on failures.
#
# 2.4.0 Remove "-r 600" from the default PDFTOPS_CONVERTER_FLAGS. The -r flag
# is available from the Poppler version of pdftops, but not the Xpdf
# version.
#
# Fix an issue with the flags for the different programs not being
# properly separated.
#
# Fix an issue on windows where the = character is not allowed for
# ps2pdf arguments.
#
# Change default arguments for latex and pdflatex commands. Makes the
# output more quiet and prints out the file/line where errors occur.
# (Thanks to Nikos Koukis.)
#
# After a LaTeX build, check the log file for warnings that are
# indicative of problems with the build.
#
# Remove support for latex2html. Instead, use the htlatex program.
# This is now part of TeX Live and most other distributions. It also
# behaves much more like the other LaTeX programs. Also fixed some
# nasty issues with the htlatex arguments.
#
# 2.3.2 Declare LaTeX input files as sources for targets so that they show
# up in IDEs like QtCreator.
#
# Fix issue where main tex files in subdirectories were creating
# invalid targets for building HTML. Just disable the HTML targets in
# this case.
#
# 2.3.1 Support use of magick command instead of convert command for
# ImageMagick 7.
#
# 2.3.0 Add USE_BIBLATEX option to support the biblatex package, which
# requires using the program biber as a replacement for bibtex
# (thanks to David Tracey).
@ -453,66 +364,6 @@ endfunction(latex_get_filename_component)
#############################################################################
# Functions that perform processing during a LaTeX build.
#############################################################################
function(latex_execute_latex)
if(NOT LATEX_WORKING_DIRECTORY)
message(SEND_ERROR "Need to define LATEX_WORKING_DIRECTORY")
endif()
if(NOT LATEX_FULL_COMMAND)
message(SEND_ERROR "Need to define LATEX_FULL_COMMAND")
endif()
if(NOT LATEX_OUTPUT_FILE)
message(SEND_ERROR "Need to define LATEX_OUTPUT_FILE")
endif()
if(NOT LATEX_LOG_FILE)
message(SEND_ERROR "Need to define LATEX_LOG_FILE")
endif()
set(full_command_original "${LATEX_FULL_COMMAND}")
# Chose the native method for parsing command arguments. Newer versions of
# CMake allow you to just use NATIVE_COMMAND.
if (CMAKE_VERSION VERSION_GREATER 3.8)
set(separate_arguments_mode NATIVE_COMMAND)
else()
if (WIN32)
set(separate_arguments_mode WINDOWS_COMMAND)
else()
set(separate_arguments_mode UNIX_COMMAND)
endif()
endif()
# Preps variables for use in execute_process.
# Even though we expect LATEX_WORKING_DIRECTORY to have a single "argument,"
# we also want to make sure that we strip out any escape characters that can
# foul up the WORKING_DIRECTORY argument.
separate_arguments(LATEX_FULL_COMMAND UNIX_COMMAND "${LATEX_FULL_COMMAND}")
separate_arguments(LATEX_WORKING_DIRECTORY_SEP UNIX_COMMAND "${LATEX_WORKING_DIRECTORY}")
execute_process(
COMMAND ${LATEX_FULL_COMMAND}
WORKING_DIRECTORY "${LATEX_WORKING_DIRECTORY_SEP}"
RESULT_VARIABLE execute_result
OUTPUT_VARIABLE ignore
ERROR_VARIABLE ignore
)
if(NOT ${execute_result} EQUAL 0)
# LaTeX tends to write a file when a failure happens. Delete that file so
# that LaTeX will run again.
file(REMOVE "${LATEX_WORKING_DIRECTORY}/${LATEX_OUTPUT_FILE}")
message("\n\nLaTeX command failed")
message("${full_command_original}")
message("Log output:")
file(READ "${LATEX_WORKING_DIRECTORY}/${LATEX_LOG_FILE}" log_output)
message("${log_output}")
message(FATAL_ERROR "Executed LaTeX, but LaTeX returned an error.")
endif()
endfunction(latex_execute_latex)
function(latex_makeglossaries)
# This is really a bare bones port of the makeglossaries perl script into
# CMake scripting.
@ -631,10 +482,10 @@ function(latex_makeglossaries)
set(codepage_flags "")
endif()
message("${XINDY_COMPILER} ${MAKEGLOSSARIES_COMPILER_ARGS} ${language_flags} ${codepage_flags} -I xindy -M ${glossary_name} -t ${glossary_log} -o ${glossary_out} ${glossary_in}"
message("${XINDY_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} ${language_flags} ${codepage_flags} -I xindy -M ${glossary_name} -t ${glossary_log} -o ${glossary_out} ${glossary_in}"
)
exec_program(${XINDY_COMPILER}
ARGS ${MAKEGLOSSARIES_COMPILER_ARGS}
ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
${language_flags}
${codepage_flags}
-I xindy
@ -653,7 +504,7 @@ function(latex_makeglossaries)
if("${xindy_output}" MATCHES "^Cannot locate xindy module for language (.+) in codepage (.+)\\.$")
message("*************** Retrying xindy with default codepage.")
exec_program(${XINDY_COMPILER}
ARGS ${MAKEGLOSSARIES_COMPILER_ARGS}
ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
${language_flags}
-I xindy
-M ${glossary_name}
@ -664,8 +515,8 @@ function(latex_makeglossaries)
endif()
else()
message("${MAKEINDEX_COMPILER} ${MAKEGLOSSARIES_COMPILER_ARGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}")
exec_program(${MAKEINDEX_COMPILER} ARGS ${MAKEGLOSSARIES_COMPILER_ARGS}
message("${MAKEINDEX_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}")
exec_program(${MAKEINDEX_COMPILER} ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
-s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}
)
endif()
@ -686,7 +537,7 @@ function(latex_makenomenclature)
set(nomencl_out ${LATEX_TARGET}.nls)
set(nomencl_in ${LATEX_TARGET}.nlo)
exec_program(${MAKEINDEX_COMPILER} ARGS ${MAKENOMENCLATURE_COMPILER_ARGS}
exec_program(${MAKEINDEX_COMPILER} ARGS ${MAKENOMENCLATURE_COMPILER_FLAGS}
${nomencl_in} -s "nomencl.ist" -o ${nomencl_out}
)
endfunction(latex_makenomenclature)
@ -708,8 +559,6 @@ function(latex_correct_synctex)
if(NOT LATEX_BINARY_DIRECTORY)
message(SEND_ERROR "Need to define LATEX_BINARY_DIRECTORY")
endif()
message("${LATEX_BINARY_DIRECTORY}")
message("${LATEX_SOURCE_DIRECTORY}")
set(synctex_file ${LATEX_BINARY_DIRECTORY}/${LATEX_TARGET}.synctex)
set(synctex_file_gz ${synctex_file}.gz)
@ -727,25 +576,14 @@ function(latex_correct_synctex)
message("Reading synctex file.")
file(READ ${synctex_file} synctex_data)
message("Replacing output paths with input paths.")
foreach(extension tex cls bst clo sty ist fd)
# Relative paths
message("Replacing relative with absolute paths.")
string(REGEX REPLACE
"(Input:[0-9]+:)([^/\n][^\n]\\.${extension}*)"
"(Input:[0-9]+:)([^/\n][^\n]*)"
"\\1${LATEX_SOURCE_DIRECTORY}/\\2"
synctex_data
"${synctex_data}"
)
# Absolute paths
string(REGEX REPLACE
"(Input:[0-9]+:)${LATEX_BINARY_DIRECTORY}([^\n]*\\.${extension})"
"\\1${LATEX_SOURCE_DIRECTORY}\\2"
synctex_data
"${synctex_data}"
)
endforeach(extension)
message("Writing synctex file.")
file(WRITE ${synctex_file} "${synctex_data}")
@ -762,120 +600,6 @@ function(latex_correct_synctex)
endfunction(latex_correct_synctex)
function(latex_check_important_warnings)
# Check for biber warnings/errors if that was run
set(bib_log_file ${LATEX_TARGET}.blg)
if(EXISTS ${bib_log_file})
file(READ ${bib_log_file} bib_log)
if(bib_log MATCHES "INFO - This is Biber")
message("\nChecking ${bib_log_file} for Biber warnings/errors.")
string(REGEX MATCHALL
"[A-Z]+ - [^\n]*"
biber_messages
"${bib_log}")
set(found_error)
foreach(message ${biber_messages})
if(NOT message MATCHES "^INFO - ")
set(found_error TRUE)
message("${message}")
endif()
endforeach(message)
if(found_error)
latex_get_filename_component(log_file_path ${bib_log_file} ABSOLUTE)
message("\nConsult ${log_file_path} for more information on Biber output.")
else()
message("No known important Biber output found.")
endif(found_error)
else() # Biber output not in log file
message("Skipping biber checks (biber not used)")
endif()
else() # No bib log file
message("Skipping bibliography checks (not run)")
endif()
set(log_file ${LATEX_TARGET}.log)
message("\nChecking ${log_file} for important warnings.")
if(NOT LATEX_TARGET)
message(SEND_ERROR "Need to define LATEX_TARGET")
endif()
if(NOT EXISTS ${log_file})
message("Could not find log file: ${log_file}")
return()
endif()
set(found_error)
file(READ ${log_file} log)
# Check for declared LaTeX warnings
string(REGEX MATCHALL
"\nLaTeX Warning:[^\n]*"
latex_warnings
"${log}")
if(latex_warnings)
set(found_error TRUE)
message("\nFound declared LaTeX warnings.")
foreach(warning ${latex_warnings})
string(STRIP "${warning}" warning_no_newline)
message("${warning_no_newline}")
endforeach(warning)
endif()
# Check for natbib warnings
string(REGEX MATCHALL
"\nPackage natbib Warning:[^\n]*"
natbib_warnings
"${log}")
if(natbib_warnings)
set(found_error TRUE)
message("\nFound natbib package warnings.")
foreach(warning ${natbib_warnings})
string(STRIP "${warning}" warning_no_newline)
message("${warning_no_newline}")
endforeach(warning)
endif()
# Check for overfull
string(REGEX MATCHALL
"\nOverfull[^\n]*"
overfull_warnings
"${log}")
if(overfull_warnings)
set(found_error TRUE)
message("\nFound overfull warnings. These are indicative of layout errors.")
foreach(warning ${overfull_warnings})
string(STRIP "${warning}" warning_no_newline)
message("${warning_no_newline}")
endforeach(warning)
endif()
# Check for invalid characters
string(REGEX MATCHALL
"\nMissing character:[^\n]*"
invalid_character_warnings
"${log}")
if(invalid_character_warnings)
set(found_error TRUE)
message("\nFound invalid character warnings. These characters are likely not printed correctly.")
foreach(warning ${invalid_character_warnings})
string(STRIP "${warning}" warning_no_newline)
message("${warning_no_newline}")
endforeach(warning)
endif()
if(found_error)
latex_get_filename_component(log_file_path ${log_file} ABSOLUTE)
message("\nConsult ${log_file_path} for more information on LaTeX build.")
else()
message("No known important warnings found.")
endif(found_error)
endfunction(latex_check_important_warnings)
#############################################################################
# Helper functions for establishing LaTeX build.
#############################################################################
@ -911,12 +635,6 @@ function(latex_setup_variables)
DOC "The pdf to ps converter program from the Poppler package."
)
find_program(HTLATEX_COMPILER
NAMES htlatex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
mark_as_advanced(
LATEX_COMPILER
PDFLATEX_COMPILER
@ -928,31 +646,38 @@ function(latex_setup_variables)
PS2PDF_CONVERTER
PDFTOPS_CONVERTER
LATEX2HTML_CONVERTER
HTLATEX_COMPILER
)
latex_needit(LATEX_COMPILER latex)
latex_wantit(PDFLATEX_COMPILER pdflatex)
latex_wantit(HTLATEX_COMPILER htlatex)
latex_needit(BIBTEX_COMPILER bibtex)
latex_wantit(BIBER_COMPILER biber)
latex_needit(MAKEINDEX_COMPILER makeindex)
latex_wantit(DVIPS_CONVERTER dvips)
latex_wantit(PS2PDF_CONVERTER ps2pdf)
latex_wantit(PDFTOPS_CONVERTER pdftops)
# MiKTeX calls latex2html htlatex
if(NOT ${LATEX2HTML_CONVERTER})
find_program(HTLATEX_CONVERTER
NAMES htlatex
PATHS ${MIKTEX_BINARY_PATH}
/usr/bin
)
mark_as_advanced(HTLATEX_CONVERTER)
if(HTLATEX_CONVERTER)
set(USING_HTLATEX TRUE CACHE INTERNAL "True when using MiKTeX htlatex instead of latex2html" FORCE)
set(LATEX2HTML_CONVERTER ${HTLATEX_CONVERTER}
CACHE FILEPATH "htlatex taking the place of latex2html" FORCE)
else()
set(USING_HTLATEX FALSE CACHE INTERNAL "True when using MiKTeX htlatex instead of latex2html" FORCE)
endif()
endif()
latex_wantit(LATEX2HTML_CONVERTER latex2html)
set(LATEX_COMPILER_FLAGS "-interaction=batchmode -file-line-error"
set(LATEX_COMPILER_FLAGS "-interaction=nonstopmode"
CACHE STRING "Flags passed to latex.")
set(PDFLATEX_COMPILER_FLAGS ${LATEX_COMPILER_FLAGS}
CACHE STRING "Flags passed to pdflatex.")
set(HTLATEX_COMPILER_TEX4HT_FLAGS "html"
CACHE STRING "Options for the tex4ht.sty and *.4ht style files.")
set(HTLATEX_COMPILER_TEX4HT_POSTPROCESSOR_FLAGS ""
CACHE STRING "Options for the text4ht postprocessor.")
set(HTLATEX_COMPILER_T4HT_POSTPROCESSOR_FLAGS ""
CACHE STRING "Options for the t4ht postprocessor.")
set(HTLATEX_COMPILER_LATEX_FLAGS ${LATEX_COMPILER_FLAGS}
CACHE STRING "Flags passed from htlatex to the LaTeX compiler.")
set(LATEX_SYNCTEX_FLAGS "-synctex=1"
CACHE STRING "latex/pdflatex flags used to create synctex file.")
set(BIBTEX_COMPILER_FLAGS ""
@ -967,26 +692,15 @@ function(latex_setup_variables)
CACHE STRING "Flags passed to makenomenclature.")
set(DVIPS_CONVERTER_FLAGS "-Ppdf -G0 -t letter"
CACHE STRING "Flags passed to dvips.")
if(NOT WIN32)
set(PS2PDF_CONVERTER_FLAGS "-dMaxSubsetPct=100 -dCompatibilityLevel=1.3 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/FlateEncode"
CACHE STRING "Flags passed to ps2pdf.")
else()
# Most windows ports of ghostscript utilities use .bat files for ps2pdf
# commands. bat scripts interpret "=" as a special character and separate
# those arguments. To get around this, the ghostscript utilities also
# support using "#" in place of "=".
set(PS2PDF_CONVERTER_FLAGS "-dMaxSubsetPct#100 -dCompatibilityLevel#1.3 -dSubsetFonts#true -dEmbedAllFonts#true -dAutoFilterColorImages#false -dAutoFilterGrayImages#false -dColorImageFilter#/FlateEncode -dGrayImageFilter#/FlateEncode -dMonoImageFilter#/FlateEncode"
CACHE STRING "Flags passed to ps2pdf.")
endif()
set(PDFTOPS_CONVERTER_FLAGS ""
set(PDFTOPS_CONVERTER_FLAGS -r 600
CACHE STRING "Flags passed to pdftops.")
set(LATEX2HTML_CONVERTER_FLAGS ""
CACHE STRING "Flags passed to latex2html.")
mark_as_advanced(
LATEX_COMPILER_FLAGS
PDFLATEX_COMPILER_FLAGS
HTLATEX_COMPILER_TEX4HT_FLAGS
HTLATEX_COMPILER_TEX4HT_POSTPROCESSOR_FLAGS
HTLATEX_COMPILER_T4HT_POSTPROCESSOR_FLAGS
HTLATEX_COMPILER_LATEX_FLAGS
LATEX_SYNCTEX_FLAGS
BIBTEX_COMPILER_FLAGS
BIBER_COMPILER_FLAGS
@ -996,17 +710,10 @@ function(latex_setup_variables)
DVIPS_CONVERTER_FLAGS
PS2PDF_CONVERTER_FLAGS
PDFTOPS_CONVERTER_FLAGS
LATEX2HTML_CONVERTER_FLAGS
)
# Because it is easier to type, the flags variables are entered as
# space-separated strings much like you would in a shell. However, when
# using a CMake command to execute a program, it works better to hold the
# arguments in semicolon-separated lists (otherwise the whole string will
# be interpreted as a single argument). Use the separate_arguments to
# convert the space-separated strings to semicolon-separated lists.
separate_arguments(LATEX_COMPILER_FLAGS)
separate_arguments(PDFLATEX_COMPILER_FLAGS)
separate_arguments(HTLATEX_COMPILER_LATEX_FLAGS)
separate_arguments(LATEX_SYNCTEX_FLAGS)
separate_arguments(BIBTEX_COMPILER_FLAGS)
separate_arguments(BIBER_COMPILER_FLAGS)
@ -1016,27 +723,9 @@ function(latex_setup_variables)
separate_arguments(DVIPS_CONVERTER_FLAGS)
separate_arguments(PS2PDF_CONVERTER_FLAGS)
separate_arguments(PDFTOPS_CONVERTER_FLAGS)
separate_arguments(LATEX2HTML_CONVERTER_FLAGS)
# Not quite done. When you call separate_arguments on a cache variable,
# the result is written to a local variable. That local variable goes
# away when this function returns (which is before any of them are used).
# So, copy these variables with local scope to cache variables with
# global scope.
set(LATEX_COMPILER_ARGS "${LATEX_COMPILER_FLAGS}" CACHE INTERNAL "")
set(PDFLATEX_COMPILER_ARGS "${PDFLATEX_COMPILER_FLAGS}" CACHE INTERNAL "")
set(HTLATEX_COMPILER_ARGS "${HTLATEX_COMPILER_LATEX_FLAGS}" CACHE INTERNAL "")
set(LATEX_SYNCTEX_ARGS "${LATEX_SYNCTEX_FLAGS}" CACHE INTERNAL "")
set(BIBTEX_COMPILER_ARGS "${BIBTEX_COMPILER_FLAGS}" CACHE INTERNAL "")
set(BIBER_COMPILER_ARGS "${BIBER_COMPILER_FLAGS}" CACHE INTERNAL "")
set(MAKEINDEX_COMPILER_ARGS "${MAKEINDEX_COMPILER_FLAGS}" CACHE INTERNAL "")
set(MAKEGLOSSARIES_COMPILER_ARGS "${MAKEGLOSSARIES_COMPILER_FLAGS}" CACHE INTERNAL "")
set(MAKENOMENCLATURE_COMPILER_ARGS "${MAKENOMENCLATURE_COMPILER_FLAGS}" CACHE INTERNAL "")
set(DVIPS_CONVERTER_ARGS "${DVIPS_CONVERTER_FLAGS}" CACHE INTERNAL "")
set(PS2PDF_CONVERTER_ARGS "${PS2PDF_CONVERTER_FLAGS}" CACHE INTERNAL "")
set(PDFTOPS_CONVERTER_ARGS "${PDFTOPS_CONVERTER_FLAGS}" CACHE INTERNAL "")
find_program(IMAGEMAGICK_CONVERT
NAMES magick convert
find_program(IMAGEMAGICK_CONVERT convert
DOC "The convert program that comes with ImageMagick (available at http://www.imagemagick.org)."
)
mark_as_advanced(IMAGEMAGICK_CONVERT)
@ -1175,7 +864,7 @@ function(latex_add_convert_command
if(PS2PDF_CONVERTER)
set(require_imagemagick_convert FALSE)
set(converter ${PS2PDF_CONVERTER})
set(convert_flags -dEPSCrop ${PS2PDF_CONVERTER_ARGS})
set(convert_flags -dEPSCrop ${PS2PDF_CONVERTER_FLAGS})
else()
message(SEND_ERROR "Using postscript files with pdflatex requires ps2pdf for conversion.")
endif()
@ -1186,7 +875,7 @@ function(latex_add_convert_command
if(PDFTOPS_CONVERTER)
set(require_imagemagick_convert FALSE)
set(converter ${PDFTOPS_CONVERTER})
set(convert_flags -eps ${PDFTOPS_CONVERTER_ARGS})
set(convert_flags -eps ${PDFTOPS_CONVERTER_FLAGS})
else()
message(STATUS "Consider getting pdftops from Poppler to convert PDF images to EPS images.")
set(convert_flags ${flags})
@ -1199,27 +888,20 @@ function(latex_add_convert_command
if(IMAGEMAGICK_CONVERT)
string(TOLOWER ${IMAGEMAGICK_CONVERT} IMAGEMAGICK_CONVERT_LOWERCASE)
if(${IMAGEMAGICK_CONVERT_LOWERCASE} MATCHES "system32[/\\\\]convert\\.exe")
message(SEND_ERROR "IMAGEMAGICK_CONVERT set to Window's convert.exe for changing file systems rather than ImageMagick's convert for changing image formats. Please make sure ImageMagick is installed (available at http://www.imagemagick.org). If you have a recent version of ImageMagick (7.0 or higher), use the magick program instead of convert for IMAGEMAGICK_CONVERT.")
message(SEND_ERROR "IMAGEMAGICK_CONVERT set to Window's convert.exe for changing file systems rather than ImageMagick's convert for changing image formats. Please make sure ImageMagick is installed (available at http://www.imagemagick.org) and its convert program is used for IMAGEMAGICK_CONVERT. (It is helpful if ImageMagick's path is before the Windows system paths.)")
else()
set(converter ${IMAGEMAGICK_CONVERT})
# ImageMagick requires a special order of arguments where resize and
# arguments of that nature must be placed after the input image path.
add_custom_command(OUTPUT ${output_path}
COMMAND ${converter}
ARGS ${input_path} ${convert_flags} ${output_path}
DEPENDS ${input_path}
)
endif()
else()
message(SEND_ERROR "Could not find convert program. Please download ImageMagick from http://www.imagemagick.org and install.")
endif()
else() # Not ImageMagick convert
endif()
add_custom_command(OUTPUT ${output_path}
COMMAND ${converter}
ARGS ${convert_flags} ${input_path} ${output_path}
DEPENDS ${input_path}
)
endif()
endfunction(latex_add_convert_command)
# Makes custom commands to convert a file to a particular type.
@ -1239,15 +921,10 @@ function(latex_convert_image
# Check input filename for potential problems with LaTeX.
latex_get_filename_component(name "${input_file}" NAME_WE)
set(suggested_name "${name}")
if(suggested_name MATCHES ".*\\..*")
string(REPLACE "." "-" suggested_name "${suggested_name}")
endif()
if(suggested_name MATCHES ".* .*")
string(REPLACE " " "-" suggested_name "${suggested_name}")
endif()
if(NOT suggested_name STREQUAL name)
message(WARNING "Some LaTeX distributions have problems with image file names with multiple extensions or spaces. Consider changing ${name}${extension} to something like ${suggested_name}${extension}.")
if(name MATCHES ".*\\..*")
string(REPLACE "." "-" suggested_name "${name}")
set(suggested_name "${suggested_name}${extension}")
message(WARNING "Some LaTeX distributions have problems with image file names with multiple extensions. Consider changing ${name}${extension} to something like ${suggested_name}.")
endif()
string(REGEX REPLACE "\\.[^.]*\$" ${output_extension} output_file
@ -1318,14 +995,11 @@ function(latex_process_images dvi_outputs_var pdf_outputs_var)
make_directory("${path}")
# Do conversions for dvi.
if(NOT LATEX_FORCE_PDF)
latex_convert_image(output_files "${file}" .eps "${convert_flags}"
"${LATEX_DVI_IMAGE_EXTENSIONS}" "${ARGN}")
list(APPEND dvi_outputs ${output_files})
endif ()
# Do conversions for pdf.
if(NOT LATEX_FORCE_DVI AND NOT LATEX_FORCE_HTML)
if(is_raster)
latex_convert_image(output_files "${file}" .png "${convert_flags}"
"${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
@ -1335,7 +1009,6 @@ function(latex_process_images dvi_outputs_var pdf_outputs_var)
"${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
list(APPEND pdf_outputs ${output_files})
endif()
endif()
else()
message(WARNING "Could not find file ${CMAKE_CURRENT_SOURCE_DIR}/${file}. Are you sure you gave relative paths to IMAGES?")
endif()
@ -1432,7 +1105,6 @@ function(parse_add_latex_arguments command latex_main_input)
CONFIGURE
DEPENDS
INDEX_NAMES
INCLUDE_DIRECTORIES
)
cmake_parse_arguments(
LATEX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@ -1473,83 +1145,24 @@ function(parse_add_latex_arguments command latex_main_input)
endfunction(parse_add_latex_arguments)
function(add_latex_targets_internal)
latex_get_output_path(output_dir)
if(LATEX_USE_SYNCTEX)
set(synctex_flags ${LATEX_SYNCTEX_ARGS})
set(synctex_flags ${LATEX_SYNCTEX_FLAGS})
else()
set(synctex_flags)
endif()
# The commands to run LaTeX. They are repeated multiple times.
set(latex_build_command
${LATEX_COMPILER} ${LATEX_COMPILER_ARGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
)
if(LATEX_COMPILER_ARGS MATCHES ".*batchmode.*")
# Wrap command in script that dumps the log file on error. This makes sure
# errors can be seen.
set(latex_build_command
${CMAKE_COMMAND}
-D LATEX_BUILD_COMMAND=execute_latex
-D LATEX_WORKING_DIRECTORY="${output_dir}"
-D LATEX_FULL_COMMAND="${latex_build_command}"
-D LATEX_OUTPUT_FILE="${LATEX_TARGET}.dvi"
-D LATEX_LOG_FILE="${LATEX_TARGET}.log"
-P "${LATEX_USE_LATEX_LOCATION}"
)
endif()
set(pdflatex_build_command
${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_ARGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
)
if(PDFLATEX_COMPILER_ARGS MATCHES ".*batchmode.*")
# Wrap command in script that dumps the log file on error. This makes sure
# errors can be seen.
set(pdflatex_build_command
${CMAKE_COMMAND}
-D LATEX_BUILD_COMMAND=execute_latex
-D LATEX_WORKING_DIRECTORY="${output_dir}"
-D LATEX_FULL_COMMAND="${pdflatex_build_command}"
-D LATEX_OUTPUT_FILE="${LATEX_TARGET}.pdf"
-D LATEX_LOG_FILE="${LATEX_TARGET}.log"
-P "${LATEX_USE_LATEX_LOCATION}"
)
endif()
if(LATEX_INCLUDE_DIRECTORIES)
# The include directories needs to start with the build directory so
# that the copied files can be found. It also needs to end with an
# empty directory so that the standard system directories are included
# after any specified.
set(LATEX_INCLUDE_DIRECTORIES . ${LATEX_INCLUDE_DIRECTORIES} "")
# CMake separates items in a list with a semicolon. Lists of
# directories on most systems are separated by colons, so we can do a
# simple text replace. On Windows, directories are separated by
# semicolons, but we replace them with the $<SEMICOLON> generator
# expression to make sure CMake treats it as a single string.
if(CMAKE_HOST_WIN32)
string(REPLACE ";" "$<SEMICOLON>" TEXINPUTS "${LATEX_INCLUDE_DIRECTORIES}")
else()
string(REPLACE ";" ":" TEXINPUTS "${LATEX_INCLUDE_DIRECTORIES}")
endif()
# Set the TEXINPUTS environment variable
set(latex_build_command
${CMAKE_COMMAND} -E env TEXINPUTS=${TEXINPUTS} ${latex_build_command})
set(pdflatex_build_command
${CMAKE_COMMAND} -E env TEXINPUTS=${TEXINPUTS} ${pdflatex_build_command})
endif()
if(NOT LATEX_TARGET_NAME)
# Use the main filename (minus the .tex) as the target name. Remove any
# spaces since CMake cannot have spaces in its target names.
string(REPLACE " " "_" LATEX_TARGET_NAME ${LATEX_TARGET})
set(LATEX_TARGET_NAME ${LATEX_TARGET})
endif()
# Some LaTeX commands may need to be modified (or may not work) if the main
# tex file is in a subdirectory. Make a flag for that.
get_filename_component(LATEX_MAIN_INPUT_SUBDIR ${LATEX_MAIN_INPUT} DIRECTORY)
# Set up target names.
set(dvi_target ${LATEX_TARGET_NAME}_dvi)
set(pdf_target ${LATEX_TARGET_NAME}_pdf)
@ -1628,8 +1241,6 @@ function(add_latex_targets_internal)
endif()
endforeach(input)
set(all_latex_sources ${LATEX_MAIN_INPUT} ${LATEX_INPUTS} ${image_list})
if(LATEX_USE_GLOSSARY)
foreach(dummy 0 1) # Repeat these commands twice.
set(make_dvi_command ${make_dvi_command}
@ -1639,7 +1250,7 @@ function(add_latex_targets_internal)
-D LATEX_TARGET=${LATEX_TARGET}
-D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-D XINDY_COMPILER=${XINDY_COMPILER}
-D MAKEGLOSSARIES_COMPILER_ARGS=${MAKEGLOSSARIES_COMPILER_ARGS}
-D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
-P ${LATEX_USE_LATEX_LOCATION}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${latex_build_command}
@ -1651,7 +1262,7 @@ function(add_latex_targets_internal)
-D LATEX_TARGET=${LATEX_TARGET}
-D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-D XINDY_COMPILER=${XINDY_COMPILER}
-D MAKEGLOSSARIES_COMPILER_ARGS=${MAKEGLOSSARIES_COMPILER_ARGS}
-D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
-P ${LATEX_USE_LATEX_LOCATION}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${pdflatex_build_command}
@ -1667,7 +1278,7 @@ function(add_latex_targets_internal)
-D LATEX_BUILD_COMMAND=makenomenclature
-D LATEX_TARGET=${LATEX_TARGET}
-D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-D MAKENOMENCLATURE_COMPILER_ARGS=${MAKENOMENCLATURE_COMPILER_ARGS}
-D MAKENOMENCLATURE_COMPILER_FLAGS=${MAKENOMENCLATURE_COMPILER_FLAGS}
-P ${LATEX_USE_LATEX_LOCATION}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${latex_build_command}
@ -1678,7 +1289,7 @@ function(add_latex_targets_internal)
-D LATEX_BUILD_COMMAND=makenomenclature
-D LATEX_TARGET=${LATEX_TARGET}
-D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-D MAKENOMENCLATURE_COMPILER_ARGS=${MAKENOMENCLATURE_COMPILER_ARGS}
-D MAKENOMENCLATURE_COMPILER_FLAGS=${MAKENOMENCLATURE_COMPILER_FLAGS}
-P ${LATEX_USE_LATEX_LOCATION}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${pdflatex_build_command}
@ -1687,30 +1298,17 @@ function(add_latex_targets_internal)
endif()
if(LATEX_BIBFILES)
set(suppress_bib_output)
if(LATEX_USE_BIBLATEX)
if(NOT BIBER_COMPILER)
message(SEND_ERROR "I need the biber command.")
endif()
set(bib_compiler ${BIBER_COMPILER})
set(bib_compiler_flags ${BIBER_COMPILER_ARGS})
if(NOT BIBER_COMPILER_ARGS MATCHES ".*-q.*")
# Only suppress bib output if the quiet option is not specified.
set(suppress_bib_output TRUE)
endif()
if(LATEX_USE_BIBLATEX_CONFIG)
list(APPEND auxiliary_clean_files ${output_dir}/biblatex.cfg)
list(APPEND make_dvi_depends ${output_dir}/biblatex.cfg)
list(APPEND make_pdf_depends ${output_dir}/biblatex.cfg)
endif()
set(bib_compiler_flags ${BIBER_COMPILER_FLAGS})
else()
set(bib_compiler ${BIBTEX_COMPILER})
set(bib_compiler_flags ${BIBTEX_COMPILER_ARGS})
set(bib_compiler_flags ${BIBTEX_COMPILER_FLAGS})
endif()
if(LATEX_MULTIBIB_NEWCITES)
# Suppressed bib output currently not supported for multibib
foreach (multibib_auxfile ${LATEX_MULTIBIB_NEWCITES})
latex_get_filename_component(multibib_target ${multibib_auxfile} NAME_WE)
set(make_dvi_command ${make_dvi_command}
@ -1723,25 +1321,12 @@ function(add_latex_targets_internal)
${output_dir}/${multibib_target}.aux)
endforeach (multibib_auxfile ${LATEX_MULTIBIB_NEWCITES})
else()
set(full_bib_command
${bib_compiler} ${bib_compiler_flags} ${LATEX_TARGET})
if(suppress_bib_output)
set(full_bib_command
${CMAKE_COMMAND}
-D LATEX_BUILD_COMMAND=execute_latex
-D LATEX_WORKING_DIRECTORY="${output_dir}"
-D LATEX_FULL_COMMAND="${full_bib_command}"
-D LATEX_OUTPUT_FILE="${LATEX_TARGET}.bbl"
-D LATEX_LOG_FILE="${LATEX_TARGET}.blg"
-P "${LATEX_USE_LATEX_LOCATION}"
)
endif()
set(make_dvi_command ${make_dvi_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${full_bib_command})
${bib_compiler} ${bib_compiler_flags} ${LATEX_TARGET})
set(make_pdf_command ${make_pdf_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${full_bib_command})
${bib_compiler} ${bib_compiler_flags} ${LATEX_TARGET})
endif()
foreach (bibfile ${LATEX_BIBFILES})
@ -1765,12 +1350,12 @@ function(add_latex_targets_internal)
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${latex_build_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_ARGS} ${idx_name}.idx)
${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${idx_name}.idx)
set(make_pdf_command ${make_pdf_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${pdflatex_build_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_ARGS} ${idx_name}.idx)
${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${idx_name}.idx)
set(auxiliary_clean_files ${auxiliary_clean_files}
${output_dir}/${idx_name}.idx
${output_dir}/${idx_name}.ilg
@ -1828,22 +1413,6 @@ function(add_latex_targets_internal)
)
endif()
# Check LaTeX output for important warnings at end of build
set(make_dvi_command ${make_dvi_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${CMAKE_COMMAND}
-D LATEX_BUILD_COMMAND=check_important_warnings
-D LATEX_TARGET=${LATEX_TARGET}
-P ${LATEX_USE_LATEX_LOCATION}
)
set(make_pdf_command ${make_pdf_command}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${CMAKE_COMMAND}
-D LATEX_BUILD_COMMAND=check_important_warnings
-D LATEX_TARGET=${LATEX_TARGET}
-P ${LATEX_USE_LATEX_LOCATION}
)
# Capture the default build.
string(TOLOWER "${LATEX_DEFAULT_BUILD}" default_build)
@ -1862,10 +1431,7 @@ function(add_latex_targets_internal)
COMMAND ${make_pdf_command}
DEPENDS ${make_pdf_depends}
)
add_custom_target(${pdf_target}
DEPENDS ${output_dir}/${LATEX_TARGET}.pdf
SOURCES ${all_latex_sources}
)
add_custom_target(${pdf_target} DEPENDS ${output_dir}/${LATEX_TARGET}.pdf)
if(NOT LATEX_EXCLUDE_FROM_DEFAULTS)
add_dependencies(pdf ${pdf_target})
endif()
@ -1886,10 +1452,7 @@ function(add_latex_targets_internal)
COMMAND ${make_dvi_command}
DEPENDS ${make_dvi_depends}
)
add_custom_target(${dvi_target}
DEPENDS ${output_dir}/${LATEX_TARGET}.dvi
SOURCES ${all_latex_sources}
)
add_custom_target(${dvi_target} DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
if(NOT LATEX_EXCLUDE_FROM_DEFAULTS)
add_dependencies(dvi ${dvi_target})
endif()
@ -1897,12 +1460,9 @@ function(add_latex_targets_internal)
if(DVIPS_CONVERTER)
add_custom_command(OUTPUT ${output_dir}/${LATEX_TARGET}.ps
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${DVIPS_CONVERTER} ${DVIPS_CONVERTER_ARGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi
${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi
DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
add_custom_target(${ps_target}
DEPENDS ${output_dir}/${LATEX_TARGET}.ps
SOURCES ${all_latex_sources}
)
add_custom_target(${ps_target} DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
if(NOT LATEX_EXCLUDE_FROM_DEFAULTS)
add_dependencies(ps ${ps_target})
endif()
@ -1912,7 +1472,7 @@ function(add_latex_targets_internal)
# simply force a recompile every time.
add_custom_target(${safepdf_target}
${CMAKE_COMMAND} -E chdir ${output_dir}
${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_ARGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
DEPENDS ${ps_target}
)
if(NOT LATEX_EXCLUDE_FROM_DEFAULTS)
@ -1927,36 +1487,19 @@ function(add_latex_targets_internal)
set(default_build html)
endif()
if(HTLATEX_COMPILER AND LATEX_MAIN_INPUT_SUBDIR)
message(STATUS
"Disabling HTML build for ${LATEX_TARGET_NAME}.tex because the main file is in subdirectory ${LATEX_MAIN_INPUT_SUBDIR}"
)
# The code below to run HTML assumes that LATEX_TARGET.tex is in the
# current directory. I have tried to specify that LATEX_TARGET.tex is
# in a subdirectory. That makes the build targets correct, but the
# HTML build still fails (at least for htlatex) because files are not
# generated where expected. I am getting around the problem by simply
# disabling HTML in this case. If someone really cares, they can fix
# this, but make sure it runs on many platforms and build programs.
elseif(HTLATEX_COMPILER)
if(LATEX2HTML_CONVERTER)
if(USING_HTLATEX)
# htlatex places the output in a different location
set(HTML_OUTPUT "${output_dir}/${LATEX_TARGET}.html")
else()
set(HTML_OUTPUT "${output_dir}/${LATEX_TARGET}/${LATEX_TARGET}.html")
endif()
add_custom_command(OUTPUT ${HTML_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
${HTLATEX_COMPILER} ${LATEX_MAIN_INPUT}
"${HTLATEX_COMPILER_TEX4HT_FLAGS}"
"${HTLATEX_COMPILER_TEX4HT_POSTPROCESSOR_FLAGS}"
"${HTLATEX_COMPILER_T4HT_POSTPROCESSOR_FLAGS}"
${HTLATEX_COMPILER_ARGS}
DEPENDS
${output_dir}/${LATEX_TARGET}.tex
${output_dir}/${LATEX_TARGET}.dvi
VERBATIM
)
add_custom_target(${html_target}
DEPENDS ${HTML_OUTPUT} ${dvi_target}
SOURCES ${all_latex_sources}
${LATEX2HTML_CONVERTER} ${LATEX2HTML_CONVERTER_FLAGS} ${LATEX_MAIN_INPUT}
DEPENDS ${output_dir}/${LATEX_TARGET}.tex
)
add_custom_target(${html_target} DEPENDS ${HTML_OUTPUT} ${dvi_target})
if(NOT LATEX_EXCLUDE_FROM_DEFAULTS)
add_dependencies(html ${html_target})
endif()
@ -2011,11 +1554,6 @@ function(add_latex_document latex_main_input)
latex_copy_input_file(${bib_file})
endforeach (bib_file)
if (LATEX_USE_BIBLATEX AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/biblatex.cfg)
latex_copy_input_file(biblatex.cfg)
set(LATEX_USE_BIBLATEX_CONFIG TRUE)
endif()
foreach (input ${LATEX_INPUTS})
latex_copy_input_file(${input})
endforeach(input)
@ -2038,11 +1576,6 @@ endfunction(add_latex_document)
if(LATEX_BUILD_COMMAND)
set(command_handled)
if("${LATEX_BUILD_COMMAND}" STREQUAL execute_latex)
latex_execute_latex()
set(command_handled TRUE)
endif()
if("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries)
latex_makeglossaries()
set(command_handled TRUE)
@ -2058,11 +1591,6 @@ if(LATEX_BUILD_COMMAND)
set(command_handled TRUE)
endif()
if("${LATEX_BUILD_COMMAND}" STREQUAL check_important_warnings)
latex_check_important_warnings()
set(command_handled TRUE)
endif()
if(NOT command_handled)
message(SEND_ERROR "Unknown command: ${LATEX_BUILD_COMMAND}")
endif()

Binary file not shown.

View file

@ -2,7 +2,7 @@
\documentclass{article}
\newcommand{\UseLATEXVersion}{2.7.0}
\newcommand{\UseLATEXVersion}{2.3.0}
\newcommand{\SANDNumber}{SAND 2008-2743P}
% This wonderful package allows hyphenation in tt fonts and hyphenation of
@ -88,8 +88,6 @@
\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}
%-----------------------------------------------------------------------------
@ -135,7 +133,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{HTLATEX\_COMPILER} CMake variable to be set.
\textcmakevar{LATEX2HTML\_CONVERTER} 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
@ -227,14 +225,20 @@ add_latex_document(MyDoc.tex
\end{CodeListing}
%$
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.
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{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.
\UseLATEX will occasionally use a conversion program other than
ImageMagick's \textprog{magick}. For example, \textprog{ps2pdf} will be
ImageMagick's \textprog{convert}. 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
@ -736,8 +740,11 @@ add_latex_document(doc.tex TARGET_NAME MyDoc1)
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 \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.
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.
\begin{CodeListing}
latex_get_output_path(output_dir)
@ -750,33 +757,6 @@ add_custom_command(OUTPUT ${output_dir}/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}
@ -799,7 +779,7 @@ add_latex_document(UberReport.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/binary-releases.php#windows}{http://www.imagemagick.org/script/binary-releases.php\#windows},
\href{http://www.imagemagick.org/script/index.php}{http://www.imagemagick.org/script/index.php},
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
@ -920,9 +900,10 @@ 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{magick} or \textprog{convert} program.
run the \textprog{convert} program.
A common error is that \textprog{magick} or \textprog{convert} not finding a file that is clearly there.
A common error is that \textprog{convert} not finding a file that
is clearly there.
\begin{CodeListing}
convert: unable to open image `filename'
@ -954,14 +935,17 @@ 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.
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.
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.
\subsection{How do I automate plot generation with command line programs?}
\label{How_do_I_automate_plot_generation_with_command_line_programs}
@ -1108,8 +1092,8 @@ include(UseLATEX.cmake)
\begin{CodeListing}
Some LaTeX distributions have problems with image file names
with multiple extensions or spaces. Consider changing
my.image.pdf to something like my-image.pdf.
with multiple extensions. 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
@ -1140,30 +1124,12 @@ my.image.pdf to 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.
the ImageMagick \textprog{convert} program.
Users occasionally report that image formats that should be supported
because ImageMagick can convert them are ignored by \UseLATEX. This can
@ -1234,57 +1200,6 @@ my.image.pdf to something like my-image.pdf.
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.
%-----------------------------------------------------------------------------
@ -1296,20 +1211,15 @@ my.image.pdf to something like my-image.pdf.
\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}

View file

@ -1,183 +0,0 @@
#!/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

@ -4,7 +4,7 @@ project(DefaultTargets NONE)
include(../../UseLATEX.cmake)
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)
add_latex_document(DefaultDvi.tex FORCE_DVI)
add_latex_document(DefaultPdf.tex FORCE_PDF)
add_latex_document(DefaultHtml.tex FORCE_HTML)
add_latex_document(NoDefault.tex EXCLUDE_FROM_ALL)

View file

@ -1,15 +1,9 @@
\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

@ -1,15 +1,9 @@
\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,15 +1,9 @@
\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,15 +1,9 @@
\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}

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View file

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

View file

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

View file

@ -1,4 +0,0 @@
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

@ -1,15 +0,0 @@
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

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

View file

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

View file

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

View file

@ -1,4 +0,0 @@
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

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

View file

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

View file

@ -4,15 +4,9 @@
\begin{document}
\fbox{\includegraphics[width=2in]{images/Circles_svg}}
\fbox{\includegraphics[width=2in]{images/Circles}}
SVG
\fbox{\includegraphics[width=2in]{images/Circles_pdf}}
PDF
\fbox{\includegraphics[width=2in]{images/Circles_eps}}
EPS
\fbox{\includegraphics[width=2in]{images/RainbowBar}}
TIFF

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

@ -1,16 +0,0 @@
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

@ -1,4 +0,0 @@
% -*- 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

@ -1,22 +0,0 @@
% -*- 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

@ -1,3 +0,0 @@
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

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

View file

@ -1,4 +0,0 @@
% -*- 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

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

View file

@ -4,7 +4,6 @@ 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.
When running this project, two documents should be built. 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.