home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / util / editor / alpha513.cpt / latex.tcl (.txt) < prev    next >
LaTeX Document  |  1992-10-18  |  11KB  |  514 lines

  1. # Keybindings and macros activated upon entering TeX mode
  2. # Richard T. Austin (austin@eecs.umich.edu)
  3. # version 1.0 (8/12/92)
  4. # See the latex file "keyboard.tex" (in the "Help" folder) for an 
  5. # introduction, or "Latex Keys Help" in the Help menu for on-line help.
  6. # If you make improvements to this file, please share them with me!
  7. #                                 Richard
  8. # Special macros follow.  Most of these are equation-related.
  9. proc subscript {} {
  10.     insertText "_{}
  11.     backwardChar
  12.     backwardChar
  13. proc cite {} {
  14.     insertText "~\\cite{}
  15.     backwardChar
  16.     backwardChar
  17. proc ref {} { 
  18.     insertText "\\ref{}
  19.     backwardChar
  20.     backwardChar
  21. proc alignEqual {} {
  22.     insertText " &=& "
  23. proc noNumber {} {
  24.     insertText "\\nonumber \\\\"
  25. proc scriptL {} {
  26.     insertText "\\ell "
  27. proc boldface {} {
  28.       insertText "{\\bf }
  29.     backwardChar
  30.     backwardChar
  31. proc emphasize {} {
  32.       insertText "{\\em }
  33.     backwardChar
  34.     backwardChar
  35. proc underline {} {
  36.     insertText "\\underline{}
  37.     backwardChar
  38.     backwardChar
  39. proc conjugate {} {
  40.     insertText "^{*}"
  41. proc sum {} {
  42.       insertText "\\sum_{}^{
  43.     backwardChar
  44.     backwardChar
  45.     backwardChar
  46.     backwardChar
  47.     backwardChar
  48.     backwardChar
  49. proc mbox {} {
  50.       insertText "\\mbox{}
  51.     backwardChar
  52.     backwardChar
  53. proc overline {} {
  54.       insertText "\\overline{}
  55.     backwardChar
  56.     backwardChar
  57. proc infinity {} {
  58.       insertText "\\infty "
  59. proc bigBrackets {} {
  60.       insertText "\\left\[  \\right\]
  61.     backwardChar
  62.     backwardChar
  63.     backwardChar
  64.     backwardChar
  65.     backwardChar
  66.     backwardChar
  67.     backwardChar
  68.     backwardChar
  69.     backwardChar
  70. proc item {} {
  71.       insertText "\\item "
  72.       carriageReturn
  73.       insertText "
  74.       backwardChar
  75.       previousLine
  76.       forwardChar
  77.       forwardChar
  78.       forwardChar
  79.       forwardChar
  80.       forwardChar
  81.       forwardChar
  82. proc cross {} {
  83.       insertText "\\times "
  84. proc squareRoot {} {
  85.       insertText "\\sqrt{}
  86.     backwardChar
  87.     backwardChar
  88. proc fraction {} {
  89.       insertText "\\frac{}{
  90.     backwardChar
  91.     backwardChar
  92.     backwardChar
  93.     backwardChar
  94.     backwardChar
  95. proc superscript {} {
  96.       insertText "^{}
  97.     backwardChar
  98.     backwardChar
  99. proc integral {} {
  100.       insertText "\\int_{}^{
  101.     backwardChar
  102.     backwardChar
  103.     backwardChar
  104.     backwardChar
  105.     backwardChar
  106.     backwardChar
  107. proc mathMode {} {
  108.       insertText "$$
  109.     backwardChar
  110.     backwardChar
  111. proc hat {} {
  112.       insertText "\\hat{}
  113.     backwardChar
  114.     backwardChar
  115. proc tilde {} {
  116.       insertText "\\tilde{}
  117.     backwardChar
  118.     backwardChar
  119. proc bigParens {} {
  120.       insertText "\\left(  \\right)
  121.     backwardChar
  122.     backwardChar
  123.     backwardChar
  124.     backwardChar
  125.     backwardChar
  126.     backwardChar
  127.     backwardChar
  128.     backwardChar
  129.     backwardChar
  130. proc bigBraces {} {
  131.       insertText "\\left\\{  \\right\\}
  132.     backwardChar
  133.     backwardChar
  134.     backwardChar
  135.     backwardChar
  136.     backwardChar
  137.     backwardChar
  138.     backwardChar
  139.     backwardChar
  140.     backwardChar
  141.     backwardChar
  142. proc expectedValue {} {
  143.       insertText "\\langle  \\rangle
  144.     backwardChar
  145.     backwardChar
  146.     backwardChar
  147.     backwardChar
  148.     backwardChar
  149.     backwardChar
  150.     backwardChar
  151.     backwardChar
  152.     backwardChar
  153. proc equation {} {
  154.       carriageReturn
  155.       insertText "%"
  156.       carriageReturn
  157.       insertText "% equation"
  158.       carriageReturn
  159.       insertText "%"
  160.       carriageReturn
  161.       insertText "\\begin{equation}"
  162.       carriageReturn
  163.       insertText "\\label{}"
  164.       carriageReturn
  165.       insertText "
  166.       carriageReturn
  167.       insertText "\\end{equation}"
  168.       carriageReturn
  169.       insertText "
  170.       backwardChar
  171.       previousLine
  172.       previousLine
  173.       previousLine
  174.       forwardChar
  175.       forwardChar
  176.       forwardChar
  177.       forwardChar
  178.       forwardChar
  179.       forwardChar
  180.       forwardChar
  181. proc displaymath {} {
  182.       carriageReturn
  183.       insertText "%"
  184.       carriageReturn
  185.       insertText "% displaymath"
  186.       carriageReturn
  187.       insertText "%"
  188.       carriageReturn
  189.       insertText "\\begin{displaymath}"
  190.       carriageReturn
  191.       carriageReturn
  192.       insertText "\\end{displaymath}"
  193.       carriageReturn
  194.       insertText "
  195.       backwardChar
  196.       previousLine
  197.       previousLine
  198. proc eqnarray {} {
  199.       carriageReturn
  200.       insertText "%"
  201.       carriageReturn
  202.       insertText "% eqnarray"
  203.       carriageReturn
  204.       insertText "%"
  205.       carriageReturn
  206.       insertText "\\begin{eqnarray}"
  207.       carriageReturn
  208.       insertText "\\label{}"
  209.       carriageReturn
  210.       insertText "
  211.       carriageReturn
  212.       insertText "\\end{eqnarray}"
  213.       carriageReturn
  214.       insertText "
  215.       backwardChar
  216.       previousLine
  217.       previousLine
  218.       previousLine
  219.       forwardChar
  220.       forwardChar
  221.       forwardChar
  222.       forwardChar
  223.       forwardChar
  224.       forwardChar
  225.       forwardChar
  226. proc eqnarrayStar {} {
  227.       carriageReturn
  228.       insertText "%"
  229.       carriageReturn
  230.       insertText "% eqnarray*"
  231.       carriageReturn
  232.       insertText "%"
  233.       carriageReturn
  234.       insertText "\\begin{eqnarray*}"
  235.       carriageReturn
  236.       carriageReturn
  237.       insertText "\\end{eqnarray*}"
  238.       carriageReturn
  239.       insertText "
  240.       backwardChar
  241.       previousLine
  242.       previousLine
  243. proc environment {} {
  244.       set one [prompt "Begin what environment?" "slide"] 
  245.       carriageReturn
  246.       insertText "\\begin{"
  247.       insertText $one
  248.       insertText "}"
  249.       carriageReturn
  250.       carriageReturn
  251.       insertText "\\end{"
  252.       insertText $one
  253.       insertText "}"
  254.       carriageReturn
  255.       insertText "
  256.       backwardChar
  257.       previousLine
  258.       previousLine
  259. proc alpha {} {
  260.     insertText "\\alpha "
  261. proc beta {} {
  262.     insertText "\\beta "
  263. proc chi {} {
  264.     insertText "\\chi "
  265. proc delta {} {
  266.     insertText "\\delta "
  267. proc capDelta {} {
  268.     insertText "\\Delta "
  269. proc epsilon {} {
  270.     insertText "\\epsilon "
  271. proc varepsilon {} {
  272.     insertText "\\varepsilon "
  273. proc phi {} {
  274.     insertText "\\phi "
  275. proc varphi {} {
  276.     insertText "\\varphi "
  277. proc capPhi {} {
  278.     insertText "\\Phi "
  279. proc gamma {} {
  280.     insertText "\\gamma "
  281. proc capGamma {} {
  282.     insertText "\\Gamma "
  283. proc eta {} {
  284.     insertText "\\eta "
  285. proc iota {} {
  286.     insertText "\\iota "
  287. proc partial {} {
  288.     insertText "\\partial "
  289. proc kappa {} {
  290.     insertText "\\kappa "
  291. proc lambda {} {
  292.     insertText "\\lambda "
  293. proc capLambda {} {
  294.     insertText "\\Lambda "
  295. proc mu {} {
  296.     insertText "\\mu "
  297. proc nu {} {
  298.     insertText "\\nu "
  299. proc pi {} {
  300.     insertText "\\pi "
  301. proc capPi {} {
  302.     insertText "\\Pi "
  303. proc theta {} {
  304.     insertText "\\theta "
  305. proc capTheta {} {
  306.     insertText "\\Theta "
  307. proc vartheta {} {
  308.     insertText "\\vartheta "
  309. proc rho {} {
  310.     insertText "\\rho "
  311. proc sigma {} {
  312.     insertText "\\sigma "
  313. proc capSigma {} {
  314.     insertText "\\Sigma "
  315. proc tau {} {
  316.     insertText "\\tau "
  317. proc upsilon {} {
  318.     insertText "\\upsilon "
  319. proc capUpsilon {} {
  320.     insertText "\\Upsilon "
  321. proc nabla {} {
  322.     insertText "\\nabla "
  323. proc omega {} {
  324.     insertText "\\omega "
  325. proc capOmega {} {
  326.     insertText "\\Omega "
  327. proc xi {} {
  328.     insertText "\\xi "
  329. proc capXi {} {
  330.     insertText "\\Xi "
  331. proc psi {} {
  332.     insertText "\\psi "
  333. proc capPsi {} {
  334.     insertText "\\Psi "
  335. proc zeta {} {
  336.     insertText "\\zeta "
  337. proc funcTab {} {
  338.     setVar matchWords 0
  339.     setVar forward 1
  340.     setVar regExpr 0
  341.     setVar ignoreCase 1
  342.     set pos [getPos]
  343.     eval select [search {
  344. } $pos] 
  345.     goto [selEnd]
  346.     backwardChar
  347.     deleteChar
  348. proc unbindTexKeys {} {
  349. menu    -n LaTeX {
  350.     {menu -n Greek {
  351.         "alpha"
  352.         "beta"
  353.         "gamma"
  354.         "capGamma"
  355.         "delta"
  356.         "capDelta"
  357.         "epsilon"
  358.         "varepsilon"
  359.         "zeta"
  360.         "eta"
  361.         "theta"
  362.         "vartheta"
  363.         "capTheta"
  364.         "iota"
  365.         "kappa"
  366.         "lambda"
  367.         "capLambda"
  368.         "mu"
  369.         "nu"
  370.         "xi"
  371.         "capXi"
  372.         "pi"
  373.         "capPi"
  374.         "rho"
  375.         "sigma"
  376.         "capSigma"
  377.         "tau"
  378.         "upsilon"
  379.         "capUpsilon"
  380.         "phi"
  381.         "varphi"
  382.         "capPhi"
  383.         "chi"
  384.         "psi"
  385.         "capPsi"
  386.         "omega"
  387.         "capOmega"}}
  388.     {menu -n Symbols {
  389.         "nabla"
  390.         "cross"
  391.         "scriptL"
  392.         "partial"
  393.         "alignEqual"
  394.         "conjugate"
  395.         "infinity"}}
  396.     "(-"
  397.     {menu -n MathFunctions {
  398.         "squareRoot"
  399.         "fraction"
  400.         "superscript"
  401.         "subscript"
  402.         "(-"
  403.         "sum"
  404.         "integral"
  405.         "(-"
  406.         "overline"
  407.         "tilde"
  408.         "hat"
  409.         "(-"
  410.         "bigParens"
  411.         "bigBrackets"
  412.         "bigBraces"
  413.         "expectedValue"}}
  414.     {menu -n MiscFunctions {
  415.         "boldface"
  416.         "emphasize"
  417.         "underline"
  418.         "cite"
  419.         "item"
  420.         "ref"
  421.         "noNumber"}}
  422.     {menu -n Environs {
  423.         "mathMode"
  424.         "mbox"
  425.         "(-"
  426.         "equation"
  427.         "displaymath"
  428.         "eqnarray"
  429.         "eqnarrayStar"
  430.         "environment"}}
  431. # Special key bindings follow.
  432. # <o> = option, <z> = control, <s> = shift, <c> = command
  433. proc bindTexKeys {} {
  434.     bind 'a' <o> alpha             "Tex"
  435.     bind 'b' <o>    beta             "Tex"
  436.     bind 'b' <co>    boldface        "Tex"
  437.     bind 'c' <o>    chi            "Tex"
  438.     bind 'd' <o>    delta            "Tex"
  439.     bind 'd' <os>    capDelta        "Tex"
  440.     bind 'e' <o>    epsilon        "Tex"
  441.     bind 'e' <oz>    varepsilon        "Tex"
  442.     bind 'f' <o>    phi            "Tex"
  443.     bind 'f' <oz>    varphi            "Tex"
  444.     bind 'f' <os>    capPhi        "Tex"
  445.     bind 'g' <o>    gamma            "Tex"
  446.     bind 'g' <os>    capGamma        "Tex"
  447.     bind 'h' <o>    eta            "Tex"
  448.     bind 'i' <o>    iota            "Tex"
  449.     bind 'i' <co>    emphasize        "Tex"
  450.     bind 'j' <o>    partial        "Tex"
  451.     bind 'k' <o>    kappa            "Tex"
  452.     bind 'l' <o>    lambda        "Tex"
  453.     bind 'l' <os>    capLambda        "Tex"
  454.     bind 'm' <o>    mu            "Tex"
  455.     bind 'n' <o>    nu            "Tex"
  456.     bind 'p' <o>    pi            "Tex"
  457.     bind 'p' <os>    capPi            "Tex"
  458.     bind 'q' <o>    theta            "Tex"
  459.     bind 'q' <os>    capTheta        "Tex"
  460.     bind 'q' <oz>    vartheta        "Tex"
  461.     bind 'r' <o>    rho            "Tex"
  462.     bind 's' <o>    sigma            "Tex"
  463.     bind 's' <os>    capSigma        "Tex"
  464.     bind 't' <o>    tau            "Tex"
  465.     bind 'u' <o>    upsilon        "Tex"
  466.     bind 'u' <os>    capUpsilon        "Tex"
  467.     bind 'u' <co>     underline        "Tex"
  468.     bind 'v' <o>    nabla            "Tex"
  469.     bind 'w' <o>    omega            "Tex"
  470.     bind 'w' <os>    capOmega        "Tex"
  471.     bind 'x' <o>    xi            "Tex"
  472.     bind 'x' <os>    capXi            "Tex"
  473.     bind 'y' <o>    psi            "Tex"
  474.     bind 'y' <os>    capPsi        "Tex"
  475.     bind 'z' <o>    zeta            "Tex"
  476.     bind '`' <o>   tilde              "Tex"
  477.     bind '.' <o>    subscript        "Tex"
  478.     bind '=' <o>     alignEqual         "Tex"
  479.     bind '\' <o>     noNumber        "Tex"
  480.     bind 'l' <oz>     scriptL        "Tex"
  481.     bind '-' <os>    underline        "Tex"
  482.     bind '8' <o>    conjugate        "Tex"
  483.     bind '=' <os>    sum            "Tex"
  484.     bind '/' <os>    mbox            "Tex"
  485.     bind '-' <o>     overline        "Tex"
  486.     bind '\[' <o>     bigBrackets        "Tex"
  487.     bind '3' <o>     item            "Tex"
  488.     bind '0x27' <so>   cross               "Tex"
  489.     bind '2' <o>     squareRoot        "Tex"
  490.     bind '/' <o>     fraction        "Tex"
  491.     bind '.' <os>    superscript        "Tex"
  492.     bind '\;' <o>   integral            "Tex"
  493.     bind '4' <o>     mathMode        "Tex"
  494.     bind '5' <o>     infinity        "Tex"
  495.     bind '6' <o>     hat            "Tex"
  496.     bind '9' <os>    bigParens        "Tex"
  497.     bind '\[' <os>    bigBraces        "Tex"
  498.     bind ',' <os>    expectedValue    "Tex"
  499.     bind F5  <o>     equation           "Tex"
  500.     bind F5 <os>   displaymath         "Tex"
  501.     bind '5' <co>    equation        "Tex"
  502.     bind '5' <cso>   displaymath        "Tex"
  503.     bind F6 <o>      eqnarray            "Tex"
  504.     bind F6 <os>   eqnarrayStar        "Tex"
  505.     bind '6' <co>    eqnarray        "Tex"
  506.     bind '6' <cso>   eqnarrayStar        "Tex"
  507.     bind F7  <o>     environment          "Tex"
  508.     bind '7' <co>    environment        "Tex"
  509.     bind F8 <o>       ref                  "Tex"
  510.     bind F8 <os> cite                 "Tex"
  511.     bind '8' <co>    ref               "Tex"
  512.     bind '8' <cso>   cite            "Tex"
  513.     bind '0x30'       funcTab        "Tex"
  514.