How to link between Scrivener documents with traditional style hyperlinks?

I am familiar with the double bracket [[< document >]] method for linking between Scrivener documents which is immensely useful in my Scrivener-LaTeX project.

The results I’ve seen of the double bracket [[ < document > ]] method that I’ve used so far, however, results in additional output text that is longer than a typical hyperlink to an external object would be. The pre-compiled text:

< document >(\autoref{scrivauto:81})

that once compiled looks like:

< document >(subsection a.b.c…)

with the text subsection a.b.c… hyperlinked instead of just:

document

My question is: Is there any way to create a link between Scrivener documents that look more like a traditional hyperlink (to an external object) that does not have the extra “(subsection a.b.c…)” but still hyperlinks the Scrivener < document > text instead ?

The reason for asking is that I’d like to use the shorter hyperlink-style document links between my Scrivener documents in a few tikz graphics where space is at a premium, e.g.:

image

The above PDF example shows two instances of links between Scrivener documents in my project. In the above example, I’d like to hyperlink the words “Revenue Inertia” and “Imports” to other documents within my Scrivener project without having the hyperlinked text “subsec-tion 4.2.7” and “subsec-tion 4.2.6” appear in the tikz graphic bubbles. This would allow me to reduce the size of each of the two bubbles for “Revenue Inertia” and “Imports” (and others like them) to make room for more bubbles, and still be able to fit everything on the same page.

Is there a trick to this that I’m not aware of? Or, is there something that (should be obvious to me) I’m missing ?

Any and all thoughts are welcome.

Thank you,
scrive
:thinking:

If I recall correctly, you are using a highly modified version of the LaTeX Non-Fiction starter project, correct? I’m not sure what else would be generating the syntax you describe at any rate, since nothing in Scrivener would know how to do that itself.

Whatever the case, where you likely need to go is in the Markup compile format pane, where you can customise syntax output for a few different kinds of rich text features. You have full control over link syntax.

1 Like

Yes, that is correct! It started out as the Scrivener ‘vanilla’ General Non-Fiction (LaTeX) version, but lots have been added since. However, I am not sure what exactly may driving the compiler to create the type of links I am seeing, e.g. < document >(subsection a.b.c…) whenever I use the double brackets [[< document >]].

I’ll need to have a look at the:

that you mentioned, but I don’t have a clue at this point as to what to do.

That’s good to know. Now I just need to learn how exactly I can control what I am seeing in those ‘tikz bubbles’.

Thank you for your help … Can you point me to the section in the Scrivener Manual where I might read up on the ‘Markup compile format pane’ and possibly some Scrivener coding examples ? Are there any postings here that deal with the ‘Markup compile format pane’ ?

Update: I see the ‘Markup compile format pane’ discussion in the “24.10 Markup” section, beginning on page 649. Let me have a read and get back to you if I have more questions. Thanks again!

Thanks again for all your help,
scrive
:thinking:

I’m stumped …

A reading of the ‘Markup compile format pane ’ discussion in the “24.10 Markup” section, beginning on page 649 of the Scrivener Manual, has left me confused.

The section on Internal link prefix and suffix in the “24.10 Markup” section on page 650 of the Scrivener Manual refers to the “1138 placeholder” for which I cannot find any description or reference, anywhere, either in the Scrivener Manual or on the internet. Nothing.

I’m at a loss as to how:

And, I’m embarrassed to say that I have NO idea where the Markup compile format pane is located …

I’m stumped … no closer to understanding how to control how my internal document links appear within my tikz diagrams.

Any and all thoughts or suggestions would be welcome and appreciated.

scrive
:thinking:

Oops, I forgot to escape the placeholder in the manual, so it ended up printing the actual value associated with that section—i.e. what you’d use in the link syntax to identify this section. It is <$linkID>, which you will see in use once you’re in the right place. You’ve probably seen that placeholder in Section Layouts as well, where the labels you will be pointing refs to are created, of course.

The Markup compile format pane, like all of the other sections listed in this chapter of the user manual, are found within the Format designer window.

There is of course an example in the LaTeX template itself, which as I said previously, is what is generating the current link behaviour. You can see how it is used and alter it to what you need. As you will note from that example, it is not necessary to encapsulate the link text with a prefix and suffix. We are only using the suffix to add a parenthetical cross-reference after the text of the link. It sounds like you will want to create an actual hyperlink over the text though, and so you’ll need both prefix and suffix.

