Git Product home page Git Product logo

uselatexmk's Introduction

What is UseLatexMk?

UseLatexMk is a cmake tool to build Latex documents from cmake projects.

Instead of doing the tedious work of implementing all the logic on how to build Latex files in the CMake language (like the better known UseLATEX does), it uses the LatexMk tool found on the system. As a result, there are some advantages of using UseLatexMk.cmake over using UseLATEX.cmake:

  • Additional input files, like e.g. code listing, do not have to be manually listed anymore. Dependency tracking is done by LatexMk instead of cmake.
  • The generation procedure is more robust, because it relies on an upstream tool with a wider userbase.
  • Additional (sophisticated) build logic can be provided to latexmkrc through configuration files without touching the CMake code. Note, you need to do this to build non-PDF documents.
  • A target clean_latex to clean the build directory from all latex output and auxiliary latex files is available.

Please note the following restrictions:

UseLatexMk relies on latexmk separating input and output directory correctly. This includes using an absolute path for the output directory. On some TeX systems this requires the disabling of a security measure by setting openout_any = a. See UseLatexMk.cmake for additional information on the matter.

UseLatexMk is mainly designed to build PDF documents. You may enable building other types of documents by providing a custom latexmkrc template, but you may experience incompatibilities with other parts of UseLatexMk, such as installation.

The minted package is a bit special regarding its placement of auxiliary files. In order to use it with UseLatexMk you should use the following parameters to \usepackage:

\usepackage[outputdir=@CMAKE_CURRENT_BINARY_DIR@]{minted}

What is needed to use UseLatexMk from my project?

You just need to

  • copy all the CMake modules (*.cmake) from this project into your project
  • Include them with include(UseLatexMk). This is best done from the top-level directory of your project, to make the clean_latex target available on that level.
  • Use CMake 3.10 or newer.

Now, you are ready to use it!

How do I use it?

Just use the following CMake function add_latex_document from anywhere in your project. For an explanation of parameters, check UseLatexMk.cmake.

To clean the build directory from all latex files, use the target clean_latex.

License

This software is provided under a BSD license, you can find it in the .cmake files of the project.

uselatexmk's People

Contributors

dokempf avatar gruenich avatar osander1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

uselatexmk's Issues

_tex_source unexpectedly inserted into output filenames

Since fa0376c, UseLatexMk has been inserting _tex_source into the names of output files. As far as I can tell this happens with every generated file, regardless of whether the filename was specified with the TARGET argument to add_latex_document or derived from the SOURCE argument.

From the commit message this appears to be a workaround needed to compile LaTeX source that uses the minted package, but in most cases users are expecting the output filenames to be the same as the input file, only with .tex replaced with the output file extension (.pdf, .aux, .ps, .dvi, etc.).

Setting openout_any does not work

Hi,
when trying to compile the dune pdelabs tutorial I ran into a problem with the build process:
I need to set openout_any to a for bibtex to work. In principle these lines are expected to do that. However, these lines did not work for me. During build bibtex reported that openout_any was p instead of a.

This is also what I would expect: if I understand correctly what cmake is doing, then set() just sets environment variables during the configuration step, but not during the actual build. That would mean that setting the environment variable via set() should not be possible, see also this stackoverflow.

I am not sure how to fix this in a sustainable way. I hot-fixed the problem by changing this line to COMMAND env openout_any="a" ${LATEXMK_EXECUTABLE} ${LATEXMKRC_OPTIONS} ${LMK_SOURCE}.

System: Fedora with the version 4.70b of latexmk

Interoperability with Minted

Using the minted package right now breaks UseLatexMk, as the auxiliary minted files are not placed in the build directory. I will investigate this when I find time to do so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.