Skip navigation
Currently Being Moderated

Can you evenly distribute tabs in the Tabs dialog box?

Apr 9, 2008 8:44 PM

Hello.

I work with lots of statistics arranged in columns and separated by tabs in text boxes. The number of columns will vary, but the text box is always the same width. I manually space out the tabs to evenly fill the text box. This is slow. I wonder if there is any way to select all tabs and then evenly distribute them across the Tabs dialog box? Like how you can evenly distribute multiple elements using the Align tool.

The 'Repeat Tab' function is close to what I need, but an 'Evenly Distribute Selected Tabs' would be even better.

Thanks,
/stephen
 
Replies 1 2 Previous Next
  • Currently Being Moderated
    Apr 10, 2008 5:15 AM   in reply to (Stephen_Lording)
    There is no such function. It would have to be made into a feature request for a future version of InDesign.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 7:19 AM   in reply to (Stephen_Lording)
    Ever considered a table?

    The tables can be distributed evenly across columns. Tab delimited data can be readily pasted in with CS3, or by using Dave Saunders PopTabFromClip script for CS/CS2.

    -mt
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 7:20 AM   in reply to (Stephen_Lording)
    I think this script should work now. I have not tested it extensively though...<br /><br />if (app.documents.length != 0){<br />     if (app.selection.length == 1){<br />          var a = app.selection[0].constructor.name;<br />          switch (app.selection[0].constructor.name){<br />               case "Text":<br />               case "InsertionPoint":<br />               case "Character":<br />               case "Word":<br />               case "Line":<br />               case "TextStyleRange":<br />               case "Paragraph":<br />               case "TextColumn":<br />               case "Story":<br />                    main();<br />                    break;<br />               default:<br />                    alert("No text selected.");<br />                    break;<br />          }<br />     }<br />     else{<br />          alert("Nothing selected.");<br />     }<br />}<br />else{<br />     alert("No document opened.");<br />}<br /><br />function main() {<br />     var allSel = app.selection;<br />     var nPara = allSel[0].paragraphs.length;<br />     var allPara = allSel[0].paragraphs;<br />     for (var m=0; m < allPara.length; m++) {<br />          var aSel = allPara[m];<br />          var myTabList = aSel.tabStops;<br />          var lastX = myTabList[-1].position;<br />          var myWidth = lastX - aSel.paragraphs[0].leftIndent;<br />          var myStep = myWidth / myTabList.length;<br />          for (var n=(myTabList.length-1); n >= 0; n--) {<br />               myTabList[n].position =  myWidth+n;<br />          }<br />          for (var n = 0; n<myTabList.length;  n++) {<br />               myTabList[n].position = (n+1) * myStep;<br />          }<br />     }<br />}
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 8:35 AM   in reply to (Stephen_Lording)
    Hello all,
    I could not get Gerald's script to work, but I have a javascript that I wrote that might be worthwhile to the OP. I call it Auto Tab. With the text cursor anywhere in the paragraph that needs even tabs, just double click the script from the scripts pallet and the script will evenly distribute the remaining space between each tab column. Here it is:

    var myIP = app.selection[0];
    var myP=myIP.paragraphs[0]
    var myJ=myP.justification
    var myC=myP.characters
    var myPTF=myP.parentTextFrames[0];
    var myTS=myP.tabStops
    for(t=myTS.length-1;t>=0;t--){
    myTS[t].remove()
    }
    var myD=myPTF.geometricBounds[1]+myPTF.textFramePreferences.insetSpacing[ 1];
    var myContents=myP.contents
    myP.justification=Justification.fullyJustified
    for(i=0;myC.length>i;i++){
    if(myC[i].contents=="\u0009"){
    myC[i].contents=SpecialCharacters.flushSpace
    }
    }
    myP.recompose()
    for(n=0;myC.length>n;n++){
    if(myC[n].contents==SpecialCharacters.flushSpace){
    var myPosition=myC[n+1].horizontalOffset-myD;
    myP.tabStops.add({alignment: 1818584692, alignmentCharacter:".", position: myPosition})
    }
    }
    myP.contents=myContents
    myP.justification=myJ

    Copy the script into ESTK and name it Auto Tab.jsx and save it to the scripts folder. I'm using CS2, so I have not tested it with CS3. I am working on a version that will work for multiple paragraphs by finding the longest text in each column and then evenly distributing the remaining space, but this has proven to be harder for my limited scripting skills than I have time for.
    Regards,
    Len Swierski
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 8:37 AM   in reply to (Stephen_Lording)
    Stephen, I don't know if this will work for your situation, but you can place one tab marker at say .25" and then use the flyout of the tabs palette and use the "Repeat Tab". This will automatically place a tab at every .25 inch.

    Edit: oops, I didn't read down to the bottom of your post regarding repeat tab.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 12:52 PM   in reply to (Stephen_Lording)
    Gerald,

    Like Len, I can't get your script to work either (but I'd *really* like to ;-). Is it by any chance only for CS3? I've tried it in CS2 only.

    FWIW, I'm getting an Error 45 on Line 33, the first "for" statement.

    Thanks,
    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 2:16 PM   in reply to (Stephen_Lording)
    Brad, Len,

    it seemed easier to post the script on my blog: http://indesign-faq.de/index.php/distribute-tabs/

    It works with my CS2 as well as CS3.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 2:38 PM   in reply to (Stephen_Lording)
    Gerald,

    I see now how it works. The tab pallete must be open. This script could be a real time saver in many situations. Great work, Gerald!

    Brad,

    Check to see that you copied the script without adding any extraneous characters or leaving anything out.

    Regards,

    Len
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 10:03 PM   in reply to (Stephen_Lording)
    >The tab pallete must be open.

    Really? I have to test this. Would be rather weird, though.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 6:29 AM   in reply to (Stephen_Lording)
    I'n not sure it's that the tab palette has to be open so much as there have to be tab stops in place already. My earlier errors may have been because I hadn't yet set any tab stops.

    Now I see what your script does, sort of a backward repeat tab, starting with the last stop and moving the previous stops so that they're equidistant from each other.

    I guess what I really would love to see is a mixture of your and Len's script, able to work on multiple paragraphs while also measuring the longest text in each column and distributing things so that there's even space between all columns, with each row filling the text frame.

    Not that anyone asked what I wanted, of course!

    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 6:38 AM   in reply to (Stephen_Lording)
    Brad, do you mean to treat each column as a rectangle and then distribute these rectangular areas? That takes a little more work. You'd have to create a max() function for the columns and think about a strategy what to do with paragraphs that don't fit a line.

    Too much for me at this time...
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 7:03 AM   in reply to (Stephen_Lording)
    That's one way of wording it (treating each column as a rectangle). Len is already measuring the longest line of each column, but his approach only works on one line instead of all selected lines.

    I wouldn't expect this would be useful for tables whose data needs to run to more than one line (in a given row), but more as a way to let the computer do the calculations on simple text with tab stops.

    The table function (with cells and headers and whatnot) just seems like it's more trouble than necessary for simple tables I'm describing.

    Thanks for your script. I'm definitely going to hold on to it and try to use it when needed!

    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 7:44 AM   in reply to (Stephen_Lording)
    Gerald,
    It did seem as though the tab pallete needed to be open, as I got an "object undefined" error when it was not. I still like your script, and it is definitely an enhancement of the repeat tab feature.

    Brad,
    It sounds as if the script I am working on would fit the bill for your particular case. Since I can only devote spare time to scripting projects here at work it may be some time before I can finish it, however. When I do I will definitely post it here or in the scripting forum. It will involve splitting the text from each selected paragraph into an array which would represent each column, creating a new array for each individual column (column 1, column 2, etc.), creating a temporary textframe to test the text length of each item in that array, and then creating the tab positions like my existing script does. It's all very do-able using javascript, but will take me a while before I can get to it and de-bug.

    Regards,
    Len Swierski
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 9:25 AM   in reply to (Stephen_Lording)
    Len,

    I think it was Shane Stanley that once suggested to me that one way to find the width of the text in a particular column would be to change all the tabs to pipes (the "|" character) and measure their positions.

    Of couse, you'd still need an array (I imagine) to compare the measurements in order to find which column in which paragraph is the longest, but I thought I'd mention it.

    Of course, we were talking about AppleScript and the possibility (a remote one, I now realize) that I'd be the one writing it!

    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 10:16 AM   in reply to (Stephen_Lording)
    Brad,

    I use the pipe character for lots of things in my scripts. In this case, it's not necessary if you can get the text into an array and measure the length by creating a temporary textframe (that would be deleted later in the script). As you iterate through each array item, the text contents of the temporary textframe are replaced and measured. One problem with using the pipe character is that no tab character exists after the last text in the paragraph (the last column), although you could probably get that last measurement by finding the last insertion point in the paragraph.

    Good luck if you tackle this using Applescript, and please share your script if you get it to work.

    Regards,
    Len Swierski
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2008 3:35 PM   in reply to (Stephen_Lording)
    It's fairly safe to say that I won't be writing anything like that soon. I was probably working up to asking Shane to write it and he was encouraging me to do it myself.

    I know that if you or Gerald (or Dave or Peter or Harbs) got intrigued by this problem and came up with something, I'd gladly pay a shareware fee ($25?) to add it to my arsenal.

    A general pupose multi-line tab positioner would be real handy for those times when the tables feature is overkill.

    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2008 1:49 AM   in reply to (Stephen_Lording)
    Brad, Len,

    I found the task interesting and came up with this: http://www.indesign-faq.de/wp-content/uploads/2008/04/distribute_colu mns.zip
    It finds the max length of any column and distributes the space between the columns. Tab stops are added as needed.
    It currently works only under CS3 because the way to find the parent text frame was changed from CS2.
    And it is an AppleScript. Not the most elegant code but mostly written in a way you should be able to follow...

    Let me know what you think.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2008 6:05 AM   in reply to (Stephen_Lording)
    Gerald,

    Thanks so much for that. Lest slow-to-upgrade lurkers (like me) shy away from downloading it, it does seem to work (and in fact targets) ID CS2.

    In my quick tests it seems to work quite well. I should mention that in my (far from exausting) tests it appears to always leave a little more than 6 points of extra space at the right edge of the table.

    (My tests all happened to have six columns in them, so maybe that's related.)

    Can't wait to study the code later and try some more tables. Thanks again!

    Brad
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2008 7:10 AM   in reply to (Stephen_Lording)
    The parent text frame change was between CS and CS2. The text frame related change from CS2 to CS3 has to do with the way the text containers that make up a story are addressed.

    Dave
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 12, 2008 8:28 AM   in reply to (Stephen_Lording)
    Ah, thanks Dave. My memory is not what it was...

    The 6pt may have to do with some unclean solution I introduced to get the horizontal offset of the character after the last character. Currently I simply duplicate the last but one character.
    It may have to do with some rounding errors.
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2008 7:30 AM   in reply to (Stephen_Lording)
    Gerald,
    It works for me on CS2. Very good work! The extra points at the end of the line are fine by me since it removes the chance of any possible overset and is not noticeable.
    Regards,
    Len Swierski
     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 7:08 AM   in reply to Steve Werner

    I have been wanting this feature for a long time. I started setting type before personal computers were around and while most things are much better with the computer, a few things that could be done on a tradutional typesetting machine were better.

     

    Distributing text columns evenly is one of them. With the system I used, you type in a command (called 'insert space') and the machine would calculate how much space was needed and distribute it evenly. If you wanted twice as much space in one place you would type in 2 insertspaces, etc.

     

    It seams like this would be an easy calculation for a personal computer but I have not seen it as a feature in and page layout program that I have worked with (other then as some kind of script which I would not feel comfortable using).

     

    I quess it is not something that most people are looking for because I am replying to this 2008 question in 2012. Could it be in CS6? I have my fingers crossed.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 7:12 AM   in reply to R.W. Miller

    rmiller@twill.com wrote:

     

    I quess it is not something that most people are looking for because I am replying to this 2008 question in 2012. Could it be in CS6? I have my fingers crossed.

    As you said, it's not exactly a high traffic request. Uncross your fingers or you'll get cramps -- no change in this area fro CS6.

     

    Did you try the scripts?

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 7:31 AM   in reply to Peter Spier

    I did not try the scripts. As I mentioned, I am "not comfortable" using scripts - haven't learned how to use them would be a more accurate explanation.

     

    Where do I start?

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 7:55 AM   in reply to R.W. Miller

    Scripts are easy, and very powerful, and you don't need any programming knowledge to use them. Just install them (see How to install scripts in InDesign | InDesignSecrets) and double-click the name inthe scripts panel to run them.

     

    You don't have to use the ESTK as suggested above, a plain text editor like Notepad or Text edit is fine (be sure to save as plain text, but add the .jsx extension). Since these scripts are very old, there's a chance they won't work in newer versions, but that can usually be overcome by making a subfolder in the scripts folder with the correct version name and placing an older script into the subfolder. In the case of the second script that would be a folder named "Version 4.0 Scripts" (without the quotes, but case-sensitive). I have no idea waht version Gerald's script was written for, but I've removed the <br \> codes and replaced them with the correct line breaks below if you want to try it:

     

    if (app.documents.length != 0){

         if (app.selection.length == 1){

              var a = app.selection[0].constructor.name;

              switch (app.selection[0].constructor.name){

                  case "Text":

                   case "InsertionPoint":

                   case "Character":

                   case "Word":

                   case "Line":

                   case "TextStyleRange":

                   case "Paragraph":

                   case "TextColumn":

                   case "Story":

                        main();

                        break;

                   default:

                        alert("No text selected.");

                        break;

              }

         }

         else{

              alert("Nothing selected.");

         }

    }

    else{

         alert("No document opened.");

    }

     

    function main() {

         var allSel = app.selection;

         var nPara = allSel[0].paragraphs.length;

         var allPara = allSel[0].paragraphs;

         for (var m=0; m < allPara.length; m++) {

              var aSel = allPara[m];

              var myTabList = aSel.tabStops;

              var lastX = myTabList[-1].position;

     

             var myStep = myWidth / myTabList.length;

              for (var n=(myTabList.length-1); n >= 0; n--) {

                   myTabList[n].position =  myWidth+n;

              }

              for (var n = 0; n<myTabList.length;  n++) {

                  myTabList[n].position = (n+1) * myStep;

              }

         }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 8:20 AM   in reply to Peter Spier

    Thanks, I'll give it a try and let you know. If it doesn't work I guess

    I'm back where I started - wouldn't know how to start to adjust it.

    Maybe I'll have to wait for CS6.5 or 7 or ... your right about the

    cramps, I'll just hope.

     

    Rob Miller

    Twill Printing

    22 Russo Place

    Berkeley Heights, NJ 07922

    rmiller@twill.com

     

    tel 908.665.1700 Ext 20

    fax 908.665.9717

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 8:52 AM   in reply to R.W. Miller

    Well,I tried it but it's a no go. I tried the Version 4 folder but still - no go.

    The error I get is:

    Screen shot 2012-05-07 at 11.22.31 AM.png

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 8:59 AM   in reply to R.W. Miller

    Which script did you try when you got that message?

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 9:09 AM   in reply to Peter Spier

    OK, I see it was Geralds, and it doesn't work for me either, but the other script does something (though I couldn't tell you what exactly).

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 9:30 AM   in reply to Peter Spier

    The only script I tried was the one you sent in your reply.

    Just tried the other one and it kind of works. I guess you set one row, use the script and then continue. It would be nice if you could select all of the copy and run the script. It would then determine wich was the widest column in each row and distribute the whole thing. With this script, I guess you would set a dummy line first using the longest line of each column, run the script and then use those settings to set the rest of the job. Could be better but this is better than what I was doing.

     

    Any recommendations for learning the scripting language?

     

    Thanks for your help.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 9:50 AM   in reply to R.W. Miller

    You should head over to the scripting forum: InDesign Scripting

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 10:26 AM   in reply to Peter Spier

    Thanks again - I'll check it out.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 3:34 PM   in reply to Peter Spier

    Peter, you forgot one line (But without it I got another error than R. did -- it just might be his CS5.5 vs. my CS4.)

     

    Add this

     

    var myWidth = lastX - aSel.paragraphs[0].leftIndent;

     

    on the blank line in between here:

     

    var lastX = myTabList[-1].position;

                                                                        <----- (hey! you forgot me!)

    var myStep = myWidth / myTabList.length;

     

    Note 1. You might still have to place this in a "Version 6.0" folder for it to work in CS5.5.

    Note 2. It distributes existing tabs equally spaced. Was that actually what you wanted?

    Note 3. Huh. No "Code Syntax Highlight" in the General Forum, eh? And also no "Use Advanced Editor" button. "Who needs that anyway?", Adobe Forum Maintenance?

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 3:57 PM   in reply to [Jongware]

    I wonder how that happened. I thought all I was doing was deleting the break codes...

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 5:10 AM   in reply to [Jongware]

    I tried adding the new line and still get the same error as above in line 36 (var lastX = myTabList[-1].position;).

     

    "Note 2. It distributes existing tabs equally spaced. Was that actually what you wanted?"


    Yes, I do want to distribute the columns equally. Ideally, I would like to type the block of copy with tabs (unformatted), slelect that whole block and run the script. The script would analyze all of the text, find the longest line in each column (regardless of which row it was in) and adjust the column width accordingly. It would also allow me to inticate what kind of tab should be placed in each position. It sounds like a lot but it is the kind of thing that was available in typesetting systems almost 30 years ago.

     

    The script that I did get to work (Darin's?) just works on one line and only drops in left tabs. Having to work on one line would be OK - I could manually find the longest columns and use that as a dummy line to setup the tabs but having only left tabs defeats the purpose. I would have to manually change them after the fact and then re-adjust the positions - not much different then what I am doing now.

     

    Is this too much to ask for a script?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 7, 2012 5:08 AM   in reply to Steve Werner

    WHAT!!!!????? There is no such fuction???????????

     

    I am new to InDesign, I am being forced, kicking and screaming by Adobe to use InDesign because they have done away with Freehand. Adobe are evil corporate monpolising monsters.

     

    I am using CS4 for which there is no dedicated support, as there is for CS5 and 6 - thanks for nothing, Adobe.


    I need to quickly and easily evenly distribute tabs on a wine list. Having searched non-existent "Support", I read here with dismay that:

    "There is no such function. It would have to be made into a feature request for a future version of InDesign."

    Are you kidding me? To be able to quickly and easily evenly distribute tabs is NOT available??? A feature request???!!!! InDesign is to be taken seriously, to be able to distribute tabs evenly has to be availabe, as it is in Quark. There are heaps of other basic, simple tools/functions that are also missing, such as being able to collapse a text box to automatically fit the content - on BOTH dimensions, a piece of cake in Freehand - this only works on one dimension in InDesign.

     

    Screen shot 2012-11-07 at 12.45.56.png

    InDesign is a joke.



     

    How's this for a feature request:

    Bring the text handling of InDesign up to the same standards as Freehand: powerful, easy, logical, straightforward, non-clunky, uncomplicated, efficient.

     

    S. Jolliffe

    (One very angry, die-hard Freehand devotee since '95!)

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 7, 2012 5:18 AM   in reply to S. Jolliffe

    Illustrator is the replacement for Freehand, not InDesign.

     

    I'm not clear what you're attempting to do from the screenshot, but

    there is a "repeat tab" option in the flyout menu of the tab palette.

    This will create tabs at equal intervals for the entire width of the

    text frame.

     

    There is also a distribute objects function, which will move objects so

    they are a fixed distance apart, with various options.

     

    Ariel

     
    |
    Mark as:
1 2 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)