Help with inDesign Tagged Text

Everything related to our flagship word processor.
macduffee
Posts: 15
Joined: 2009-04-28 09:09:13
Location: Minneapolis, MN

Help with inDesign Tagged Text

Post by macduffee »

Hi,
Our company has used Nisus since 1988. We use it primarily to code text for large book projects. We use the powerfind/macro functions to find patterns and type styles and then code them to flow into QuarkXpress, using xpress tags. Nisus Writer 6.5 has served us flawlessly for as long as I can remember. We have continually upgraded our product throughout the years but have continued to use 6.5 due to the fact that we have so many macros saved that we can reuse and we know the GREP language. I have been slowly learning the new language used in Pro 1.2 and I'm having no problem adjusting. We are also making the switch (or our clients are) from Quark to inDesign. Here's my problem: After I insert my inDesign tagged text formatting the text document is not recognized by inDesign, it flows in with the codes still visible. If I take the same document and open in Word and save as text, it is then recognized with no problem. I can also open into 6.5 and save and it is recognized as well. I'm assuming that there must be some kind of invisible character that is interfering with the inDesign tagged text recognition. Please help! It hurts to have to open up Word, ever!

Many thanks!
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Help with inDesign Tagged Text

Post by martin »

I have no experience with this kind of InDesign import, but I have one stab in the dark.

I assume you are saving the file from NWP as plain text- have you tried different text encodings? Perhaps InDesign only imports a particular encoding. Since saving text from Classic works, I might recommend you try "Mac OS Roman".
macduffee
Posts: 15
Joined: 2009-04-28 09:09:13
Location: Minneapolis, MN

Re: Help with inDesign Tagged Text

Post by macduffee »

Martin,
Thanks for your reply. Yes, I have tried all encodings. UTF-8, -16 and ASCII all insert incorrect characters for quotes and apostrophes, by the way. Western Mac OS Roman is the only encoding that will preserve these characters. Is there perhaps some invisible data from the header, that could interfere? While I have your attention. When I'm done with my coding for inDesign, I need to add a line of type on the first line. In 6.5 I used:
Jump "1"
Key <ASCII-MAC>
Key
There is an invisible paragraph icon after Key on line three above.

My fix for now in Pro 1.2 is:
Select All
Select Start
Insert Newline
Insert Text "<ASCII-MAC>"
Select End
Insert Newline
There has to be a better way, no?

Thanks again!
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Help with inDesign Tagged Text

Post by martin »

macduffee wrote:Yes, I have tried all encodings. UTF-8, -16 and ASCII all insert incorrect characters for quotes and apostrophes, by the way. Western Mac OS Roman is the only encoding that will preserve these characters.
That's because curly quotes are represented differently in those encodings. If InDesign imports them improperly then it isn't detecting the text encoding used in the file. I don't know how you tell InDesign what text encoding a file is using, or if it's even possible.
Is there perhaps some invisible data from the header, that could interfere?
Only for some UTF encodings, which can include a byte order marker (BOM) at the very start. Mac OS Roman has no such header data.

Code: Select all

Select All
Select Start
Insert Newline
Insert Text "<ASCII-MAC>"
Select End
Insert Newline
There has to be a better way, no?
The most succinct would be:

Code: Select all

Set Selection 1, 0
Type Text "Whatever\n"
If you really need to have that first newline selected, then use:

Code: Select all

Set Selection 1, 0
Type Text "Whatever"
Insert Newline
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Help with inDesign Tagged Text

Post by martin »

Wait, are you literally inserting "<ASCII-MAC>" at the very start of the document? That could be the key right there. I don't know anything about InDesign markup, but it seems to me that's telling it what text encoding to expect. Although "ASCII Mac" is a bit nonsense, it's probably InDesign's way of specifying the Mac Roman text encoding, which is why quotes are mistranslated if you save the file using any other encoding.
macduffee
Posts: 15
Joined: 2009-04-28 09:09:13
Location: Minneapolis, MN

Re: Help with inDesign Tagged Text

Post by macduffee »

Martin,
Thanks, I knew there was a better way. I normally would have tried to have the \n inserted as a return and not literally but I was referring back to my 6.5 macros where the return was the actual paragraph icon and not the code. The manual, by the way does not have the quote marks surrounding the text you want entered:
Commands
Modifying Text
These commands all modify text in the active document.
Type Text text
Insert Text text
Replaces the currently selected text with the text provided. The inserted text uses the attributes that were applied to the selected text. The “Insert” command selects the inserted text, while the “Type” command places the caret after the inserted text.
ASCII was the first encoding that I tried, with no luck, plus the ASCII encoding stripped all quote marks. This is from the inDesign Tagged Text manual:
Start file and definition tags
When you export text as tagged text, the text file includes a start tag that describes the encoding format (such as <ASCII-WIN>) and a color table tag (<ColorTable>) that defines the colors, tints, and gradients in your document. If you use paragraph and character styles, variables, table and cell styles, or defined lists in exported text, definition tags for those items appear.
Note: If you create a tagged text file from scratch, you must include a tag that describes the encoding format (such as
<ASCII-MAC>) at the beginning of the text file. You must type the following text at the top of a text file you want InCopy
to treat as tagged: <ASCII-WIN> for files created in Windows or <ASCII-MAC> for files created in Mac OS. If you use
an encoding format other than ASCII, insert the name of that format in place of ASCII (for example, <UNICODEMAC>).
What encoding would you suggest I try for Western (Mac OS Roman)? I tried <Western-Mac> and <WesternMac>. I really don't think that is the problem, though. since I can save in Word or 6.5 and it works with no problem. I have to think that there is some character that is getting in the way of inDesign seeing the Definition Tag. But I'm willing to try anything.

Thanks again for all your help, have a great holiday. We can continue on Tuesday.

Duff
Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Help with inDesign Tagged Text

Post by Kino »

According to http://support.adobe.com/devsup/devsup. ... /54161.htm, <ASCII-MAC> requires CR (\x0D) as End of Line code. However, NW Pro uses LF (\x0A) when saving a file in MacRoman. This seems to be the culprit.

Try to change the encoding tag to <UNICODE-MAC> and save your document in "UTF-16" (Plain Text).
cf. http://support.adobe.com/devsup/devsup. ... /54162.htm
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Help with inDesign Tagged Text

Post by martin »

Kino to the rescue- hopefully that solves the problem for you.

As an aside, I'd say Adobe's text encoding nomenclature is odd. There's really no such thing as "Mac" ASCII or "Mac" Unicode. As Kino's link states, really what they mean by the latter is UTF-16 (big endian). But really the hardware/OS doesn't dictate the endian order, and when the Mac switched from PPC to Intel chips, the more likely endian order changed anyways.
macduffee
Posts: 15
Joined: 2009-04-28 09:09:13
Location: Minneapolis, MN

Re: Help with inDesign Tagged Text

Post by macduffee »

Kino, Martin,
Thanks again for all your hellp, but it is still not working. My money is on inDesign getting far too technical in their quest to beat Quark. I can flow my NW Pro text into Quark with no problem. We typesetters like to keep things simple, code it, flow it, make it beautiful. We leave the end of line code and various sizes of endians to the smart guys. I suppose I'll have to experiment with different InDesign encoding tags and NW Pro text encodings. By the way, what end of line code does NW 6.5 use?

Thanks,

Duff
User avatar
martin
Official Nisus Person
Posts: 5228
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Help with inDesign Tagged Text

Post by martin »

Classic uses carriage returns (U+000D), instead of newlines (U+000A) which NWP makes use of.

Could you send me an example file? Perhaps we can deduce what the problem is exactly. It would be best if you could send along two files, one saved by NWP that does not import into InDesign, and that same file as saved by Classic Nisus Writer which does import successfully. You can email me at:
Image
Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Help with inDesign Tagged Text

Post by Kino »

macduffee wrote:but it is still not working.
I downloaded InDesign CS4 6.0.2 demo to see what the problem is. To my great surprise, InDesign requires CR as EOL for <UNICODE-MAC> too. As a word processor, Nisus Writer Pro does not support such a special format. So I wrote a macro which hopefully will solve the problem. It seems to work for me but I'm quite unfamiliar with InDesign.

Code: Select all

### Export as UNICODE-MAC ###

# This macro exports the frontmost document in InDesign's "UNICODE-MAC" format
# (plain text in UTF-16BE with CR as EOL) as described in the following documents.
# How To: Generating a tagged text file from an application other than InDesign
# How To: Generating the text for tagged text files in different encodings
#
# The generated file will be saved in the same directory as "filename.txt"
# (or "filename(1).txt", "filename(2).txt"... if a file of the same name
# already exists) and revealed in the Finder.
#
# Only the document main body will be exported, i.e. footnotes and endnotes
# will be ignored.
#
# The encoding tag <UNICODE-MAC> will be inserted at the top of the generated file,
# replacing an encoding tag if the document has already one.
#
# The final return code(s) will be removed in the generated file.

$doc = Document.active
if $doc == undefined  # if there is no open document...
	exit
end

$outputFileName = $doc.displayName.lastFilePathComponentWithoutExtension
if $doc.filePath != undefined  # if this is an unsaved new document...
	$outputDir = $doc.filePath.filePathByRemovingLastComponent & '/'
else
	$outputDir = User Property 'home folder path'
	$outputDir &= '/Documents' & '/'
end

$outputFilePath = $outputDir & $outputFileName
$outputFilePath &= '.txt'
$i = 1
while File.existsAtPath $outputFilePath  # if a document of the same path already exists...
	$outputFilePath = $outputDir & $outputFileName
	$outputFilePath &= " ($i)" & '.txt'
	$i += 1
end

$text = Cast to String $doc.text, false
$text.findAndReplace '\A(?:<(?:ANSI|ASCII|SJIS|BIG5|UNICODE)-(?:MAC|WIN)>\n)?', '<UNICODE-MAC>\n', 'E'  # insert/replace the encoding tag
$text.findAndReplace '\n+\z', '', 'E'  # remove the final LFs
$map = Hash.new 0x000A, 0x000D
$range = Range.new 0, $text.length
$text.transliterateInRange $range, $map  # replace all LF with CR

