Namespaces
Variants
Actions

Help:HowTo EoM

From Encyclopedia of Mathematics
Jump to: navigation, search


Editing including $\rm \TeX$ code

EoM pages can be edited like any Wikipedia page.

Moreover, EoM is enhanced by MathJax. Therefore, one can encode mathematics using arbitrary $\rm \TeX$ or $\rm \LaTeX$ code.

That is, you type $e^{2\pi i} = 1$ in order to get $e^{2\pi i} = 1$. Here is an even more convincing Example.


And this is some example demonstrating various things:

  • How to define $\rm \TeX$ macros, in order to save you keystrokes,
  • how to use standard $\rm \LaTeX$ constructs, and
  • how to encode automatic equation numbering and referencing them.


Certain $\rm \TeX$ macros are predefined by MathJax, see this page.

For editing one can use the text area, which is opened in the browser after clicking on the "edit" button of an EoM page. However, since most texts are long, it is highly recommended to use an external editor.

EoM allows to use add-ons in order to use external editors (like "It's all text" for firefox and "Edit with emacs" for chrome and chromium). This software can be installed in several browsers. If installed, below the wiki edit area there appears a small blue button, and clicking on that button pops up your favored editor window with the whole content of the text area, ready for editing.

Beware: In your preferences, under "Editing", please don't mark "Show edit toolbar (requires JavaScript)", otherwise the blue button may not occur.

See here for further explanations.

Comments on various other editors can be found here.

Re-encoding of old pages

Important: Old EoM pages have their formulas not encoded in $\rm \TeX$ but in png images.

Example for both encodings of the same page: $\qquad$ $\rm\TeX$ encoded $\qquad$ png encoded

To see all the pages already converted into $\rm\TeX$ look into this Category:TeX done. You can look at their encoding via the "edit" button.


One of the initial tasks for those pages is it to transcribe them into $\rm \TeX$.

In the png-encoded pages there are two types of encodings:

  • <img align= ... file.png ... />
  • <table class= ... file.png ... </table>

These entries have to be removed and replaced by appropriate $\rm\TeX$ code, the first type represents inline code, i.e., $\rm\TeX$ representation within single $ signs, the second type represents "displayed" $\rm\TeX$ code within double $ signs.

Assisting tool for $\rm \TeX$ re-encoding using Emacs

For the GNU Emacs editor, here is a tool which helps with this task.

If the macro is installed and the wiki text file for an old EoM page with png images is displayed in some Emacs buffer, then one keystroke (Ctrl-. = control key and .-key) removes all the png encodings (as described above) and replaces them by $_$ (resp. $$_$$), prompting the user to fill in the appropriate $\rm\TeX$ code into the minibuffer of Emacs.

After ending the $\rm\TeX$ code input with the Enter-key Emacs will insert that code into the wiki text file, jumping to the next instance and prompting the user again, etc.

The macro has re-entry capabilities: If input is interrupted, it can be called again, and it will continue with the next string $_$ (resp. $$_$$).

So within an interruption, the formulas can be filled directly into the text file, if convenient.

However, it is better to edit via the minibuffer, since the history capabilities of the minibuffer can very often be used to recall some former input (with the up- and down-keys), modify that slightly if necessary and insert again.

$\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. (Its functionality is similar to this method for Emacs, but without minibuffers.)

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 for a Single Macro

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 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.




Installation Instructions for Two Independent Macros

There may be situations in which only the list of references needs to be changed (when the maths is already in the right format) or in which only the maths needs to be changed (when the list of references is already in the right format). For this purpose the following two Apple scripts can be installed in TeXShop.

  • Open the TeXShop app.
  • Go to Macros>Open Macro Editor.
  • Click on the New Item button. In the Name: field, replace New Item by EOM Clean Up Maths. Copy the text from the EOM_Clean_Up_Maths.scpt script below into the Content: field.
  • Click on the New Item button. In the Name: field, replace New Item by EOM Clean Up Refs. Copy the text from the EOM_Clean_Up_Refs.scpt script below into the Content: field.
  • Click on the Save button.

EOM_Clean_Up_Maths.scpt

--AppleScript

(* 
This script can be used in conjunction with TeXShop to clean up EOM source files.
It replaces "<img ..." strings by $•$ and "<table class="eq" ..." strings by $$•$$.

After execution, the cursor is positioned at the first bullet •. 
To go to the next bullet, press CTRL-COMMAND-F in TeXShop; 
to go to the previous bullet (if it has not been replaced by TeX code), press 
CTRL-COMMAND-G in TeXShop.

This script should be located in a folder called EOM_Scripts together with
the perl script (written by Ulf Rehmann)

eom_replace_for_mac.pl

In case a different folder is used, please change this below.

The perl script needs 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>

Now you can quit the Terminal app.


*)

