Rob Stewart
Rob Stewart

Reputation: 1842

Display of bad cross-referenced Section headers in PDfs exported by org-mode

Take an example when I attempt to cross-reference a header in org-mode that does not exist. When I export an org file to LaTeX, it does not generate a ref, but instead a texttt. For example:

* Foo

Detail X is in Section [[Bar]]. Detail Y is in Section [[Baz]].

* Bar

This exports to:

\section{Foo}
\label{sec-1}

Detail X is in Section \ref{sec-2}. Detail Y is in Section \texttt{Baz}.
\section{Bar}
\label{sec-2}

When I am using the :export: and :noexport tags to export only parts of my org document, any "bad" cross-refs (i.e. that reference a non-exported heading) are transmored into verbatim with texttt. When those headings are long, the resulting bad cross ref looking ugly.

Question: can I instead tell org-mode just simply export \texttt{??} for a bad cross-referenced heading? This would make it look consistent with broken bibtex citations.

Upvotes: 0

Views: 155

Answers (2)

fniessen
fniessen

Reputation: 4506

As already said, you can configure the variable to sthing other than \texttt. What I use:

(setq org-latex-link-with-unknown-path-format "\\colorbox{red}{%s}")

Upvotes: 0

NickD
NickD

Reputation: 6412

Check this variable out:

org-latex-link-with-unknown-path-format is a variable defined in ox-latex.el. Its value is \\texttt{%s}

Documentation: Format string for links with unknown path type.

Upvotes: 1

Related Questions