Menu

#261 Nested LaTeX dependencies

workingwiki
closed
None
5
2013-05-24
2013-02-09
No

If manuscript.tex \includes content.tex, and content.tex \includes abstract.tex, then updating abstract.tex or content.tex should make manuscript.tex out of date, but the former does not seem to work. I constructed an example from an existing project at http://lalashan.mcmaster.ca/theobio/circumcision/index.php/Condom_Manuscript/sync, but have not boiled it down to a MRE.

Related

Bugs: #48

Discussion

  • Lee Worden

    Lee Worden - 2013-02-09

    That looks minimal enough to me. Thanks!

    The error is clear from looking at CondomManuscript.d:

    CondomManuscript.latex.pdf : content.tex
    [...]
    CondomManuscript.latexml.xml : content.tex

    In order to work right, it needs to have the transitive dependencies on title.tex, abstract.tex, and main.tex listed somewhere.

     
  • Lee Worden

    Lee Worden - 2013-02-09

    I could either:

    • Include something in content.d that says

      content.tex : title.tex abstract.tex main.tex

    or something, or

    • open up everything recursively when reading through CondomManuscript.tex for inclusions, and end up with

      CondomManuscript.latex.pdf : content.tex title.tex abstract.tex main.tex

    Right now the former sounds iffy, and I think I like the latter, but I'm open to ideas.

    There might be a good way to do the former using an intermediate target other than the .tex... maybe the .d itself...

     
  • Lee Worden

    Lee Worden - 2013-02-09
     

    Last edit: Lee Worden 2013-03-13
  • Lee Worden

    Lee Worden - 2013-03-29
     
  • Lee Worden

    Lee Worden - 2013-03-29

    In the Latex_sync example, there are problems with a .tex file including a .tex file that uses a .bib file, and the .bib file isn't handled right. That may or may not be the same as this ticket. Both cases should work, clearly.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    Have built an MRE offline, and confirmed that it doesn't mention abstract.tex in main.d, and doesn't remake main.pdf when abstract.tex is changed.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    Wrong filenames there. Fixed: Have built an MRE offline, and confirmed that it doesn't mention abstract.tex in manuscript.d, and doesn't remake manuscript.pdf when abstract.tex is changed.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    manuscript.d says:

    manuscript.latex.pdf : content.tex  
    manuscript.pdflatex.pdf manuscript.xelatex.pdf : content.tex  
    manuscript.bbl :: 
    manuscript.latexml.xhtml manuscript.latexml.html5 manuscript.latexml.html : content.tex  
    manuscript.latexml.xml : content.tex
    
     
  • Lee Worden

    Lee Worden - 2013-03-29

    If I edit manuscript.d by hand:

    manuscript.latex.pdf : content.tex abstract.tex
    manuscript.pdflatex.pdf manuscript.xelatex.pdf : content.tex abstract.tex
    

    Then it updates manuscript.pdf correctly when abstract.tex changes.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    Jonathan's approach in http://lalashan.mcmaster.ca/theobio/projects/index.php/Latex_sync is different: since we already have

    manuscript.latex.pdf : content.tex

    if we add

    content.tex : abstract.tex

    then the chaining should work when abstract.tex is changed. Apparently it doesn't work unless that latter rule has an explicit rule to touch content.tex. I'm going to try to reproduce this now.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    Confirmed that adding

    content.tex : abstract.tex

    doesn't get it to update manuscript.pdf when abstract.tex is changed. Don't know why.

     
  • Lee Worden

    Lee Worden - 2013-03-29

    It may because there is no command it can run to update content.tex from abstract.tex, so it knows there isn't a useful chain there.

    Indeed (as Jonathan told me), if I change that to

    content.tex : abstract.tex ; ls

    then it does run ls; but it doesn't remake manuscript.pdf. Jonathan says this is because after running ls, it checks to see if content.tex is actually newer, and sees that it isn't.

    Further supporting this is that if I change that line to

    content.tex : abstract.tex ; touch $@

    then it updates the pdf file as intended.

     
  • Lee Worden

    Lee Worden - 2013-03-30

    I noticed using make -d that it updates content.tex from abstract.tex during the early pass where it remakes content.d, and then fails to update from content.tex during the main pass where it tries to make manuscript.pdf.

    So it might help with this to remove the early pass by adopting the http://mad-scientist.net/make/autodep.html pattern (as suggested in https://sourceforge.net/p/workingwiki/bugs/48). Presumably I can check this by just taking out the %.d : %.tex rules and leaving the .d files sitting there, to neutralize the early pass.

     
  • Lee Worden

    Lee Worden - 2013-03-30

    With the %.d : %.tex taken out, the chaining (with touch command) works in the straightforward way you might expect, and remakes manuscript.pdf when abstract.tex is touched.

    With the command removed:

    content.tex : abstract.tex

    it does not update the pdf. Here's part of the make -d output:

    ~~~~text
      Prerequisite `abstract.tex' is newer than target `content.tex'.
     No commands for `content.tex' and no prerequisites actually changed.
     No need to remake target `content.tex'.
    

    ????

     
  • Lee Worden

    Lee Worden - 2013-03-30

    OTOH, if I change that to

    manuscript.latex.pdf : abstract.tex

    it does rebuild the pdf.

     
  • Lee Worden

    Lee Worden - 2013-03-30

    Regarding the mad scientist thing: if we switch to updating .d files when we run *tex and/or latexml, I think it'll be hard to maintain a chained system of .d files, because (using this discussion's example) we'll update manuscript.d when we run latex to make manuscript.pdf, but when will we update content.d? I think this must be why the mad-scientist recipe for .c files puts all the prerequisites, no matter how distantly chained, in the final .c file's .d (or .P?) file.

    I'm thinking our options are:

    1. Put all prerequisites in a .d file corresponding to a final target, and have the option of going over to the mad-scientist pattern of dependency tracking.
    2. Make a .d file for each .tex file, with chains of rules that include touch commands.

    I'm favoring option no. 1, partly because I'm not so into using touch to update a file that isn't actually changed, but more because I think the pattern for C programs has been tested in the field (I've borrowed and used it before, and I'm surely not alone), and I have more confidence in it.

     
  • Lee Worden

    Lee Worden - 2013-03-30

    Hmm, if we use chained rules like

    (in manuscript.d)

    manuscript.latex.pdf : content.tex

    (in content.d)

    content.tex : abstract.tex ; touch $@

    together with

    (in $(RESOURCES)/makefile-after)

    %.d : %.tex

    and abstract.tex is to be made from a .dmu file that doesn't work, then what happens? Make won't be able to make abstract.d and content.d, so the whole project will break and be unable to make anything. This is the problem of

    We can get make to run by not using content.d and abstract.d (by not including them in $(WW_TEX_D_FILES)), but then the pdf file won't depend on the .dmu. But if we do include them, breaking the DMU code breaks the whole project.

    So this is an argument for eliminating the %.d : %.tex, and if we switch to not using chaining:

    manuscript.latex.pdf : content.tex abstract.tex

    we'll avoid the can't make problem, but we'll still have it if we try to make manuscript.pdf from manuscript.dmu. This is not actually an argument against or for chaining, but against having make update the .d files automatically. So it belongs in bug #48, not here. I'll copy it over there.

     

    Related

    Bugs: #48

  • Lee Worden

    Lee Worden - 2013-04-19
    • status: open --> closed
    • assigned_to: Lee Worden
     
  • Lee Worden

    Lee Worden - 2013-04-19

    Ticket #48 is closed now: the makefiles have been rewritten using the mad-scientist pattern, and the new .d files include all the recursively-listed prerequisites. This resolves this bug as well.

     

    Last edit: Lee Worden 2013-04-19
  • Lee Worden

    Lee Worden - 2013-05-24
    • Group: lalashan-yushan_site-specific --> workingwiki
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.