Hi AmberV,

Scrivener is such a unique, special platform for writers like myself who, having started from ZERO, can create amazing documents. This is due, in large part, to the incredible support afforded neophytes like myself on this Scrivener website. Having NO prior knowledge of Scrivener, I am eternally grateful for the amazing documents that Scrivener has allowed me to create thus far.

Re your suggestion regarding the creation of:

any thoughts on what coding I might insert into the “Internal link prefix and suffix:” fields in the ‘Format designer ▸ Markup’ window to create the ‘internal hyperlink’ style I’m looking for, e.g. with hyperlinked text to internal documents (but w/o the \autoref text), would be appreciated.

The LaTeX \autoref command that is present in the ‘Format designer ▸ Markup ▸ Internal link prefix and suffix: ▸ suffix’ field is a well documented LaTeX command, so I can learn about if/how/when to use the command.

When I search for “scrivauto” (which I assume is Scrivener-only syntax) in the Scrivener Help field and in the Scrivener Manual, however, the result is ‘No Results Found’ for both, so I’m not sure what to do or where to look for help.

Any and all thoughts, ideas, suggestions or solutions greatly appreciated!

scrive
:thinking:

You would find this ‘scrivauto’ phrase used in the template’s original help file, if you still have it. You are aware of how you can add a prefix to your labels in LaTeX, I’m sure, and that’s all it is. I wanted to use something unique to any label Scrivener itself is automatically generating, to set them apart from any prefixes you as the writer would want to use, to help categorise labels. It would of course be nicer to use more specific prefixes, like chap:, table:, sec: and so forth, but since the link syntax itself is static text, you couldn’t really pull that off with automation of Scrivener’s internal document links.

As for how to make cross-refs in LaTeX that use a Web-style clickable text approach, autoref is a macro added by the hyperref package, which itself has a variety of different ways to link text. I’ve never actually made links like this in a document, so I have no idea how well it works in practice, specifically for something as potentially picky as this kind of layout you’ve displayed, but I believe this is what you want:

\hyperref[label]{visible text}

Thanks for the kind words! :smiley:

Hi AmberV,

As for the kind words, you and the entire Scrivener staff are entirely welcome! And, I’d like to thank you in particular for ALL of your help!!

Something that I did not realize until just now is:

I don’t know how to search in my Scrivener project for internally-linked text that I have created using the double-brackets syntax before and after the [[ text ]] that I am linking.

Once I insert the double-brackets before and after the text that I want linked [[ text ]] , the brackets themselves disappear once I hit enter. This leaves me with no way (that I am aware of) to search for the internally-linked text where I have used the double-bracket [[ text ]] nomenclature.

Is there another way that I can search for those instances where I have created internally-linked text?

Thank you again for ALL your help and assistance!
scrive
:thinking:

Hi AmberV,

Following along with your suggestion to use:

\hyperref[label]{visible text}

to create the internal links, I’m still stuck.

So far I’ve run three tests using variations of the code you suggested in the ‘Format designer ▸ Markup ▸ Internal link prefix and suffix: ▸ prefix’ field, in an attempt to create internal document hyperlinks. I may be getting closer, but I’m still not able to create internal document links that work. The three prefix codes I’ve tested in the prefix field include:

