[CMake] Matlab producing image files for use with LaTeX
Myles English
mylesenglish at gmail.com
Mon Jan 12 06:26:01 EST 2015
Hello Rob,
Rob McDonald writes:
> I am familiar with UseLATEX, but would like to take the automation of
> my document build system a step or two further. Solutions that build
> on UseLATEX -- or a totally separate approach, are OK.
>
> I often use Matlab to create *.pdf figures -- which are then used in a
> LaTeX document. I would like my build setup to notice when a Matlab
> *.m file has changed - and then re-run it to re-generate the dependent
> *.pdf - and then LaTeX for the final document.
I haven't done it myself, but How about using emacs? An emacs daemon
could notice when files change and call emacs org-mode functions
(optionally via a call to CMake) to call Matlab to regenerate the plots,
then org-mode export as LaTeX.
A part of CMakeLists.txt to call emacs function may be like this:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mainThesis.tex
COMMAND emacs -Q --batch --eval \"(progn
(add-to-list 'load-path
(expand-file-name \\"~/.emacs.d/plugins/org-mode/lisp/\\"))
(require 'org)
.....etc.
> If that works, I would like to take things a step further and specify
> that the *.m files may depend on some external data files of arbitrary
> formats. The whole system should notice and update when those data
> files are updated.
A cron job to download the data locally (using curl or wget) then the
emacs daemon could monitor those also.
>
> Bonus points for a system that detects as much of the dependencies
> automagically (like #include ing header files).
Emacs Org-mode source blocks store a hash so they only re-run if
necessary.
Myles
More information about the CMake
mailing list