-- enter location of perl scripts here
set perlpath to "~/Documents/EOM_Scripts"



-- ACTUAL SCRIPT STARTS BELOW

----------------------------------------------------------------------------------------------------
-- copy TeXShop front document into script_source
tell application "TeXShop"
	set script_source to text of front document as «class utf8»
end tell


-- make a temporary file on which the perl scripts can operate
set tempfile to make_temp_file()

-- copy script_source into the temporary file 
write_to_temp_file(POSIX file tempfile, script_source)

-- replace img strings by $•$ (inline maths) and table strings by $$•$$ (display maths)
set tempstuff to (do shell script "cd " & perlpath & "; ./eom_replace_for_mac.pl " & " < " & quoted form of tempfile)

-- replace content of tempfile with tempstuff and convert to UNIX (LF) format; uses flip
write_to_temp_file(POSIX file tempfile, tempstuff)
do shell script "/bin/tcsh -c '~/Library/TeXShop/bin/flip -u  " & tempfile & "'"

-- copy everything back to the front document of TeXShop
tell application "TeXShop"
	set text of front document to tempstuff as «class utf8»
end tell

-- move the cursor to the first "slot" $•$ or $$•$$
tell application "TeXShop"
	activate
end tell


tell application "System Events"
	tell process "TeXShop"
		key code 126 using command down
		key code 3 using {command down, control down}
	end tell
end tell


-- stuff below used to create temporary files and write to them
on make_temp_file()
	set folder_name to path to temporary items
	set file_name to "eom_temp" & (random number from 100000 to 999999)
	set existing_file_names to list folder folder_name
	repeat while file_name is in existing_file_names
		set file_name to "eom_temp" & (random number from 100000 to 999999)
	end repeat
	return (POSIX path of folder_name) & file_name
end make_temp_file


on write_to_temp_file(temp_file, temp_text)
	set file_ref to open for access temp_file with write permission
	set eof file_ref to 0
	write temp_text to file_ref as «class utf8»
	close access file_ref
end write_to_temp_file

EOM_Clean_Up_Refs.scpt

--AppleScript

(* 
This script can be used in conjunction with TeXShop to clean up EOM source files.
It cleans up the list of references. 	

This script should be located in a folder called EOM_Scripts together with
the perl script (written by Ulf Rehmann)

eom_refs.pl

In case a different folder is used, please change this below.

The perl script 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_refs.pl

then press <ENTER>

Now you can quit the Terminal app.


*)

-- enter location of perl scripts here
set perlpath to "~/Documents/EOM_Scripts"



-- ACTUAL SCRIPT STARTS BELOW

----------------------------------------------------------------------------------------------------
-- copy TeXShop front document into script_source
tell application "TeXShop"
	set script_source to text of front document as «class utf8»
end tell


-- make a temporary file on which the perl scripts can operate
set tempfile to make_temp_file()

-- copy script_source into the temporary file 
write_to_temp_file(POSIX file tempfile, script_source)

-- apply perl script (clean up references) to temporary file with output into a variable called tempstuff
set tempstuff to (do shell script "cd " & perlpath & "; ./eom_refs.pl " & " < " & quoted form of tempfile)

-- replace content of tempfile with tempstuff and convert to UNIX (LF) format; uses flip
write_to_temp_file(POSIX file tempfile, tempstuff)
do shell script "/bin/tcsh -c '~/Library/TeXShop/bin/flip -u  " & tempfile & "'"

-- copy everything back to the front document of TeXShop
tell application "TeXShop"
	set text of front document to tempstuff as «class utf8»
end tell


-- stuff below used to create temporary files and write to them
on make_temp_file()
	set folder_name to path to temporary items
	set file_name to "eom_temp" & (random number from 100000 to 999999)
	set existing_file_names to list folder folder_name
	repeat while file_name is in existing_file_names
		set file_name to "eom_temp" & (random number from 100000 to 999999)
	end repeat
	return (POSIX path of folder_name) & file_name
end make_temp_file


on write_to_temp_file(temp_file, temp_text)
	set file_ref to open for access temp_file with write permission
	set eof file_ref to 0
	write temp_text to file_ref as «class utf8»
	close access file_ref
end write_to_temp_file

Mathematical subject classification and categorization, MR and Zbl links

Here are the templates for MSC, MR, Zbl. Usage is easy: See the code (="Edit" button) of one of the pages in Category:TeX done. Most of them have the MSC encoding in their very first line.

MS Classification will automatically categorize the page. See here for the EoM categories as actually set up.

MR and Zbl links should be added to references.

How to Cite This Entry:
HowTo EoM. Encyclopedia of Mathematics. URL: http://www.encyclopediaofmath.org/index.php?title=HowTo_EoM&oldid=32271