$tempFileName = $outputFileName & '.txt'
$tempFilePath = File.temporaryPathWithName $tempFileName
File.writeDataToPath $text, $tempFilePath

Set Exported Perl Variables 'text', 'tempFilePath', 'outputFilePath'
begin Perl
	use MacPerl;
	`/usr/bin/textutil -convert txt -inputencoding UTF-8 -encoding UTF-16BE -output "$outputFilePath" "$tempFilePath"`;
	MacPerl::SetFileInfo ('NISX','TEXT',$outputFilePath);
end

File.deletePath $tempFilePath
File.revealPathInFinder $outputFilePath

### end of macro ###
Formatted macro file: http://www2.odn.ne.jp/alt-quinon/files/ ... AC_nwm.zip

Edit:
I changed the macro a bit so that Type (TEXT) and Creator (NISX) will be set to the generated file. (5/28 20:14 +9:00 GMT)
Changed the macro again so that the final LFs, instead of the very last LF, will be removed in the generated file. (21:00 +9:00 GMT)
macduffee
Posts: 15
Joined: 2009-04-28 09:09:13
Location: Minneapolis, MN

Re: Help with inDesign Tagged Text

Post by macduffee »

Kino,
It works! I can't thank you enough. Sorry it took so long to reply, we just finished a huge project and was unable to fully test it out until today.

Duff
User avatar
greenmorpher
Posts: 767
Joined: 2007-04-12 04:01:46
Location: Melbourne, Australia
Contact:

Re: Help with inDesign Tagged Text

Post by greenmorpher »

This is another of those instances which makes me wonder where working on computers lost its direction.

Back in the day when I first met Nisus, I was DTPing in PageMaker.

When Styles came in in PM (I can't remember at which version), I would get all sorts of text files from all sorts of people. I opened them in Nisus, ran one of the supplied macros which I had extended somewhat to get rid of the rubbish, looked for idiosyncratic rubbish and got rid of that through the Find/Replace, did any editing required, then flicked through the document adding simple style tags to paragraph beginnings -- bringing them in with TypeIt4Me. I didn't even have to tag every paragraph -- just the ones where style changed.

Then I saved the file as text and "placed" it into PageMaker. PM applied the styles on the fly so all the text appeared formatted in the PM document.

No headers, no messing around, no angst. Very fast. Highly productive, effective and cost efficient.

Why is it getting harder? Wasn't it supposed to get easier?

Cheers, Geoff

Geoffrey Heard
Publisher, Editor, Business Writer
The Worsley Press

Get "Type & Layout: Are you communicating or just making pretty shapes?" to deliver your words with real zing; and "How to Start and Produce a Magazine or Newsletter" to learn to step safely in the publishing minefield. Amazon or www.worsleypress.com
Groucho
Posts: 497
Joined: 2007-03-03 09:55:06
Location: Europe

Re: Help with inDesign Tagged Text

Post by Groucho »

You're a laudator temporis acti, Geoff.
Yet I agree with you that Apple is becoming growingly stiff and authoritarian. It's always hit or miss. There's little room for patching up things.
I don't know if you are using Leopard. What drives me mad, in Leopard, is the way Apple has refashioned Spotlight. You can't start a search in a folder of your choice, you can't view results in a smart folder and view them by creation date, size or what have you, like you did with Tiger. You can't even set a smart folder to a custom view. If you save a smart folder in list view, for example, all smart folders, even those in a remote disk that have been saved a year previously, even those in a CD, will switch to list view as well. It is all or nothing, in a Soviet way.
Now I hope the next version won't seize control of my computer :x .
By the way, I used Page Maker some fifteen years ago, but I don't remember I did any text tagging. As far as I remember, PM placed rtf or doc text (almost) correctly, styles and all.

Cheers, Henry.
User avatar
greenmorpher
Posts: 767
Joined: 2007-04-12 04:01:46
Location: Melbourne, Australia
Contact:

Re: Help with inDesign Tagged Text

Post by greenmorpher »

Part of the Styles function of PM was recognizing MS Word Styles and adopted them as its own. Good idea, except MS messed around with its styles and with inserting defaults of its own. Often that could lead to problems. Still does, from time to time in InDesign.

That would be a challenge for NWPro -- to fit into that so its Styles were recognized and adopted by InDesign!

Do I remember the old Nisus as coming with a Macro for preparing text for Quark?

Maybe this exchange should be the beginning of a large macro for preparing text for import to InDesign -- with appropriate tagging at both paragraph and character level and the autoamtic generation fo the stupid header.

Not that I'm interested in this, mind -- I do all my DTP now in Canvas X. Its maker formally announced it was no longer supporting it about four years ago. Ho hum! Another great "easiest to use program in the world" disappearing. When it finally doesn't work any longer, I'll stop, I reckon.

Cheers, Geoff

Geoffrey Heard
Publisher, Editor, Business Writer
The Worsley Press

Get "Type & Layout: Are you communicating or just making pretty shapes?" to deliver your words with real zing; and "How to Start and Produce a Magazine or Newsletter" to learn to step safely in the publishing minefield. Amazon or www.worsleypress.com
Post Reply