prefix code: \hyperlink{<$linkID>}{
image

prefix code: \hyperlink{scrivauto:<$linkID>}{
image

prefix code: \hyperlink{\autoref{scrivauto:<$linkID>}}{
image

The result is that hyperlinks ARE created, but they all point to the beginning of the document, NOT to where the relevant sections are located in the document.

Any and all thoughts, ideas, suggestions or solutions greatly appreciated!

What am I missing?

scrive
:thinking:

Well you’re definitely going to need the middle one, since \hyperlink{21} isn’t a valid label and wouldn’t be defined anywhere. Scrivener is only going to be defining \label{scrivauto:21}.

The result is that hyperlinks ARE created, but they all point to the beginning of the document, NOT to where the relevant sections are located in the document.

As to that, I don’t have the first clue. You’ve got a lot of variables going on that I don’t have experience with. It sounds to me like the sort of thing that I would figure out in a short and simple .tex file though, and then bring what I discover back into Scrivener.

At first, I was not sanguine about your suggestion to create a short and simple .tex file. The more I thought about it though, I realized that with over 12K lines of code in my project (that takes 10+ minutes to compile), perhaps I need a small TestProject to work out issues like the one I’m having with hyperlink-style internal links.

Starting with the General Non-Fiction (LaTeX) template, I’m reconstructing a much scaled-down TestProject to quickly run through whatever permutations I can think of to create the hyperlink-style internal document links that I am looking for.

Regarding an earlier question I had (posted above):

I found the relevant discussion in section 10.1 Linking Documents Together of the Scrivener Manual regarding how to locate links in a Scrivener project:

Works like a charm!

Thank you for your suggestion!
scrive
:thinking:

At first, I was not sanguine about your suggestion to create a short and simple .tex file. The more I thought about it thought, I realized that with over 12K lines of code in my project (that takes 10+ minutes to compile), perhaps I need a small TestProject to work out issues like the one I’m having with hyperlink-style internal links.

Exactly! When I have to “debug” a problem in the user manual it would just take way to long to get anywhere with the problem as it takes me about 15 to 20 minutes to get from clicking compile to opening a PDF. There are various tactics I can use to minimise that, such as using a Collection to filter out what compiles, so that I’m only proofing say one single subsection. That’s usually good enough, but when I’m nailing down stuff like optimising under/over-full hboxes, I just work in the .tex and bring any such optimisations back into Scrivener.

Glad you found that link finder tool! I thought I had mentioned it when I responded, but it must have ended up never leaving my head.

Hi AmberV,

Your suggested solution:

for creating hyperlink-style internal document links in Scrivener turns out was spot on.

I misinterpreted your suggestion and substituted curly-brackets { } for the square-brackets [ ] immediately following the \hyperref command.

My BAD!

For those that may be interested, there is a link to a discussion on StackExchange regarding the use of the LaTeX \hyperref command for Making clickable links to sections with hyperref.

If I had followed your suggestion to the letter (or in this case, the type of bracket) this would have saved me three days of time and trouble.

Silly me!

This is what I am seeing now for the links that I outlined in an earlier posting (on Sept 5):

Thank you again for all your help,
scrive
:thinking:

P.S. And thanks as well for your suggestion to create a mini test project to quickly cycle through all the permutations of how to use the \hyperref command (which it turns out I did not need to do if I had just followed your directions in the first place) !

1 Like

I’ve spent the better part of a week on the topic of how to construct traditional style hyperlinks between (e.g. internal) Scrivener documents when using the double-bracket method [[< text >]] to create an internal Scrivener document link between Scrivener sections.

So I thought of closing out the topic with a summary of the suggestions from AmberV that worked. (Thank you AmberV!!)

In the original General Non-Fiction (LaTeX) template that is part of the initial Scrivener installation, the “Internal link prefix and suffix:” fields in the ‘Format designer ▸ Markup ’ window contain the following code:

Internal link prefix field: (Empty)
Internal link suffix field: " (\autoref{scrivauto:<$linkID>})"
{Note the leading space before (\autoref …}

This generates an internal Scrivener document link presented in my Sep 6 posting where the selected texts “Revenue Inertia” and “Imports” (where I’ve used the double-bracket method [[< text >]] to create an internal Scrivener document link between Scrivener (sub)sections) are not hyperlinked.

Instead, a separate hyperlink to the appropriate (sub)section is enclosed in parenthesis. To repeat, the texts “Revenue Inertia” and “Imports” below are NOT hyperlinks! Only the texts “subsection 4.2.7” and “subsection 4.2.6” are hyperlinked.

Following along with AmberV’s suggestion, to create an internal Scrivener document link with hyperlinked-text (using the double-bracket method [[< text >]] to create an internal Scrivener document link between Scrivener (sub)sections) requires the following code in the “Internal link prefix and suffix:” fields in the ‘Format designer ▸ Markup ’ window:

Internal link prefix field: “\hyperref[scrivauto:<$linkID>]{”
Internal link suffix field: “}”

which creates the desired hyperlinked text behavior with the following result when the cursor hovers over the hyperlinked text:

Note that the texts “Revenue Inertia” and “Imports” above are NOW hyperlinks with the corresponding hyperlinked section of the text presented in the rectangular preview box when the cursor hovers over the hyperlinked “Revenue Inertia” text! Yea!

Thank you AmberV for ALL your assistance !

HTH,
scrive
:thinking:

2 Likes