This is a bug which elisp-driven orgers with access to the git
repository can fix quickly.

* Linking to [[a_file.txt][a file with underscore]] in a headline works well with LaTeX export

#+CAPTION: Linking [[a_file.txt][a file with underscore]] in a caption does _not_ work well with LaTeX export.
[[/Path_to_figure/figure.png]]

The reason is because org-export-latex-links processes the figure's
caption with org-export-latex-fontify-headline, which in turn
processes the caption's link (with altered underscores for some
reason). For example,
(org-export-latex-fontify-headline "[[/Path_to_figure/figure.png][a file with underscore]]")
returns
#("\\href{file://./Path\\_{}to\\_{}figure/figure.png}{a file with underscore}" 14 15 (org-attr nil) 15 24 (org-protected t org-attr nil) 24 25 (org-protected t org-attr nil) 25 28 (org-protected t org-attr nil) 28 35 (org-protected t org-attr nil) 35 46 (org-attr nil))

There must be a way to process links (whose path contains underscores) within captions to floats correctly.

Best regards,
Magnus