Latex cite and bibliography
Latex cite and bibliography
Hi all, I just start to use Nisus and I'm trying to figure out if anybody else are using Bibdesk to cite documents. I have a script in my computer that works on MS. Word finding \cite{} tags after that building a bibliography section. However, it is not working with Nisus Pro, so, perhaps somebody has a clue for this.
Re: Latex cite and bibliography
When you say "I have a script" this is what? An apple script, something else? And where/when do you run it? On a saved Nisus file?
philip
Re: Latex cite and bibliography
Yes, it is an AppleScript. In Word I can access and run it throught script menu.
Re: Latex cite and bibliography
Hello again. I don't use BibDesk myself. If you do still want help with this problem, could you post the script (or a link to where you got it)?
Generally since Nisus has real grep (unlike Word) it is really easy to grab all the \cite{} strings from a Nisus file. But a quick look at BibDesk did not enlighten me on how one would use such a list to generate a bibliography, or get the in-line citations.
Generally since Nisus has real grep (unlike Word) it is really easy to grab all the \cite{} strings from a Nisus file. But a quick look at BibDesk did not enlighten me on how one would use such a list to generate a bibliography, or get the in-line citations.
philip
Re: Latex cite and bibliography
Voilà
http://bibfuse.sourceforge.net/
In the source above you will find two apple scripts and a template.
Daniel
http://bibfuse.sourceforge.net/
In the source above you will find two apple scripts and a template.
Daniel
Re: Latex cite and bibliography
Hello Daniel,
let me just say the obvious first. The applescript won't work with Nisus because it says But more specifically it relies on the specific applescript hooks that MS Word has, so changing this will require some rewriting. I'll take a look at this, but it may take a few days.
let me just say the obvious first. The applescript won't work with Nisus because it says
Code: Select all
tell application "Microsoft Word"
philip
Re: Latex cite and bibliography
Hello again Daniel,
I have here something of a bare bones version of the script: There are number of things to say.
The original BibFuseFormat script uses a construct called "fields" in Word, which as far as I can make out seem to allow hiding things in a file. Essentially the script hides the cite keys in these fields and displays numbers instead. The one really nice thing is that is allows easy undoing (just extract the hidden info and remove the fields). Nisus has no such fields so the script simply replaces the cite keys. Undoing won't work.
It would be possible to set up some form of undoing, but this will require certain decisions of interface, and since I am actually not that interested in this approach to bibliographies, I am not at this time inclined to take the time to write such a script.
There are some other small differences. The script looks for a temporary file location. This didn't work on my machine, so I just worked around by having the user select the location by hand.
Overall I have to say that the whole reason for doing this with apple script is really due to the limitations of Word. A much better approach under Nisus Writer is to use Nisus' macro capability. I wrote a macro version of this script which I am posting here: This macro does still have some minor issues. But I don't have more time right now.
I have here something of a bare bones version of the script: There are number of things to say.
The original BibFuseFormat script uses a construct called "fields" in Word, which as far as I can make out seem to allow hiding things in a file. Essentially the script hides the cite keys in these fields and displays numbers instead. The one really nice thing is that is allows easy undoing (just extract the hidden info and remove the fields). Nisus has no such fields so the script simply replaces the cite keys. Undoing won't work.
It would be possible to set up some form of undoing, but this will require certain decisions of interface, and since I am actually not that interested in this approach to bibliographies, I am not at this time inclined to take the time to write such a script.
There are some other small differences. The script looks for a temporary file location. This didn't work on my machine, so I just worked around by having the user select the location by hand.
Overall I have to say that the whole reason for doing this with apple script is really due to the limitations of Word. A much better approach under Nisus Writer is to use Nisus' macro capability. I wrote a macro version of this script which I am posting here: This macro does still have some minor issues. But I don't have more time right now.
philip
Re: Latex cite and bibliography
Here is a slightly improved version of the macro. This removes the problem of leaving the temporary file open at the end. It also cleans up some of the unused variables.
One point that I failed to explain in my previous post: When this macro inserts citation numbers in the text it formats them all with a character style called "Citation". This has the advantage that one can easily change the formatting. It also makes it possible to easily select all citations.
Finally this should also be helpful if one wanted to write a macro to unformat the cite keys. One approach that one could take for such a macro would be to store the cite keys in a registry variable. Since $citeKeyList is a single Array, this would be fairly easy. The Unformat macro could then retrieve the $citeKeyList and replace each citation number with the corresponding cite key.
One point that I failed to explain in my previous post: When this macro inserts citation numbers in the text it formats them all with a character style called "Citation". This has the advantage that one can easily change the formatting. It also makes it possible to easily select all citations.
Finally this should also be helpful if one wanted to write a macro to unformat the cite keys. One approach that one could take for such a macro would be to store the cite keys in a registry variable. Since $citeKeyList is a single Array, this would be fairly easy. The Unformat macro could then retrieve the $citeKeyList and replace each citation number with the corresponding cite key.
philip
Re: Latex cite and bibliography
Sorry, discovered another small error. Line 72 should have $bibnameNoExt changed to $bibname, so it should look like this:
Here the corrected macro:
Code: Select all
prompt “No \\bibliography command found.”, “Shall I insert one for $bibname at the end of the document?”
philip
- martin
- Official Nisus Person
- Posts: 5228
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Latex cite and bibliography
Thanks for putting that macro together Philip! It's quite nice. You even restore the user's prior document view if the macro has to create a Citation style- such a polite macro
Hopefully Daniel and others put your efforts to good use!
![Cool 8)](./images/smilies/icon_king.gif)
Hopefully Daniel and others put your efforts to good use!
Re: Latex cite and bibliography
Thanks, Martin.martin wrote:Thanks for putting that macro together Philip! It's quite nice. You even restore the user's prior document view if the macro has to create a Citation style- such a polite macro![]()
Hopefully Daniel and others put your efforts to good use!
Of course, restoring the view would be easier if we had a Doc.viewstate property
![Wink :wink:](./images/smilies/icon_wink.gif)
Or better yet, what would really be nice is, if we could define a style something like this:
Code: Select all
$myNewStyle = Style.newWithAttributes $myAttributes
![Smile :)](./images/smilies/icon_smile.gif)
philip
- martin
- Official Nisus Person
- Posts: 5228
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Latex cite and bibliography
Those sound like good macro enhancement suggestions to me, thanks Philip!
Re: Latex cite and bibliography
Thanks a lot, Philip. When I wrote my last paper, I had to use Pages. With this macro, you basically makes it possible for me to use NWP again for writing my papers.
Really big kudos to you for taking the time to do this.
Nelson
Really big kudos to you for taking the time to do this.
Nelson