Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
581 views
in Technique[技术] by (71.8m points)

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

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 [here]. blablabla

![image1](img/image1.png)

I want to do that reference because after converting my markdown to pdf, images get placed in one or two pages after and the document doesn't make any sense.

UPDATE:

I've tried Ryan's answer in that post and I can't make it working. Apparently the code :

[image]: image.png "Image Title" 
![Alt text][image] 
A reference to the [image](#image).

should produce:

egin{figure}[htbp] 
centering 
includegraphics[keepaspectratio,width=extwidth,height=0.75extheight]{i mage.png} 
caption{Alt text} 
label{image} 
end{figure} 

A reference to the image (autoref{image}).

instead, I obtain:

egin{figure}[htbp]
centering
includegraphics{image.png}
caption{Alt text}
end{figure}

A reference to the href{#image}{image}.

I've noticed two problems :

  • label{image} doesn't appear : no reference is created.
  • (autoref{image}) becomes href{#image}{image} : no cross reference is detected.

And then, when I convert that to pdf it obviously doesn't link to the image. There's a link, but it doesn't link to anything.

Any help would be much appreciated!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In pandoc you can even do:

![This is the captionlabel{mylabel}](/url/of/image.png)
See figure 
ef{mylabel}.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...