9 Replies Latest reply on Jul 29, 2016 5:37 AM by aliceell

    Wrap text so that line break happens after specific word

    aliceell

      This is how my text box looks without a line break:

      allcrashes4.png

      But this is how I want it to look:

      allcrashes3.png

      But that requires me pressing "Enter" after "All Crashes" within the text box. This happens with a lot of text boxes, so it's a slow process to do it manually.

       

      Is there some kind of option that I can enable, or some kind of alignment configuration, that will allow me to force the text box to wrap the text such that "By Day of the Week" appears below "All Crashes" without having to manually push the Enter button each time?

        • 1. Re: Wrap text so that line break happens after specific word
          BarbBinder Adobe Community Professional

          You can add a non-breaking space between "by" and "day"—Cmd Opt X or Ctrl Alt X. Or apply the No Break command to "by day"—found in the Character panel menu and the Control panel menu. In any case, you have to look and make a decision on where to break, so it's the same amount of work as adding a hard return (or soft return) at the end of the line.

           

          There's one other command worth mentioning, although it didn't help this particular string: Balance Ragged Lines. You can build it into a style so that for multi-line heads, instead of one really long line and one short one, they balance. It's under Para Style Options > Indents and Spacing or just in the Paragraph panel menu.

          • 2. Re: Wrap text so that line break happens after specific word
            aliceell Level 1

            That might work, actually.

            In any case, you have to look and make a decision on where to break, so it's the same amount of work as adding a hard return (or soft return) at the end of the line.

            That's okay. I am actually trying to import an XML document to update the data contained in the tables below the text boxes, but each time the XML imports, it screws up the line break. So I was thinking that if I can get all the text boxes to have the same line break setting (which means I would go through and add the No Break style just once for each text box), then hopefully it will be maintained when I import the XML. I just didn't want to have to add the No Break style *every time* I import the XML.

             

            But so far I can't actually get the No Break style to stay when I import my XML, so maybe that's a different problem...

            • 3. Re: Wrap text so that line break happens after specific word
              BarbBinder Adobe Community Professional

              For that, try the non-breaking space between "by" and "day" so that they have to stay together.

              • 4. Re: Wrap text so that line break happens after specific word
                SJRiegel Adobe Community Professional & MVP

                aliceell wrote:

                 

                But so far I can't actually get the No Break style to stay when I import my XML, so maybe that's a different problem...

                If you are using paragraph styles, you could add the No Break to the Paragraph style via Grep Styles.

                • 5. Re: Wrap text so that line break happens after specific word
                  aliceell Level 1
                  ...try the non-breaking space between "by" and "day"....

                   

                  I tried that, but when I export the XML, I get the same problem as when I try to map the carriage return. The No Break space maps as "<Table_title>all CRASHES
BY day of the week</Table_title>" if I don't select the Remap Breaks, Whitespace, etc. option on export. And it exports as "<Table_title>all crashes by day of the week</Table_title>" if I select Remap Breaks, Whitespace, etc.

                   

                  If you are using paragraph styles, you could add the No Break to the Paragraph style via Grep Styles.

                  Yeah, I am looking into the "Tag content according to paragraph or character styles" guide on the InDesign docs. I tried mapping the Table_title tag to the Paragraph Style that I made (which includes the No Break option as you suggested). But it doesn't seem to maintain the paragraph style on export, it just exports as <Table_title>all crashes by day of the week</Table_title> without any kind of style included.

                  • 6. Re: Wrap text so that line break happens after specific word
                    BarbBinder Adobe Community Professional

                    I'm not an InDesign to XML girl, but...

                     

                    &#160; is the non-breaking space character in XML according to

                    Making   work in XML, RSS, and Atom

                     

                    Can you use a text editor to find 
BY  to &#160; in the XML file?

                    • 7. Re: Wrap text so that line break happens after specific word
                      [Jongware] Most Valuable Participant

                      Just a heads-up:

                       

                      aliceell wrote:

                       

                      ... The No Break space maps as "<Table_title>all CRASHES
BY day of the week</Table_title>"

                       

                      This looks like part of your toolchain does not correctly interpret UTF8 encoding – in fact, a No Break Space should be encoded as only two characters (when inspected "raw"), not 3 or more, as you are showing. It is possible this is a case of double decoding.

                       

                      InDesign's XML export is good (not 'brilliant'; it also exports stuff such as Right Indent Tabs and Indent From Here codes as plain binary codes, which it really should not), and I haven't ever had problems with the regular kind of Unicode characters. A good XML toolchain ought to be encoding indifferent; that's quite important if you work with anything more than plain ASCII.

                      • 8. Re: Wrap text so that line break happens after specific word
                        aliceell Level 1

                        [Jongware] wrote:

                         

                        Just a heads-up:

                        ...

                        This looks like part of your toolchain does not correctly interpret UTF8 encoding – in fact, a No Break Space should be encoded as only two characters (when inspected "raw"), not 3 or more, as you are showing. It is possible this is a case of double decoding.

                        You're right about the interpretation issue. I was using XML Marker, but I switched to foxe and it displays fine.

                         

                        The reason I was concerned about its appearance is that I'm using a script to update the XML. It does this by comparing the XML to a separate CSV. The first cell in the CSV should match the <Table_title> tag. Unfortunately, the script (a Python script using ElementTree) is interpreting the non-breaking space character (that BarbBinder suggested), exactly the way it's supposed to: <Table_title>fatal crashes by time of day</Table_title>. But the CSV reads 'fatal crashes by&#160;time of day'. The two don't match, so the XML doesn't get updated.

                        • 9. Re: Wrap text so that line break happens after specific word
                          aliceell Level 1
                          InDesign's XML export is good (not 'brilliant'; it also exports stuff such as Right Indent Tabs and Indent From Here codes as plain binary codes, which it really should not), and I haven't ever had problems with the regular kind of Unicode characters.

                           

                          Can I ask how you normally export XML from your files? What's your process or workflow? I haven't found much on the internet (aside from Adobe's docs) in terms of using Adobe's native XML export as a template for updating the document.

                           

                          [A good XML toolchain ought to be encoding indifferent; that's quite important if you work with anything more than plain ASCII.

                          What would you recommend, then? I'm very open to suggestions!