How do I make a reference to a figure in markdown using pandoc?

前端 未结 6 629
天涯浪人
天涯浪人 2020-12-12 11:08

I\'m currently writing a document in markdown and I\'d like to make a reference to an image from my text.

this is my text, I want a reference to my image1 [h         


        
6条回答
  •  悲哀的现实
    2020-12-12 11:55

    With pandoc-crossref you can cross reference figures with the following syntax:

    ![Caption](file.ext){#fig:label}
    

    Then reference the figure in the text similar to the citation syntax [@fig:label] and compile with --filter pandoc-crossref (needs to come before --filter pandoc-citeproc if you're using that also).

    You can control the styling with e.g. \usepackage[font=small,labelfont=bf]{caption} in header-includes.


    A neat related trick if you use \listoffigures in latex, is this lua-filter, which allows you to set a short title instead of having the entire figure legend showing up in your list of figures:

    ![Caption](file.ext){#fig:label short-caption='my short caption'}
    

    then compile with --lua-filter short-captions.lua.

提交回复
热议问题