The pLyX system is a scripting system for LyX. Or rather, LyX has a built-in scripting system, but it seems to have been created by accident, few know of it, and it has certainly received no development to make its use convenient for the user. The pLyX system is an attempt to create a workable interface for this system out of the tools that LyX provides -- modules, custom insets, toolbar buttons -- and also to provide some initial scripts.
- Get package:
- download zipped version of this package here.
- unzip the archive to a convenient location (for example
My Documents
) - Open unzipped folder to top level (should contain file
requirements.txt
).
- Python:
- Download and run the Python 2.7 installer (either the "Windows x86 MSI Installer" or "Windows x86-64 MSI installer").
- Open the Windows Start menu.
- Search for "Edit the system environment variables", and then click it.
- Click
Environment Variables
. - Select
PATH
in theSystem variables
section. - Click
Edit
. - Add
;C:\Python27;C:\Python27\Scripts
to the end of the list (the paths are separated by semicolons). For example:C:\Windows;C:\Windows\System32;C:\Python27;C:\Python27\Scripts
. - Verify that it worked by opening your command prompt and entering
python
. You should see the>>>
prompt. - Install
pip
by opening command prompt and enteringeasy_install pip
. - Installed required packages for Python by running
pip install -r requirements.txt
.
- Copy files:
- copy contents of
doc
folder toC:\Users\<UserName>\AppData\Roaming\LyX2.1\doc
- copy contents of
layouts
folder toC:\Users\<UserName>\AppData\Roaming\LyX2.1\layouts
- copy contents of
images
folder toC:\Users\<UserName>\AppData\Roaming\LyX2.1\images
- copy contents of
scripts
folder toC:\Users\<UserName>\AppData\Roaming\LyX2.1\scripts
- copy contents of
ui
folder toC:\Users\<UserName>\AppData\Roaming\LyX2.1\ui
- copy contents of
- You ready to setup LyX.
- Get package:
- download zipped version of this package here.
- unzip the archive to a convenient location (for example
Documents
). - Open unzipped folder to top level (should contain file
requirements.txt
).
- Python:
- Check that you have Python installed by running
python
in terminal. Normally Mac OS X comes with Python preinstalled. - Check that you have pip installed by running in terminal
pip freeze
. If not install withsudo easy_install pip
. - Installed required packages for Python by running
sudo pip install -r requirements.txt
.
- Check that you have Python installed by running
- Copy files:
- copy contents of
doc
folder to/Applications/LyX.app/Contents/Resources/doc
- copy contents of
layouts
folder to/Applications/LyX.app/Contents/Resources/layouts
- copy contents of
images
folder to/Applications/LyX.app/Contents/Resources/images
- copy contents of
scripts
folder to/Applications/LyX.app/Contents/Resources/scripts
- copy contents of
ui
folder to/Applications/LyX.app/Contents/Resources/ui
- copy contents of
- You ready to setup LyX.
- Get package:
- download zipped version of this package here.
- unzip the archive to a convenient location (for example
Documents
). - Launch terminal and go to the root of the unzipped folder (should contain file
requirements.txt
).
- Python
- Check that you have Python installed by running
python
in terminal. Normally Linux comes with Python preinstalled. - Check that you have pip installed by running in terminal
pip freeze
. If not install withsudo apt-get install python-pip
. - Installed required packages for Python by running
sudo pip install -r requirements.txt
.
- Check that you have Python installed by running
- Copy files:
- copy contents of
doc
folder to/home/<UserName>/.lyx/doc
- copy contents of
layouts
folder to/home/<UserName>/.lyx/layouts
- copy contents of
images
folder to/home/<UserName>/.lyx/images
- copy contents of
scripts
folder to/home/<UserName>/.lyx/scripts
- copy contents of
ui
folder to/home/<UserName>/.lyx/ui
- copy contents of
- You ready to setup LyX.
This step you will have to do once to configure LyX properly.
- open LyX.
- define File format for
pLyX
inTools (LyX on Mac) -> Preferences -> File Handling -> File Formats
:- click
New
button and enterpLyX
in the Format box; - set the
Document format
check box; - enter
plyx
in theShort Name
box; - enter
lyx
in theExtension
box; - under
Viewer
chooseCustom
and enterLyX
in the box on the right; - Click
Apply
.
- click
- define File format for
qLyX
inTools (LyX on Mac) -> Preferences -> File Handling -> File Formats
:- click
New
button and enterqLyX
in the Format box; - enter
qlyx
in theShort Name
box; - enter
lyx
in theExtension
box; - None of the other check boxes or slots should be filled;
- Click
Apply
.
- click
- define converter from LyX to pLyX in
Tools (LyX on Mac) -> Preferences -> File Handling -> Converters
:- by scrolling in the list
From format
selectLyX
; - by scrolling in the list
To format
selectpLyX
; - enter in
Converter
box:- for Windows:
python "C:\Users\<UserName>\AppData\Roaming\LyX2.1\scripts\pLyX.py" $$i $$o
; - for Mac OS X:
python /Applications/LyX.app/Contents/Resources/scripts/pLyX.py $$i $$o
; - for Linux:
python /home/<UserName>/.lyx/scripts/pLyX.py $$i $$o
;
- for Windows:
- click
Add
andApply
.
- by scrolling in the list
-
define converter from LyX to qLyX in
Tools (LyX on Mac) -> Preferences -> File Handling -> Converters
:- by scrolling in the list
From format
selectLyX
; - by scrolling in the list
To format
selectqLyX
; - enter in
Converter
box:- for Windows:
python "C:\Users\<UserName>\AppData\Roaming\LyX2.1\scripts\qLyX.py" $$r $$f $$o
; - for Mac OS X:
python /Applications/LyX.app/Contents/Resources/scripts/qLyX.py $$r $$f $$o
; - for Linux:
python /home/<UserName>/.lyx/scripts/qLyX.py $$r $$f $$o
;
- for Windows:
- click
Add
andApply
.
- by scrolling in the list
-
Choose in menu
Tools -> Reconfigure
In each file you are working with add module pLyX
in Document -> Settings -> Modules
:
- choose
pLyX
in listAvailable
and clickAdd
; - click
Apply
; - verify that in the menu
Insert -> Custom Insets
you have new insets starting with.
(i.e..Run script(s)[]
).
This is an example of invoking the script that updates citations according to excel file provided:
- insert custom inset
.Run script(s)[]
; - inside
.Run scripts[]
insert custom inset.update citations
with additional flags if needed; - return down to next line;
- insert custom inset
.update citations
; - right after
.update citations
(not inside it) insert custom inset.[argument]
- specify absolute path of excel file with old and new key information (on Windows, path should be with slash rather than backslash, for example:
C:/Users/reevek/Documents/ED/NewBibtexKeys.xls
, if copied directly from file explorer it path will contain\
and be wrong) (For external drives through Mac, the address may look like:/Volumes/Untitled/Dropbox (Daniel Chen)/Lyx_Conversion/bib/ReplacementBibtexKeyNotes_02July2014.xls
);
In the following it is assumed that in toolbar you have following buttons
Several buttons needs to be pressed for script(s) to run:
- First press button
Save
. This will backup your current document; - Press
to run the script(s) over the document;
- Press
to load document back into LyX.
In the following it is assumed that in toolbar you have following buttons
You can't undo changes made by pLyX with regular undo command. To revert changes do the following steps: