Announcement

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

  • Markstat cross-references

    I am using, and really liking markstat by German Rodriguez to write a short paper. One issue that emerged and that I haven't been able to solve nor found a description for on German's site is how to cross-reference to figures (or tables) throughout the document.

    I want to produce a pdf so the first approach that I have tried is to use some latex syntax of the form:

    Code:
    \begin{figure}
      \centering
      \includegraphics[]{graph1}
      \caption{my caption}
      \label{my label}
    \end{figure}
    Then I try to insert the label in the text calling
    Code:
    \ref{my label}
    Unfortunately, latex does not seem to recognize the cross-reference and shows instead ?? where the label should be.

    I looked in the markstat documentation and I could not find a way to label a graph using the usual markstat syntax to include graphs:
    Code:
    ![My caption](graph1)
    Am I missing something? Shouldn't the latex syntax work? Should I look into how Pandoc handles cross-references instead?

    Thanks for your answers.

  • #2
    Hi Jacopo Mazza. I am glad you liked markstat. To add a label for a figure append a hash and unique identifier in braces:

    Code:
    ![My caption](graph1){#mylabel}
    As long as you are generating PDF via LaTeX, you can refer to the figure using the LaTeX command \ref{mylabel}. Unfortunately this doesn't work in HTML. And even in LaTeX you will need to add the option keep(tex aux) and then run pdflatex on the command line to get the references resolved.

    I have been looking for a more general solution, including numbering tables, figures and equations. So far the best one I have found is Nicolai Yakimov's pandoc-crossref filter, which you can find on GitHub at https://github.com/lierdakil/pandoc-crossref. I am considering adding a numbering option to -markstat- to inject this filter in the processing pipeline, but haven't made a final decision yet. There's always the hope that Pandoc will add native cross-references.
    Last edited by German Rodriguez; 22 Oct 2019, 08:06.

    Comment


    • #3
      Hi German Rodriguez. Thanks a lot! It works perfectly even though I guess you meant to say \ref{my label}. May I suggest though, to add a short discussion of how to cross-reference tables and figures on your otherwise fantastic markstat site?

      Comment


      • #4
        Hi Jacopo Mazza. I guess we both meant

        Code:
        \ref{mylabel}
        For some strange reason, using that expression inline previews fine but turns to ??? when posting. Probably a quirk in the forum handling of LaTeX equations.

        Anyway, I am glad it worked for you. I followed your suggestion an added a note in the documentation and an example using LaTeX cross-references. More to come once we settle on a solution for other formats.

        Comment

        Working...
        X