Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    @wuchanan Thank you again. Nice idea.
    I attach a log with the trace outputTraceOutput.smcl
    It seems markdoc is looking at the following strange filepath :
    Code:
    `"d:\ado/d/d:/CATI/MarkDoc_slidesPDF.pdf"'

    Comment


    • #47
      valérie orozco the source is a beast, but you might want to try submitting a bug to the project's repository: https://github.com/haghish/MarkDoc.

      Comment


      • #48
        valérie orozco

        Ok, look that there is an obvious mistake in your path! And I cannot believe how you can confirm the file path like that! Actually, it's impossible! The path that you defined DOES NOT HAVE FILE EXTENSION (.SMCL) and therefore, Stata MUST RETURN A CLEAR ERROR that the file does not exist in the path. But MarkDoc is more flexible than Stata (see below). So Please try to confirm the file as I explained in my previous post to make sure Stata can access the file...I can't really help you unless you tell us what happens when you use the
        Code:
        confirm file "`SavePath'/MarkDoc_slidesPDF.smcl"
        MarkDoc can take different file inputs for producing dynamic documents, slides, or dynamic STHLP Stata help files. However, by default, it assumes that your file is SMCL. If you do not specify the file extension (i.e. .smcl, .do, .ado, .mata), MarkDoc tries to add ".smcl" to the file name and checks whether it exists. Once you start adding double quotations, without adding the extension, this will confuse MarkDoc and the errors you get are due to this problem (which is something I can work on). So, add a ".smcl" to your path and see what happens.

        If Stata confirms the file you have defined, then upload your do-file.

        PS. From your previous posts it seems you were able to produce the dynamic slides when using a static path? Which means MarkDoc could produce PDF slides?

        PS2. The log you uploaded has no error! It only has the warnings. The do-file and data would be more informative.

        PS3. From your log-file, it is clear that the path to pdfLaTeX is not accessible on your machine (and of course, you have not defined the path to pdfLaTeX). Now I doubt it that you had been able to produce the PDF slides with usual paths... Please read the help file thoroughly and use the printer(str) option to define the path to pdfLaTeX. You need to download MikeTeX for Windows: http://www.miktex.org/


        Last edited by haghish; 02 Mar 2016, 09:22.

        Comment


        • #49
          haghish It might be more useful for the OP to use filesys to both confirm the existence of the file and file permissions that could be problematic (e.g., read/write permissions that may be needed).

          Comment


          • #50
            Since the log files are created by Stata, I doubt it that "reading permission" would be an issue. Besides, MarkDoc is robust to writing permission or it will return the right error when it cannot replace a file or copy it in a directory. The package looked useful though, didn't know about it before.

            Comment


            • #51
              haghish I started building it in response to another thread about compiling Mata for different versions of Stata and use it in some of my other packages to force the Mata source to be recompiled if it was created before the distribution date. The other thing that is nice is that you can modify the file permissions (particularly useful on non-*nix platforms) using the command as well.

              Comment


              • #52
                The latter can be very useful, for those who don't want to bother with shell commands for Windows & Unix. I had to deal with all of that in the early versions of MarkDoc, and it wasn't very pleasant!

                Comment


                • #53
                  haghish
                  Thank you for your answer.
                  First you 're right, with static path I have no error (or warning), MarkDoc produces slides perfectly. My post was just to understand the problem when using filepath (but I can do differently).

                  Originally posted by haghish View Post
                  valérie orozco

                  Ok, look that there is an obvious mistake in your path! And I cannot believe how you can confirm the file path like that! Actually, it's impossible! The path that you defined DOES NOT HAVE FILE EXTENSION (.SMCL) and therefore, Stata MUST RETURN A CLEAR ERROR that the file does not exist in the path. But MarkDoc is more flexible than Stata (see below). So Please try to confirm the file as I explained in my previous post to make sure Stata can access the file...I can't really help you unless you tell us what happens when you use the
                  Code:
                  confirm file "`SavePath'/MarkDoc_slidesPDF.smcl"
                  I didn't do any mistake when testing the confirm command! (the extension smcl was written!). And the file exists and is well located.


                  Originally posted by haghish View Post
                  valérie orozco
                  Once you start adding double quotations, without adding the extension, this will confuse MarkDoc and the errors you get are due to this problem (which is something I can work on). So, add a ".smcl" to your path and see what happens.
                  I understand now why the suggestions to write
                  Code:
                  markdoc "`SavePath'/MarkDoc_slidesPDF", export(slide) replace
                  or
                  Code:
                  markdoc `"`SavePath'/MarkDoc_slidesPDF"', export(slide) replace install.
                  don't succeed (extension problem due to quotations).

                  and writing

                  Code:
                  markdoc `SavePath'/MarkDoc_slidesPDF.smcl, export(slide) replace
                  or
                  Code:
                  markdoc `SavePath'/MarkDoc_slidesPDF, export(slide) replace
                  gives the same warning. So yes it is only a warning, the slides were created. But why when specifying static path I have no warning? MiKTeX is installed in my computer and I don't specify the printer option with the static path neither.

                  Again, my post is just to better understand the way MarkDoc works.
                  Thank you
                  valérie
                  Last edited by valérie orozco; 03 Mar 2016, 01:26.

                  Comment


                  • #54
                    Originally posted by valérie orozco View Post
                    So yes it is only a warning, the slides were created. But why when specifying static path I have no warning? MiKTeX is installed in my computer and I don't specify the printer option with the static path neither.

                    Again, my post is just to better understand the way MarkDoc works.
                    Thank you
                    So if I understand you correctly, MarkDoc does indeed create your slides. right? You've got it up and running and now the only question is that why you get a warning?
                    • Logically, you should also receive the warning with static path.
                    • You receive this warning because you have not defined the path to pdfLaTeX on your machine
                    • MarkDoc attempts to discover the paths on your machine, but gives you a warning that you're better off defining it yourself
                    That said, if you receive the error MarkDoc could not produce the ...pdf, then it means it has not created the pdf! or else, there is a bug there.
                    1. Please rerun your code
                    2. erase the PDF file before rerunning the slides
                    3. if you get the warning that MarkDoc could not produce..., and if it does produce the PDF, let me know. That would be a bug. If it does not produce the PDF, then you know what you've got to do.
                    4. But if the only warning you receive is about pdfLaTeX, it means you should define it within the printer() option.
                    5. You should in either way receive a warning about pdfLaTeX. This has nothing to do with the input.

                    Comment


                    • #55
                      haghish maybe it might be helpful to tell users to define an environmental variable pointing to the appropriate binary on their system. Then you could access the binary using an extended macro function, and if the environmental variable returns null throw an error and exit the program? It might make it easier for maintaining the program as well, although the might be a fair number of questions regarding setting up environmental variables that you get.

                      Comment


                      • #56
                        I made it automatic. It's not hard because the "default installation paths" are commonly used for installing LaTeX and Pandoc. But a warning should be given because sometimes the file in the path is not really functioning. And, it also makes debugging easier.

                        besides, Weaver has a long-term memory for memorizing the paths and settings in Weaver and MarkDoc that does not get erased with updating the package or Stata. All that the users have to do is typing weave setup and then:
                        • define permanent path to Pandoc, wkhtmltopdf or pdflatex
                        • etc...
                        Last edited by haghish; 03 Mar 2016, 10:40.

                        Comment


                        • #57
                          Again, thank you for your answers.

                          Originally posted by haghish View Post

                          So if I understand you correctly, MarkDoc does indeed create your slides. right? You've got it up and running and now the only question is that why you get a warning?
                          Yes.

                          Originally posted by haghish View Post
                          • Logically, you should also receive the warning with static path.
                          Yes I also have the warning with static path.


                          Originally posted by haghish View Post
                          That said, if you receive the error MarkDoc could not produce the ...pdf, then it means it has not created the pdf! or else, there is a bug there. [LIST=1]
                          • Please rerun your code
                          • erase the PDF file before rerunning the slides
                          • if you get the warning that MarkDoc could not produce..., and if it does produce the PDF, let me know. That would be a bug.
                          I confirm you that my pdf slides are created (both with static path and with `SavePath' inside the markdoc command).
                          And I confirm you that only for the second case (with `SavePath' inside the markdoc command), I also have the message that MarkDoc could not produce the... pdf (that's why I first thought that the slides were not created):

                          Code:
                          . markdoc `SavePath'/MarkDoc_slidesPDF.smcl, export(slide) replace
                          (The printer option is not defined, but MarkDoc attempts to access pdfLaTeX automatically)
                          
                          (warning! pdfLaTeX not found...)
                          MarkDoc could not produce d:/CATI/MarkDoc_slidesPDF.pdf

                          Originally posted by haghish
                          All that the users have to do is typing weave setup and then define permanent path to Pandoc, wkhtmltopdf or pdflatex
                          I tried the weave setup command, add my pdflatex path, save the weaversetup.ado, discard.
                          Now, no more warning (and no need to specify the printer option which is nice). But logically, in the case with `SavePath', I still have :
                          Code:
                          . markdoc `SavePath'/MarkDoc_slidesPDF.smcl, export(slide) replace
                          MarkDoc could not produce d:/CATI/MarkDoc_slidesPDF.pdf
                          Hope this helps.

                          valérie

                          Comment


                          • #58
                            What about my other (maybe trivial) question I asked about LaTeX output :

                            Originally posted by valérie orozco View Post
                            Is it possible, to use markdoc in a way it considers Stata LaTeX output ? (some command like "esttab" are really appreciated since they allow a synthesis of previous estimations in a nice format).
                            Thank you for your help.
                            In many cases Stata LaTeX output are really nicer than verbatim ones.

                            thank you very much.

                            Comment


                            • #59
                              The error probably happens when MarkDoc tried to "confirm" the exported file by Pandoc. I have to look into the code. But in brief, if MarkDoc cannot access the exported file, even if it indeed is exported by Pandoc or pdfLaTeX, it returns that error. So it seems I should look into the end of the code and see.

                              I wrote you on Twitter I guess. In order to export a TeX output from other packages, all you have to do is to use LaTeX and import the exported file. All you have to do is \input{filename} Calling another file in LaTeX is really common and this is the syntax you need to load the exported files in MarkDoc.

                              Besides, Weaver has a very smart command for merging output. It's probably The Best Solution for adding external HTML and LaTeX files in the document, especially for LaTeX.

                              Code:
                              weave merge using filename
                              This command, which is only available for Weaver package, reads the LaTeX and HTML files, analyze them, and merge them to the document in a way to ensure they do not corrupt typesetting the file. If the HTML file includes JavaScript files or if the LaTeX document includes \begin{document} and \end{document} or loading packages, merging them can corrupt the log. But weave merge takes care of all of that automatically.

                              Comment


                              • #60
                                Thank you for your work and for your answer Haghish. It seems I have to try Weaver.
                                I didn't find any example of Weaver neither on the help file, nor in your website. Do you have some?

                                Comment

                                Working...
                                X