Hi, I can include <$linkID> in the internal link suffix on compile, however, custom fields like <$custom:Label> are not being replaced. When I put some special character at the end of every link by hand and have it find-replace it by <$custom:Label> on compile, it is rendered as expected. However, I would like to have Scrivener suffix every link automatically with the custom label of the linked document for LaTeX referencing purposes and still have the document title as the link text in my Scrivener documents. Is this possible? Thanks!
Hi, Iâm trying to restate my question in order to make it clearer ⊠Maybe someone has a clue or could direct me to how to suggest this as an improvement for a future version?
When I insert an internal link, its text defaults to the binder title which is good so I can easily see where it goes without any clicking and checking:
See also section Special Remarks on Referential Structures.
However, I would like to export to text-based formats that handle cross-referencing automatically. So, instead of the title of the linked document, I would like to have an output like this:
See also section \vref{remarks_referential_structures}.
So, I have defined a custom field called Label in the linked document in the example and filled it with âremarks_referential_structuresâ. Then, I can change the text of the inserted link to
See also section \vref{<$custom:Label>}.
However, this way, I donât immediately see anymore where the link goes when I am editing the document in Scrivener.
Now, I can add a prefix and a suffix on compile, so I would just use \vref{% as a prefix â so the title is commented out in LaTeX for example â and \n<$custom:Label>} as a suffix, so a new line is started (ending the comment) and the label is put out. However, the placeholder <$custom:Label> unfortunately is not being rendered, it is just output as text.
This is strange, as the following (kind of tedious) way of doing it does work: When I manually suffix the link with some weird sequence like so âŠ
See also section Special Remarks on Referential Structures@@@.
⊠and then replace that sequence with <$custom:Label> on compile, the placeholder is rendered.
Also, if I use <$linkID> in the internal link suffix, that works, it is being rendered. But it doesnât work with my neat custom field.
Any clue? Or any directions as to how I might suggest this as an improvement for the next version?
Have been playing around with the compiler for a few months now and this is the one thing which feels very inflexible. I think it makes a lot of sense when working with Latex to have qualified identifiers for cross-references.
In my case, I want to compile and export my project to keep working on overleaf. So even something like $title_no_spaces would help a lot.
Is Label a custom metadata field, one you created? If itâs the Label field always present in every project, then it isnât custom, and custom:Label wonât work for it.
I understand it as a custom placeholder and it works fine when using it as a replacement, just not in the specific prefix field for internal links.
Thatâs not what I asked. If <$custom:Label> doesnât work, itâs because youâre using the built-in Label field, not a metadata field you created. Custom metadata fields are called custom because you create them.
Use <$Label>.
So a couple of things to make clear from the start:
-
The automatic link conversion to markup system is indeed somewhat limited. Whether that can be improved is a matter for development to take a look at. I donât see a good usage reason for there being a limitation, but it could be that running the full placeholder engine in many separate fields is taxing on resources or something, as it tends not to be done.
-
So with that limitation in mind, the way the LaTeX template was designed is so those that prioritise a cleaner writing environment over the quality of the final product can just use ânormalâ linking mechanisms to refer to things. Since all we can do is generate numerical sequencing labels, thatâs how it works, and we use the âscrivauto:â label prefix to set these automatically generated links apart.
For cases where you want to create your own labels and more easily link to them, there are better approaches than leaning on the Markup paneâs hyperlink system, and something along the lines of the â@@@â example above is how I would implement it. For example, we could type in âName of Sectionâ, select the entirety, and drop âName of Sectionâ onto it to link to it. Then we would set up a replacement that looks for these delimiters and converts the result to \autoref{<$custom:Label>}
, which given how the placeholder system works with links, would pull the custom âLabelâ field from the link target into the syntax.
You would need to delete the contents of the link prefix/suffix fields in the Markup pane to avoid interference with this approach, so it is a bit of an all-or-nothing decision. Personally speaking, this is the route I would take, I would prefer full control over the label and set up a sequence of replacements or styles to handle the prefixing and suffixing of syntax around markers in the text.
And yeah, the <$title_no_spaces> placeholder is often nice for this as well, if you donât want full control but just want something better than âscrivauto:57â.