True WYSIWYG LaTeX System
Windows     Mac     Linux  

BaKoMa TeX
Macro Examples

Setup and Use of these examples

Setup macros
Setup these macros may be done by simple saving the files into Macro folder C:\BaKoMa.TeX\LOCAL\Macro (Windows).

Alternative way is open Macro / Managing Macros ..., Create new macro using [+] button. Then edit new macro using [/] (pen) replace entire body by desired macros.

Executing macro
Centaur menu -> Macro -> Execute Macro (Alt+M X) Select Macro Name: MacroName Repetition Count: 1 Click the button [Execute]
Binding macro to key
Also you can bind the macro to any key: Centaur menu -> Macro -> Managin Macros Select MacroName in 'Macro List'. Click button with Keybord settings Select desired key and click [Bind] button.

Extended moving ...

GotoBOFAll - Goto beginning of file in all Windows
This macros is answer for Feature request: Move cursor position in all source files to top

%exec - forces execution instead of insertion.
% GotoBOFAll - execute GotoBOF (goto Beginning of Buffer) for all windows.

% Helper function which executes Proc for every window.
/InAllWindows { % { Proc } InAllWindows -
      { dup exec } stopped { handleerror } if 
    } forallviews
  } forallbuffers
} bind udef

{ GotoBOF updateview } InAllWindows 

% Similar: GotoEOF in all Windows
% { GotoEOF updateview } InAllWindows 

Download the file: GotoBOFAll.ctr
JumpToSource - Opens (from TeXWord) current file at current line/col in Centaur
This macros is answer for Feature request: Click live preview to jump to place in code in external editor

%exec - forces execution instead of insertion.
% Open current file at current line in centaur.
% NOTE: You can adapt this macro for own editor.

% There is location of our editor
/Editor (centaur) findapp not { () } if pstack udef

% Get filename, line, column (1 based
currentbuffer getcursor computelinecol 
1 add exch 1 add exch pstack

% Make command line ...
$Buffer StrClr Editor StrArg ( -c) StrCat StrXCat 
( -l) StrCat StrXCat ( ) StrCat StrArg

% Run it.
CurStr 0 wxExecute pstack 

%* EOF

Download the file:
knitr - Runs current documnt via knitr (needs customization)
%exec - forces execution instead of insertion.
% Example of launching Rscript knitr:
% "C:/Program Files/R/R-2.14.2/bin/Rscript.exe" -e "knitr::knit2pdf('%.Rnw')"

/Rexe (C:/Program Files/R/R-2.14.2/bin/Rscript.exe) udef % Fix it properly
/Rexe (C:/Git64/usr/bin/echo.exe) udef % Test of Run.

% ATT: smartshell must have exisitng file, so we check it !!!
Rexe existfile not {
  (ERROR: Not exists executable: ') print Rexe print ('\n) print 
  currentfile closefile 
} if 

Buffer StrClr Rexe StrArg ( -e "knitr::knit2pdf\(') StrCat 
  Master filecutext StrCat (.Rnw'\)") StrCat

CurStr pstack smartshell % Execute the command inside Utility console .

%* EOF
Download the file: knitr.ctr