11 Replies Latest reply on Jul 19, 2015 5:50 AM by Obi-wan Kenobi

    Replace text in variable

    akribie Level 2

      Hi

       

      Indd CS6 under Win7 x64 Pro

       

      Laying out a book. Picking up chapter name from style into variable to place chapter name at top of subsequent RH pages.

       

      Problem: I want to split the main chapter name onto 2 lines, but to have the variable replace the line break with space hyphen space so that the whole chapter name appears on subsequent pages on as single line.

       

      Can this be done automatically?  If so, how?

       

      Thanks for any help.

        • 1. Re: Replace text in variable
          Peter Spier Most Valuable Participant (Moderator)

          Variables don't break across lines, so the only way to do this is with two variables (and a manually typed hyphen). You can apply two character styles to the parts you want separated and use running header (character style) variables.

          • 2. Re: Replace text in variable
            akribie Level 2

            Thanks for the thought. Unfortunately some chapter headings don't need a line break so I guess the only way is to have two templates for the different chapter types using the two styles as you suggest for those that do break.

            • 3. Re: Replace text in variable
              Eugene Tyson Adobe Community Professional & MVP

              I've done what Peter suggests on a 3200 page book. It worked great and you don't need extra styles.

               

              Style your Paragraph Heading using Nested style, find an upper limit for your 1 line of text, set your nested style to include the first say 30 characters, and this applies a character style.

               

              Then set another character style for the 2nd line and apply that through the nested style.

               

              Setup your variables to be

               

              Running Head Line 1 - based on character style line 1

              Running Head Line 2 - based on character style line 2

               

              The document I did this on was very complex, the running headers had 4 different running headers on each page (8 different running heads per spread) that changed constantly. Working this way I was able to do it.

               

              Alternatively there's a plugin that does this even better

              Power Headers | in-tools.com

              • 4. Re: Replace text in variable
                TᴀW Adobe Community Professional & MVP

                Many ways to skin a cat, but I don't see a major problem here:

                 

                If your chapter title breaks over 2 lines, include the space-hyphen-space at the end of the first line, and colour it with the None swatch so it's invisble (if it's messing up your centering, make it very small).

                 

                Break the chapter titles with shift-return rather than a proper paragraph break so it's all a single paragraph.

                 

                That's it: The text variable will pick up the contents of the chapter title, but not the formatting, so in the text variable the hyphen will be visible.

                • 5. Re: Replace text in variable
                  akribie Level 2

                  OK.  Thanks to your initial steer, I have a neat answer.

                   

                  By creating a separate style for Chapter sub-head and a separate variable to pick up that text plus using the option in the text variable definition to include leading text., all work transparently. If there is no sub-heading then the initial text doesn't appear in the running head, which is exactly what I wanted to achieve.

                   

                  Thanks very much for your help.

                  • 6. Re: Replace text in variable
                    Obi-wan Kenobi Adobe Community Professional

                    Hi,

                     

                    To manage this game [without Power Headers I truly recommand], you can:

                    1/ insert 2 nested line styles associated to the 2 char styles;

                    2/ use grep researches to convert these 2 NLS in current char styles;

                    3/ insert a space at the end of the para if only one line.

                     

                    So, it can be done in 1 click using Multi-Find/Change! 

                    • 7. Re: Replace text in variable
                      Eugene Tyson Adobe Community Professional & MVP

                      User marked their own answer as correct - however it's the same process as I outlined earlier... hmmm

                      • 8. Re: Replace text in variable
                        akribie Level 2

                        User did not mark answer as correct. Forum did that automatically. Hmmmmmmmmmmmmmmmm.

                        • 9. Re: Replace text in variable
                          Peter Spier Most Valuable Participant (Moderator)

                          Or some staff wonk....

                           

                          As the OP you can fix it if you like, or if you ask me to fix It as a moderator I have that power.

                          • 10. Re: Replace text in variable
                            akribie Level 2

                            Now they're all marked as correct. I give up. Please sort it.

                            • 11. Re: Replace text in variable
                              Obi-wan Kenobi Adobe Community Professional

                              Eugene,

                               

                              Sorry! If I understand well, you use "nested styles", not "nested line styles" … and you use a limit, e.g. 30 chars!

                              Right? 

                               

                              Capture d’écran 2015-07-19 à 12.09.53.png

                              Capture d’écran 2015-07-19 à 12.10.13.png

                               

                              Can you make a screenshot of your nested styles para style option? Thanks!