Difference between revisions of "TeX re-encoding with TeXShop"
Thomas Unger (talk | contribs) (more edits) |
Thomas Unger (talk | contribs) |
||
Line 3: | Line 3: | ||
Please [[Help:HowTo EoM|read this page first]]. | Please [[Help:HowTo EoM|read this page first]]. | ||
− | For the TeXShop editor (tested on Mac OS 10.9), here is a tool which | + | For the [https://en.wikipedia.org/wiki/Texshop TeXShop editor] (tested on [https://en.wikipedia.org/wiki/Mac_OS_X Mac OS 10.9]), here is a tool which |
− | helps with | + | helps with the task of re-encoding old EoM pages. |
− | If the | + | If the Applescript and perl scripts are installed as explained below, and the wiki text file for an old EoM page |
with png images is displayed in the front document of TeXShop, | with png images is displayed in the front document of TeXShop, | ||
then one keystroke (Option-Command-S) removes all the png encodings | then one keystroke (Option-Command-S) removes all the png encodings | ||
Line 13: | Line 13: | ||
$\rm\TeX$ code. The user can navigate between the placeholders | $\rm\TeX$ code. The user can navigate between the placeholders | ||
<nowiki>$·$</nowiki> and <nowiki>$$·$$</nowiki> by pressing Ctrl-Command-F (forward) | <nowiki>$·$</nowiki> and <nowiki>$$·$$</nowiki> by pressing Ctrl-Command-F (forward) | ||
− | and Ctrl-Command-G ( | + | and Ctrl-Command-G (backwards). |
The script also cleans up the references list. | The script also cleans up the references list. | ||
Line 19: | Line 19: | ||
This has been tested with TeXShop on Mac OS 10.9 only, but will most likely also work for older OS versions. (Of course, TeXShop needs to be installed on your system). | This has been tested with TeXShop on Mac OS 10.9 only, but will most likely also work for older OS versions. (Of course, TeXShop needs to be installed on your system). | ||
− | * Create a folder called EOM_Scripts inside your Documents folder. (You can also use a different folder, but then you need to change one line in the script.) | + | * Create a folder called ''EOM_Scripts'' inside your ''Documents'' folder. (You can also use a different folder, but then you need to change one line in the script.) |
* Open your favourite text editor (for example TextEdit) and copy [[Eom_replace_for_mac.pl|these contents]] into a new document. Save this document ('''as a Plain Text file''') with title ''eom_replace_for_mac.pl'' in the folder EOM_Scripts. | * Open your favourite text editor (for example TextEdit) and copy [[Eom_replace_for_mac.pl|these contents]] into a new document. Save this document ('''as a Plain Text file''') with title ''eom_replace_for_mac.pl'' in the folder EOM_Scripts. | ||
* Then copy [[Eom_refs.pl|these contents]] into a new document. Save this document ('''as a Plain Text file''') with title ''eom_refs.pl'' in the folder EOM_Scripts. | * Then copy [[Eom_refs.pl|these contents]] into a new document. Save this document ('''as a Plain Text file''') with title ''eom_refs.pl'' in the folder EOM_Scripts. | ||
Line 34: | Line 34: | ||
* Open the TeXShop app, go to ''TexShop>Preferences'' and set ''encoding'' to '''Unicode (UTF-8)'''. | * Open the TeXShop app, go to ''TexShop>Preferences'' and set ''encoding'' to '''Unicode (UTF-8)'''. | ||
* Then go to ''Macros>Open Macro Editor'', click on the ''Separator'' button and then on the ''New Item'' button. In the ''Name:'' field, replace '''New Item''' by '''EOM Clean Up'''. In the ''Key:'' field, enter a lowercase '''s''' and tick the ''Option'' box. Finally, copy the text of [[Eom_clean_up.txt|this document]] into the ''Content:'' field. (This text is an Applescript.) '''Finally, click on the Save button.''' | * Then go to ''Macros>Open Macro Editor'', click on the ''Separator'' button and then on the ''New Item'' button. In the ''Name:'' field, replace '''New Item''' by '''EOM Clean Up'''. In the ''Key:'' field, enter a lowercase '''s''' and tick the ''Option'' box. Finally, copy the text of [[Eom_clean_up.txt|this document]] into the ''Content:'' field. (This text is an Applescript.) '''Finally, click on the Save button.''' | ||
+ | '''Note:''' if you decided not to use the folder ''Documents/EOM_Scripts'', you need to enter the correct folder name on line 26 of the Applescript. | ||
+ | |||
===Usage=== | ===Usage=== | ||
Line 42: | Line 44: | ||
====In conjunction with the Firefox add-on ''It's All Text''==== | ====In conjunction with the Firefox add-on ''It's All Text''==== | ||
− | Follow the instructions [[Help:HowTo_EoM#Editing_including_.24.5Crm_.5CTeX.24_code|here]] and | + | Follow the instructions [[Help:HowTo_EoM#Editing_including_.24.5Crm_.5CTeX.24_code|here]] and [https://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Use_It.27s_All_Text.21_to_invoke_an_external_editor here] and '''don't forget to choose TeXShop as your editor in the ''Preferences''!''' |
'''Note:''' the It's All Text add-on saves temporary files in <nowiki>Library/Application\ Support/Firefox/Profiles/xxxxxxx.default/itsalltext/</nowiki> (here ''xxxxxxx.default'' needs to be replaced by your profile), but does not seem to delete them after use. You can periodically delete the contents of this folder. | '''Note:''' the It's All Text add-on saves temporary files in <nowiki>Library/Application\ Support/Firefox/Profiles/xxxxxxx.default/itsalltext/</nowiki> (here ''xxxxxxx.default'' needs to be replaced by your profile), but does not seem to delete them after use. You can periodically delete the contents of this folder. |
Revision as of 14:36, 20 June 2014
$\rm \TeX$ re-encoding with TeXShop (OS X, 10.9)
Please read this page first.
For the TeXShop editor (tested on Mac OS 10.9), here is a tool which helps with the task of re-encoding old EoM pages.
If the Applescript and perl scripts are installed as explained below, and the wiki text file for an old EoM page with png images is displayed in the front document of TeXShop, then one keystroke (Option-Command-S) removes all the png encodings and replaces them by $·$ (resp. $$·$$), prompting the user to fill in the appropriate $\rm\TeX$ code. The user can navigate between the placeholders $·$ and $$·$$ by pressing Ctrl-Command-F (forward) and Ctrl-Command-G (backwards). The script also cleans up the references list.
Installation Instructions
This has been tested with TeXShop on Mac OS 10.9 only, but will most likely also work for older OS versions. (Of course, TeXShop needs to be installed on your system).
- Create a folder called EOM_Scripts inside your Documents folder. (You can also use a different folder, but then you need to change one line in the script.)
- Open your favourite text editor (for example TextEdit) and copy these contents into a new document. Save this document (as a Plain Text file) with title eom_replace_for_mac.pl in the folder EOM_Scripts.
- Then copy these contents into a new document. Save this document (as a Plain Text file) with title eom_refs.pl in the folder EOM_Scripts.
- The two files you just created are perl scripts (written by Ulf Rehmann) and need to be made executable. In order to do this,
- open the Terminal app and type
- cd Documents/EOM_Scripts/
- then press Enter and type
- chmod u+x eom_replace_for_mac.pl
- then press Enter and type
- chmod u+x eom_refs.pl
- then press Enter.
- Now you can quit the Terminal app.
- open the Terminal app and type
- Open the TeXShop app, go to TexShop>Preferences and set encoding to Unicode (UTF-8).
- Then go to Macros>Open Macro Editor, click on the Separator button and then on the New Item button. In the Name: field, replace New Item by EOM Clean Up. In the Key: field, enter a lowercase s and tick the Option box. Finally, copy the text of this document into the Content: field. (This text is an Applescript.) Finally, click on the Save button.
Note: if you decided not to use the folder Documents/EOM_Scripts, you need to enter the correct folder name on line 26 of the Applescript.
Usage
Stand-alone
Open the EoM source in a TeXShop window and press Option-Command-S or, alternatively, select EOM Clean Up (installed earlier) from the Macros menu. Once the Applescript is finished, you can navigate between the placeholders $·$ and $$·$$ by pressing Ctrl-Command-F (forward) and Ctrl-Command-G (backward).
In conjunction with the Firefox add-on It's All Text
Follow the instructions here and here and don't forget to choose TeXShop as your editor in the Preferences!
Note: the It's All Text add-on saves temporary files in Library/Application\ Support/Firefox/Profiles/xxxxxxx.default/itsalltext/ (here xxxxxxx.default needs to be replaced by your profile), but does not seem to delete them after use. You can periodically delete the contents of this folder.
TeX re-encoding with TeXShop. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=TeX_re-encoding_with_TeXShop&oldid=32266