Use a decimal tab.
Does anyone know how can I have numbers to be right aligned, so the zeros are all underneath each other. And then center in the table cell.
If you mean centered horizontally, as in center-aligned text, then you choice is aligned numbers (using the tab as Bob suggested, and changing to left aligned) OR centered text. You can't have both because by it's nature centered text varies the left and right distances from the columns edges based on the length of the line.
This is the right path but I have one more questions. I am sorry to be a pain, but I am doing the annual financial report and have not much experience with this numbers, tables, etc...
I have used a left aligned paragraph style that contains the decimal tab on the style, nested in a cell style.I all works.
My question is:
I have lots, and lots of tables with different width columns and the numbers length also are different. Is there anyway I can get the decimal tab X space, which is specified in mm to work for this different conditions? Or I will need to go throught the tables and manually move the tab?
Thanks a lot, I am much happier now, looks there is a light at the end of the tunnel.
You can set the tab postion as part of the paragraph style, so no, you don't need to edit every cell, but you do have to use left-aligned text, and if you want all of the numbers to line up properly you must use a font with Tabular rather than Proportional figures so they are all the same width ( and for tables, lining figures rather than oldstyle are probably also a better choice).
When you look at the tabs formatting options you have left, right, centered, and decimal-aligned (which can actually be any character of your choice, but you want the period). When you use the decimal aligned tab everything you type will behave as if the tab is a right-aligned tab -- it will start at the tab position and move to the left with each added character -- UNTIL you type the character you chose for alignment. From that point on text will move to the right from the alignment. The whole purpose of this is to do things like columns of numbers with decimals.
In a table the tab character is implied, so if the only thing in the cell is your number setting the tab in the style is sufficient and it will just work as soon as you start typing. If there is other text before the numbers that must be hard-left aligned, however, you will have to type that, then manually insert a tab character from the insert special characters menu (or create a new keyboard shortcut for inserting tabs in tables) to force that text tot he left margin and keep the numbers aligned on the decimal. You cannot just hit tab inside a cell to add the tab -- it signals ID to move to the next cell.
It is almost everything working as you said. The only thing is that if I don't enter a number in 'mm' in X (I think this is the period you mentioned), it will not center the numbers. I mean, the "."(this is my tab character) on the numbers are all perfectely aligned beneath each other. But they are also all stucked on the right edge of the cell.
So to clarify the numbers on the cells are left aligned and have the decimal tab, all done in the paragraph style which is nested on the cell style.
Now it needs to move towards the center of the cell. if I enter a number in 'mm' in the X box, I can control the position of the tab and then centereverything in that column. But as I mentioned before my columns and my numbers have different with.
Is there more of a question here? I'm not sure I follow what you are saying.
Any sort of tab needs to have a position set to be effective, so you want to set the position for your . where it should fall in your column of numbers. Unless ALL of your numbers have the same number of digits, both before and after the . you cannot get a true center alignment, and if they do you'll only achieve it by setting the tab position to the correct value (determined by how many digits on either side and the width of teh column), most likely by trial and error.
That is the response I was afraid of.
So in short word, I will have to go through all the table and position numbers!
However the tab does help and I will use it.
You only need to find the right position once, then set it in the paragraph style applied in those cells. All cells will update.
That is the thing.
the tables have different number of columns so the columns have different with.
I have to say that in any table of financial data I've ever seen (and I think that's what you are doing) Text columns would be left aligned and number columns would "appear" to be right aligned (in fact they also are left aligned, but use a decimal aligned tab near the right margin to align all of the numbers). I can't honestly see where you would want any number columns with decimals center-aligned, regardless of width. Is the problem that the number columns vary in width from table to table so you can't set a common tab stop in a style that works in all tables? Can you force all number columns to be the same width and make up any differences in the other columns?
Because the table header is centered, the client reckons it looks odd if the numbers are right aligned and the reader is centered.
I tried before just aliging the numbers right but they don't want this way, so I had to do the centering manually.
If they were happy to have the numbers right aligned I wouldn't even need to use the decimal tab. I could just align right and ads a few mm right inset for the numbers' column.
I don't know how to do a script, but maybe a script that would get the widest entry in the column, get the width of the column and then set the inset of the cell.
Other then a pice of code I think will be pretty hard, as the number and the width of columns vary.
Perhaps the heading on that column should be right aligned also?
We are having the same issues publishing prices in catalogue tables. Basically I need InDesign to centre the longest price in the column and then align everything on the decimal point of that...
We are using data-publishing software which allows us to build catalogues very quickly and manually adjusting anything adds hours onto the publication schedule.
I would be interested to hear if anyone has figured out a script to do this. If I have time I might try and figure it out myself. (The logic would be quite easy - for example if the price is X digits long set the decimal align to Y)