How to append a text var to the page numbers

Learn / Forums / General InDesign Topics / How to append a text var to the page numbers

Viewing 4 reply threads
  • Author
    Posts
    • #102779

      Greetings,

      I have a book document with several articles (sections) that each start from page 1. So output of automatically generated table of content is like:

      article #1 …………….1 to 25
      article #2 …………….1 to 87

      The reason for having each individual article star at page 1 is the articles are generated individually over the course of a year, and at the end of the year we want to bundle them together in a single PDF.

      Normally, the simple way to create a distinction for each article is using section prefixes(e.g. a,b,c,d,…) so the table of content will look like:

      article #1 …………….a1 to a25
      article #2 …………….b1 to b87

      However, we use a unique identifier (something like: 10.1000/123456) which is longer than the maximum number of characters allowed in section prefix (which is 8)

      So ideally, my table of content should look like this:

      article #1 …………….10.1000/123456-1 to 10.1000/123456-25
      article #2 …………….10.1000/123457-1 to 10.1000/123457-87

      Now my question is, how to append a string to the page number, so it can be generated and displayed automatically along with the page number, in index, table of content and page numbers in footers?

      Thanks for your help in advance,
      Kasra

      Footnote:
      This is a more abstract/universal variation of a question I already asked on the forum, which is currently unanswered:(https://creativepro.com/topic/having-dois-in-a-journal-index)

    • #102846
      Peter Kahrel
      Participant

      One possibility is to use short forms of the DOIs (placeholders) as section prefixes and create a table that maps the short forms to long forms. A relatively simple script would have to override the text frames with the page number on to the document pages so that you can expand the placeholder DOI and mark it up for the index. That script should expand those short forms in the toc and in the index.

      • #102853

        Hi Peter,

        Many thanks for the advice. I wonder why Adobe created this artificial limitation for a text field (Section Prefix) creating this complexity in the first place. My nature of work is in a way that I tend to avoid scripts, concerning people who will work on this project after me get in trouble in case future Adobe updates break the code.

        Kind regards,
        Kasra

    • #102854

      Hi All,

      I think I’ve found a not-so-elegant way to fix this:

      First, I create unique section prefixes for each article. Like (§1§,§2§,…,§n§). Just making sure it’s impossible for anybody to have that in their articles.

      Then I generate index, select it and “find and replace” each section prefix with corresponding DOI:

      §1§ Maps to DOI_String_1
      §2§ Maps to DOI_String_2
      …………
      §n§ Maps to DOI_String_n

      And there you have it. No scripting required.

      Please let me what you think.
      Kind regards,
      Kasra

    • #102860
      David Blatner
      Keymaster

      Yes, Find/Change is a good solution. If you have a lot of these, you could use the findchangebylist script or the MultiFindChange add-on from automatication.com to do them all at the same time.

      Personally, I think your avoidance of scripts and plug-ins is a little misguided. True, things can change in the future that break the workflow, but the productivity benefit is so great in using external tools that it is often worth the additional management.

      • #102908

        Many thanks David for the kind advice, I Highly appreciate it.

        Re. scripting, you are absolutely right, however, unfortunately as you know large enterprises have their own restrictions about using software. Namely, policies for avoiding writing custom code, security policies preventing you to install custom-built scripts, record keeping and documentation requirement, and responsibility to not to deviate from the documented/approved standard operating procedures unless you have a very good reason to do so. If I wanted to write code, I could do it by myself or request IT branch to do it, but it doesn’t worth it for something I’ll use exactly once each year.

        Of course, in SME/Non-Government sector that’s a totally different story.

        Kind regards,
        Kasra

        P.S. Also, thanks for those script suggestions. I’ll certainly look into them for my personal projects.

      • #102967
        David Blatner
        Keymaster

        Kasra, I see your point! Yes, many companies “outlaw” add-ons. Oh well. I’m glad you are finding a good solution! :-)

    • #102862

      David,

      When I read this:

      “My nature of work is in a way that I tend to avoid scripts, concerning people who will work on this project after me get in trouble in case future Adobe updates break the code.” [Kasra’s post above]

      and his new answer:

      “I think I’ve found a not-so-elegant way to fix this: …”,

      not mentioning Peter Kahrel uses this way to do it by script, I’m tented to answer that Kasra is only not interested by a “paid” script!

      … But if somebody gives him a for free script, he’ll take it! … Of course!

      Even if Peter’s approach is not totally explained according to me, he’s totally and definitely right! You too! ;-)

      In this way, as each article is a separate file, the use of the “famous” DOI as file name could be the key.

      Knowing that, a script could, playing with the “book”, already mentioned by Kasra:

      0/ keep the page numbering per each doc as 1,2,3,4 … [simple, nothing to do!]
      1/ create a “list” of the DOIs. [simple to be scripted]
      2/ open each doc and update a personalized variable corresponding to the current page number naming as: DOI-1, DOI-2, DOI-3, DOI-4 … [+ save it] [simple to be scripted — could be done separately outside the main script]
      3/ temporary include a prefix section for each doc, as indicated. [simple to be scripted]
      4/ update the book TOC/INDEX including these temp prefix sections. [+ save the TOC/INDEX files] [simple to be scripted]
      5/ replace each temp prefix section by the corresponding DOI. [simple to be scripted]
      6/ remove these temp prefix sections [closing each doc without saving] [simple to be scripted]

      … So, a simple loop simple to be scripted and finally just 1 click to play!

      Personally, I’m not interested to write such a simple but professional solution for free! [I’m going to write it for a client]
      … But I gave you the scenario for free! [to be mentioned!]

      Best,
      Michel, from FRIdNGE
      [email protected]

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
>
Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo