Search code examples
octavetexexport-to-pdf

How to adjust page size while publishing?


Software: Octave v7.1.0

  • There seems to be no option of defining the page size while doing publish ("FILE", "pdf") . The manual for pdf is: 11.11.1 docs.octave/.../Publish.

  • It's kinda surprising as it's a one word addition to the output TeX file : a4paper. I can do this manually each time I publish but being able to specify it somehow within the publish function would be awesome.

  • Surprisingly, there are plenty options for specifying page size in figures and images. Search for papertype at: 15.3.3.2 docs.octave/.../Figure-Properties

  • I searched with "Matlab" and found this page, and it fetched the results for "Matlab Report Generator" mlreportgen which seems a different thing.

  • I'd be interested to listen about other ways of doing it automatically too (like adding that word in TeX file via shell scripting and text string manipulation maybe).


Solution

  • As directed by @cris-luengo in the pointer comment to the linked manual, one solution can be to edit (or create) the function files (to used by the publish function) with the desired changes to specify the paper size.

    The function files location can be found by:

    • opening the function file in octave gui and then proceeding from there:
      edit (fullfile (fileparts (which ("publish")), "private", "__publish_html_output__.m"))

    • or, executing the following in octave REPL/command line:
      fullfile (fileparts (which ("publish")), "private")

    There, among other files, 2 files will be:

    __publish_html_output__.m
    __publish_latex_output__.m
    

    Edit the _latex_ containing file to add ,a4paper (or other predefined size in latex) alongwith 10pt in the line '\documentclass[10pt]{article}',, optionally with a comment in a proceeding newline as a reminder that you added it, something like: '% Modification: specify a4paper',

    If pdf format were directly specified as a new function file, then I'd have preferred to modify its copy and calling that directly in publish(), but since the publish pdf eventually calls publish latex, so, the only option at hand in this method seems to edit the original publish latex function file itself.