converting automatic content

Everything related to our flagship word processor.
Post Reply
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

converting automatic content

Post by Bart »

I have a document with endnotes, and I need to put those notes in a separate document, delete them in the document I now have without loosing the note numbers, and turn those note numbers into text.

'Convert to fixed content' seems to be made for that job, but it doesn't seem to work … I've tried selecting the whole text, selecting the first note number, selecting the notes, but whatever I do, choosing the 'Convert …' menu option doesn't make any difference. All note numbers (both in the text, and in the notes themselves) are still automatic note numbers in stead of just text.

Any help would … eh, well help, I guess :)

best regards,
Bart
User avatar
Hamid
Posts: 777
Joined: 2007-01-17 03:25:42

Re: converting automatic content

Post by Hamid »

If styles don't matter, save the document as Plain Text (from File:Save As... command).
In the converted plain text file (with .txt extension), note numbers will appear in the body of the file as text, while footnotes or endnotes will appear as endnotes with their corresponding numbers.
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Hamid,

problem is: styles do matter, at least the basic stuff like italics, so I cannot afford to loose those as well.
I guess I'm doing something wrong (at least if I do understand what the conversion I'm using is supposed to do), or there is a bug in the new version of NisusWriter Pro. I even vaguely remember that this conversion did work in some previous version …

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

Re: converting automatic content

Post by martin »

Hi Bart- the "Convert to Fixed Content" menu isn't intended to convert note references/numbers, just other kinds of "smaller" automatic content like word counts, time/date stamps, document properties, etc. Ideally when the command is used, we could show the user a list of automatic content types, and ask which should be converted.

That said, converting endnotes to fixed content isn't too difficult:
1. Place the selection in any endnote.
2. Select All and copy.
3. Open a new document and paste.
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Martin,

Thank you for your explanation and suggestion. I'm afraid however that this doesn't solve my problem. It does give me the note texts with 'real' numbers, but I'm still stuck with a main text in which the note references are automatic numbers, and there is no way of converting those to just simply text. (I'm a translator, and the publishers want me to send in my work without such automatic numbers; thankfully I prepared my translation in Scrivener which does happen to have the option of exporting the text the way I need it). It you intend to build in the option of choosing which automatic content the user wishes to convert, do consider adding note references as well … :)

all the best,
Bart
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: converting automatic content

Post by martin »

Ah, I didn't know you wanted to keep those note references displayed in the main text. Well, after you copy your notes to a separate file, you could run the following macro on the original file:

Code: Select all

# Check if there’s a note reference style to apply
$doc = Document.active
$refStyle = $doc.styleWithName(‘Note Reference’)

# Scan through document for all note references, go backwards so numbering doesn't change as we progress
Select Document End
While Select Previous Note Reference
	$selection = TextSelection.active
	$refString = $selection.substring
	
	# delete smart reference and insert plain string
	Delete
	Insert Text $refString
	If $refStyle # apply reference style, if there is one
		$refStyle.apply
	End
End
If will convert all note references in the active document to be fixed/dumb numbers, and strip the note text from your document. Maybe the macro will be of some help in the future.
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Martin,

That macro does indeed what I was after. That's great. Thank you.
I should start learning the macro language and figure out such things for myself, but I haven't had the time yet.
Is there a way to make those number superscript?

Thanks again,
Bart
rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: converting automatic content

Post by rmark »

Bart,
I'm glad that works for you.
Is there a way to make those number superscript?
If you have a style in your document (before you run the macro) called "Note Reference" you can modify that style in the Style Sheet view of Nisus Writer Pro so that it includes the Superscript attribute. (I also added Red for the text and Yellow highlight to make sure the numbers stand out.)
I hope that helps. If you need any additional assistance, please let me know.
Write On!
Mark Hurvitz
Nisus Software Inc.
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Mark,

unfortunately I don't exactly see how that would make a difference? After running the macro all the styling of the note references (I mean the numbers in the main text, not the ones in front of the notes; just to be sure) is gone. So I guess that what I would need is an extra line in the macro that adds the note reference style to the now not automatic number.

Would it be possible to stylize the insertion point before the "Insert Text $refString" line in the macro gets into action? And if so, would that help?

Thanks for all the help,
Bart
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Mark,

Sorry to bother you; I should have tried this myself, and did so in the meantime. Simply added "Superscript" (and a return) before "Insert Text $refString", and it works.

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

Re: converting automatic content

Post by martin »

Mark's tip was to adjust a character style called "Note Reference". If such a character style exists in your document before you run the macro, the macro will automatically apply that style to all the converted/fixed note reference numbers. So, with that in mind, you can just add superscript to the "Note Reference" style, which is better than adding manual superscripting to all the numbers.

Hopefully that makes some sense- let us know if not.
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Mark's suggestion puzzled me a bit. There was a character style called 'Note Reference', and it already was superscript. I even made it red to make the numbers stand out more clearly, but after running Mark's macro (in its original fom), the numbers were neither superscript nor red, so apparently the style was cut with the (automatic) note numbers. I attach a document showing the result.

Incidentally I also noted that the space after note numbers after quotes (yes, you might want to read that again) somehow gets lost. That too is visible in the attached file.

All the best,
Bart
Attachments
example macro mark.rtf
(8.18 KiB) Downloaded 476 times
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: converting automatic content

Post by martin »

Bart wrote:There was a character style called 'Note Reference', and it already was superscript.
That's not quite right- your file has a style called "Footnote Reference", which the macro does not check for (or apply).
Incidentally I also noted that the space after note numbers after quotes (yes, you might want to read that again) somehow gets lost. That too is visible in the attached file.
Ah, that is an oversight on the part of the macro.

Here's an updated macro that does not delete the space, and also checks for either a "Note Reference" or "Footnote Reference" style:

Code: Select all

# Check if there’s a note reference style to apply
$doc = Document.active
$refStyle = $doc.styleWithName(‘Note Reference’)
If ! $refStyle
	$refStyle = $doc.styleWithName(‘Footnote Reference’)
End

# Scan through document for all note references, go backwards so numbering doesn't change as we progress
Select Document End
While Select Previous Note Reference
   $selection = TextSelection.active
   $refString = $selection.substring
   
   # delete smart reference and insert plain string
   Insert Text $refString
   If $refStyle # apply reference style, if there is one
      $refStyle.apply
   End
End
Bart
Posts: 29
Joined: 2004-01-14 08:39:12

Re: converting automatic content

Post by Bart »

Dear Martin,
that is great. Thanks a lot.

All the best,
Bart
Post Reply