Re: [O] [new exporter] what is the label syntax for LaTeX export?
One problem I am having is that the exported LaTeX replaces the : with a - to become \ref{tab-niceone} which precludes the use of (e.g.) \autoref which would need to know that the thing being referenced was a table by recognising the tab:, no? I am sure there is a good reason for this, can you say why? This is due to one of the few functions that was brought from the old exporter: `org-export-solidify-link-text'. That's because targets (that is ... or #+NAME: ...) have no limitation on the characters allowed in their value, which can lead to problems when translated into foreign code (i.e. an % sign in the target when using the latex back-end). So, the function replaces forbidden characters with hyphens. Besides using filters, a solution might be either: 1. to remove colons from the forbidden characters. 2. to limit the characters allowed in targets and remove `org-export-solidify-link-text' altogether. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] what is the label syntax for LaTeX export?
Nicolas Goaziou writes: One problem I am having is that the exported LaTeX replaces the : with a - to become \ref{tab-niceone} which precludes the use of (e.g.) \autoref which would need to know that the thing being referenced was a table by recognising the tab:, no? I am sure there is a good reason for this, can you say why? This is due to one of the few functions that was brought from the old exporter: `org-export-solidify-link-text'. That's because targets (that is ... or #+NAME: ...) have no limitation on the characters allowed in their value, which can lead to problems when translated into foreign code (i.e. an % sign in the target when using the latex back-end). Thanks for the explanation. So, the function replaces forbidden characters with hyphens. Besides using filters, a solution might be either: (I haven't actually made any progress on a solution using filters. I was expecting it to be a little convoluted though; splitting on the first hyphen and joining on a colon.) Not sure if you are showing me two options you are thinking of implementing here or suggesting two things I can do myself: 1. to remove colons from the forbidden characters. If no backends would mind dealing with a colon (I don't know them well enough to be able to decide) then this would be preferable. 2. to limit the characters allowed in targets and remove `org-export-solidify-link-text' altogether. This option could restrict future backends, or other (future?) latex packages. The first option seems most appropriate because a character should only be restricted if there is a good reason (e.g. a backend would not like it) rather than forbidding every character and only allowing it if there is a good reason to. As to whether my use case is a good reason to allow colons: I have no idea how many people use the \autoref or \nameref thing. Regards, Myles
Re: [O] [new exporter] what is the label syntax for LaTeX export?
Colons are now allowed in targets. Thanks for submitting the suggestion. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] what is the label syntax for LaTeX export?
Nicolas Goaziou writes: Colons are now allowed in targets. Thanks for submitting the suggestion. Thanks a lot Nicolas. In case anyone else finds this useful, here is the filter I'll use to replace \ref with \autoref: (defun my-autoref-filter-link-func (output backend info) (when (and (memq backend '(e-latex)) (string-match ref\{\\(.*\\)\} output)) (replace-match (concat autoref{ (match-string 1 output) }) nil nil output))) (add-to-list 'org-export-filter-link-functions 'my-autoref-filter-link-func) Myles
Re: [O] [new exporter] what is the label syntax for LaTeX export?
Hi Nicolas, Nicolas Goaziou writes: Myles English mylesengl...@gmail.com writes: [..] So, the label tab:niceone exports as \label{tab-niceone}. Is that right or am I using the wrong syntax somewhere? The correct syntax is: [[tab:niceone]] It will allow to move back and forth between the link and the target and it will work across back-ends. Thanks for correcting me. One problem I am having is that the exported LaTeX replaces the : with a - to become \ref{tab-niceone} which precludes the use of (e.g.) \autoref which would need to know that the thing being referenced was a table by recognising the tab:, no? I am sure there is a good reason for this, can you say why? In the meantime I will investigate filters. I only really use \autoref out of laziness anyway so I could just replace the : in all my currently defined labels. The new exporter comes with a cross-referencing system. Another example: 1. item 1 2. itmitem 3 As one can see in item [[itm]], ... will be exported as As one can see in item 2, That will definately be useful. Thanks, Myles
[O] [new exporter] what is the label syntax for LaTeX export?
Hi, If my org file has: #+CAPTION[Here is a table]: A nice table #+NAME: tab:niceone | a | Look at my \ref{tab:niceone}. then M-x org-export-dispatch l L gives me: \begin{table}[htb] \caption[Here is a table]{\label{tab-niceone}A nice table} \begin{center} \begin{tabular}{l} a\\ \end{tabular} \end{center} \end{table} Look at my \ref{tab:niceone}. So, the label tab:niceone exports as \label{tab-niceone}. Is that right or am I using the wrong syntax somewhere? Thanks, Myles
Re: [O] [new exporter] what is the label syntax for LaTeX export?
Hello, Myles English mylesengl...@gmail.com writes: If my org file has: #+CAPTION[Here is a table]: A nice table #+NAME: tab:niceone | a | Look at my \ref{tab:niceone}. then M-x org-export-dispatch l L gives me: \begin{table}[htb] \caption[Here is a table]{\label{tab-niceone}A nice table} \begin{center} \begin{tabular}{l} a\\ \end{tabular} \end{center} \end{table} Look at my \ref{tab:niceone}. So, the label tab:niceone exports as \label{tab-niceone}. Is that right or am I using the wrong syntax somewhere? The correct syntax is: [[tab:niceone]] It will allow to move back and forth between the link and the target and it will work across back-ends. The new exporter comes with a cross-referencing system. Another example: 1. item 1 2. itmitem 3 As one can see in item [[itm]], ... will be exported as As one can see in item 2, Regards, -- Nicolas Goaziou
Re: [O] [new exporter] what is the label syntax for LaTeX export?
On 5 nov. 2012, at 23:18, Nicolas Goaziou n.goaz...@gmail.com wrote: Hello, Myles English mylesengl...@gmail.com writes: If my org file has: #+CAPTION[Here is a table]: A nice table #+NAME: tab:niceone | a | Look at my \ref{tab:niceone}. then M-x org-export-dispatch l L gives me: \begin{table}[htb] \caption[Here is a table]{\label{tab-niceone}A nice table} \begin{center} \begin{tabular}{l} a\\ \end{tabular} \end{center} \end{table} Look at my \ref{tab:niceone}. So, the label tab:niceone exports as \label{tab-niceone}. Is that right or am I using the wrong syntax somewhere? The correct syntax is: [[tab:niceone]] It will allow to move back and forth between the link and the target and it will work across back-ends. The new exporter comes with a cross-referencing system. Another example: 1. item 1 2. itmitem 3 As one can see in item [[itm]], ... will be exported as As one can see in item 2, I had not fully realized this, this is great Nicolas! - Carsten Regards, -- Nicolas Goaziou - Carsten