Script to remove paragraph space before/after
Hello! Search scripts using experts. I format a lot of long documents with many heading styles and am looking for a way to apply local formatting to the Cap according to the following. (Heading styles have space after that so they are separated from the body copy, however, if another position following, it seems better if this space is reduced - this is where some conditional formatting javascript might help).
I need a script that can search all the title 1 followed by the heading 2, and then remove the spacing after the paragraph under the heading 1. And so on, with a heading 3 following the title 2, etc. I have enough knowledge to write all the variations, but I'm unable to find a starting point for this script, if there is a way to do it at all. I don't know it y a. basically, he needs to get all the X of paragraph Style and If that is followed by Y of paragraph Style, and then set the spacing after the paragraph 0. Can anyone here help?
Thank you!!
This should help you get started:
Note stories.item(-1) will give you the first story if there is only one in addition to the main story. Otherwise loop through your stories of tests to ensure that every story has more than 1 point.
var thisStyle, testStyle;
docRef var = app.documents.item (0);
var storyRef = docRef.stories.item(-1);
var paraList = storyRef.paragraphs;
var lastTest = paraList.length - 1;
Repeat to dot matrix
for (var i = 0; i)< lasttest;="" i++)="">
thisStyle =. appliedParagraphStyle.name paraList [i];
paraList [i + 1].appliedParagraphStyle.name = testStyle;
If (thisStyle == 'Title 1' & testStyle == "Title2") {}
.spaceAfter paraList [i] = 0;
} ElseIf (thisStyle == "Title2" & testStyle == 'Titre3') {}
.spaceAfter paraList [i] = 0;
}
}
Tags: InDesign
Similar Questions
-
Right, so I put a document in inDesign to a word document, and it has a space before each first word in a sentence. It's really annoying and I need a quick way to get rid of them. I did not know how to do it with find/replace, but I don't know that there is a way to GREP, if someone can help me. I've included an image so that people can see exactly what I mean.
Your example shows a space at the beginning of each paragraph, which is easy to remove with the ^ character, which means "beginning of the paragraph. If ^ \s will find a single of any kind at the beginning of a paragraph, as in your example. But the word you used was 'sentence' not 'paragraph' which can be more difficult. Surely if you are one of those one-space-after-point, you want to keep this space? What I don't get your example? Maybe your drive is one of those linebreak-at-the-end-of-each-sentence people.
-
How to prune a white space before and after the bookmarks?
Hello
I hope that someone can help me with some JavaScript to remove the spaces before and after my favorites. I know I have to use regular expressions which I think would be ^ [\t]+| [\t]+$ and I also found a code on the internet but it is related to not favorite channels.] How would change this code work for bookmarks? Thank you.
// Trim function trim(stringToTrim){ return stringToTrim.replace(/^\s+|\s+$/g,””); }
First of all, for this code to work, you must use standard double quotes, not the ones you currently have it.
For use on a bookmark, you can do something like this:
var bkm = this.bookmarkRoot.children[0]; bkm.name = trim(bkm.name);
-
If I understand that apple Pages found have no regular expressions, I'm wrong?
Is it possible that I can find and remove a space before an entry?
See the suggestion made by VikingOSX
What is the OS Pages find and replace really really this bad?
Pages for Mac: see formatting symbols and page layout
See more here:
http://www.MacObserver.com/TMO/article/pages-finding-replacing-invisible-CHARACT ers
"The only downside I have is that, if this doesn't seem to work properly for you, try to select your character and then backwards in the menu choose edition > selection of use to find." The shortcut for this is command-E, so you could press command-E, then command + F to jump straight into the 'search box ' with the invisible character you have chosen. This feature also seems a little more picky with the new version of the Pages that the pages ' 09 and you won't be able to so that he can find and replace page or section breaks in this version, just to let you know. "
-
"Space before" paragraph after a Page break
Hello
Here's what I see: the parameter 'space before' to paragraph styles is ignored if the paragraph is placed after a page break or a disconnected page. How can I force InDesign to honor my setting "space before"?
I give you an example: I created a paragraph style called "headline." I applied this style for the section headings and the title of the index. I want to reduce "Headline" a few centimeters from the top of the page, but my "space before" the parameter is ignored. What should do?
Use leading instead of forward space and set the first base line
of your text for 'leader' frames
Substances
-
How to replace the spaces before and after a Word with tabs using GREP or search - replace
Here's the scenario:
I have a paragraph with spaces (can be 1 or more) at the beginning (before the first word) and a single space after the first word (is be a number if this matter - which may be a single digit or more).
I'm looking to replace the spaces before each paragraph with a single tab and replace one tab so of space after the first word (number). In addition, I would like to apply a paragraph style to it.
Thank you very much in advance for anyone who can find a solution. It sounds like a solution of some sort GREP but can't nail. Thank you.
^(\s+)(\S+)(\s+)
and replace with \t$2\t and define the change of setting fit your style.
-
[JS IDCS5] Space before the paragraph if the paragraph style is...
Hello
I have a title paragraph style which has had little space before defined. But when a previous paragraph has had little space once defined, I got twice the spaces between them. Is it possible to generate scripts when the following two some paragraph styles, that one of these styles is moving towards a style without spacing?
Best regards, Sjoerd
This should help you get started - but Sjoerd, there is no way you can "attach" this kind of script to a paragraph style. This is why you must run the script * every * time you changed a style somewhere...
app.findTextPreferences = null; app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("Heading 1"); sourcelist = app.activeDocument.findText(); targetlist = []; for (l=0; l
"+targetlist.length); -
My space before the paragraph looks good in Muse, but in Safari and Chrome it seems practically double visually. Is this a known bug, or is there a workaround or something to check on my end?
The bootstrap css as you seem to have inserted adds a margin at the bottom of each paragraph 10px.
-
Maybe I'm missing something, but it seems to me that if I have a style with a parameter 'space before', for example, 21 p, I should be able to put text into a new text box and have this text with the pop of style applied to the bottom of the page. He does not. I can do work just hit 'enter' and by having a blank line in front of it, but in my mind, this should not be necessary. What I am doing wrong?
This is expected behavior. If the text that spans columns or pages you don't want a space above if a new column begins with a paragraph at the top. Like this one, where you want to the 2nd column to align with others:
-
Import XML removes a space after the xref element
Hello
FM10 is not patched, WinXP SP3
I stumbled on a very serious problem that I am unable to replicate, but not solve. When I import XML (custom), no spaces < xref > following is deleted. I don't know if it's exclusive to elements of reference or any element without content... but for sure, it happens with xrefs.
Here's a zip with the example files with which I am able to reproduce this. The XML file has two < xref > s, separated by 'and '. When you import the XML (using the DTD, the rules and template provided), the space before the "and" is deleted.
http://www.weststreetconsulting.com/downloads/test.zip
I disabled all my personal plugins and all DITA plugins I could find, same thing.
I don't know if anyone has the time to watch it, but I would be very grateful if someone could confirm the problem. This caused a real mess in my source files I can't correct using nonbreaking spaces, but it's really a pain and very suboptimal.
Thank you
Russ
Hi Russ...
This is a known issue for the DITA files and can also be the cause of the problem that you see. This has been fixed in the latest patch, as long as you use a client of import and export which was rebuilt with latest libraries FDK. (No doubt if you use the client by default, it should "work" once you install the update.) I posted this to the framemaker-dita some time ago Yahoo Group...
----------------------
If you use a FM10 DITA (with DITA-FMx or not), you may have noticed that after conrefs inline spaces are missing. Apparently the FM10 introduced certain areas of standardization, which was a little too aggressive.
This can be corrected in a future update, but until you can fix it by doing the following change to the maker.ini file. In the Preferences section, you can change that...
RemoveExtraWhiteSpacesOnXMLImport = we
for this...
RemoveExtraWhiteSpacesOnXMLImport = Off
And all is right with the world once more.
---------------------
I hope this will fix your problems... but I would install the update anyway, since it solves a number of other bugs.
See you soon,.
.. .Scott
-
data DB fusion use spaces before and after some words, space don't show in ID when merged
confuse the topic I know...
CS5... My database (excel file converted into a tabulated TXT file) has some entries where there must be a space before or after the word. And the example is "$1000,00 _" with the reprsenting _ where the space will be. Of course when it is brought in ID as a data merge, these areas seem to be deleted. Is there a way so that it can keep these spaces?
When you select or update your data source, click "View options" in the dialog box. Then check the box to preserve the spaces in the data source.
-
A style of pure paragraph with several spaces before...
Hello
I don't want to use a para style X without changing it (so it remains totally pure: not ' X + ') with different spaces before. And I don't want to change the space quickly and easily with a keyboard shortcut.
Ideas! Thank you.
Ariel,
Excellent!
With you idea and using several NJ, proceed as follows:
I associate a keyboard shortcut for "NJ". So I put the insertion point to the beginning of the first line and play the shortcut!
Very well! Thank you!
-
There is a persistent empty bar under my tab bar. Cannot remove through customization.
The address bar and the button menu '3-bar' has been to space before you moved them to the menu bar? Do you use the extension classic restaurateur theme?
If Yes and Yes, I think you need to find the checkbox in the options of the CTR to remove the Navigation toolbar, since there is no built-in way to remove after removing the icons.
-
Is it possible to spend under the name of the institution (highlighted in yellow), the phone number so when I adjust the spacing before it doesn't move every line? As a special line break?
I hope that you work with paragraph styles, you should do it, use 2 paragraph styles.
Do for each line of its own paragraph in the paragraph style, set the style to another in the following style.
To adjust the distance changes in paragraph styles in the space before and after.
Never use between all double back to force space paragraphs, only work with space before and after.
-
Style grep to remove the space in cells in a table?
CS5.5
I'm working on an annual report - lots of tables and for some reason a space appears before the content of the cell text everty. (Remains of Excel).
I tried to set a Grep style to remove the space in the first instance in each cell.
Can you help me to set a Grep style to prevent I have pain in my arm?
BR Nina Storm
The ^ it will limit to remove spaces at the beginning of a paragraph (or cell). All other areas will remain.
Maybe you are looking for
-
My Calendars iPad2 entries synchronize with my iPhone 6, but iPhone calendar entries will not sync to my iPad2?
-
Plugin from Adobe Reader does not allow to save files
When pdf files are opened in firefox using the Adobe 10.1.12.15 plugin, I'm not able to save them to the disc. The 'save' button at the bottom of the screen of hover, but clicking on it does not any action. Nor do CRT-SHIFT-S or the Adobe menu bar di
-
Microsoft Windows XP Media Center: monitor goes to sleep
Having got my computer repair, where it was running with their instructor, I have connected my computer and when the Tower running and then turned on the monitor the monitor doesn't say _ no monitor input VGA signal go to sleep. Then why she would w
-
Security essentials of MacAfee to
I'm nervous right now running Microsoft Security Essentials and it never found anything. I know my way around computers and all virus checkers that I used over the years have all found something? Then perhaps thinking back to MacAfee?
-
Annoying popup of the new hardware wizard
Just upgraded my virus to a newer program. During the instalation, have uninstalled all unnecessary programs free spyware I had on my computer. When I start it, a "new hardware found" window immediately. Why is this and how can I stop, as he reports