Re: Mac OSX LyX Install: No templates included

2013-01-01 Thread ericob
At least with the LyX 2.0.5 distribution for Macintosh, the disk image
provided contains the LyX application and an alias to the Applications
folder. Nothing else.  It does /not/ include an installer program.  

Lacking an installer program, I wonder how the resource files (templates and
such), that are stored /inside/ the LyX application bundle are supposed to
come to be at ~/Library/Application Support/LyX-2.0.  I didn't know they
were inside the app, so I ended up downloading the source and digging around
in /that/ folder in order to find these things.  Ugh.  If there is no
installer available to move these resources, perhaps the application should
just look for them where they /are/, rather than in my user's Application
Support folder.

LyX.app is the LyX application.  If you do not have the Finder Preference
Show all file extensions set, the file name for the app will be only LyX
- without the dot and app.  

With Mac OS X, complex applications often exist as bundles (which I
suppose you could think of a special kind of folder).  To view the contents
of such a bundle, Context-click (right-click) on the bundle and choose Show
Package Contents.  The application will open onto a view just like you see
when you open a folder.

There, open the Contents folder, then the Resources folder and /copy/
what you want in order to fill up the empty folders in ~/Library/Application
Support/LyX-2.0.  You don't need to work from the distribution disk image -
the application you dragged to your hard disk is the same thing as the one
in the disk image.

Although if you /do/ work from the disk image, you will avoid accidentally
moving the items out of the application bundle, rather than copying them.



--
View this message in context: 
http://lyx.475766.n2.nabble.com/Mac-OSX-LyX-Install-No-templates-included-tp478050p7580198.html
Sent from the LyX - Users mailing list archive at Nabble.com.


The pLyX system

2013-01-01 Thread Andrew Parsloe
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a different 
file format name, something other than Lyx. The point of doing so was 
that during the export process one could manipulate the file in various 
ways with a script and then do a buffer-reload to overwrite the current 
document with the altered file. With the speed of modern computers, the 
whole process felt as if it were built-in to LyX -- there was no 
interruption to work flow. Rather like ERT, the process offered a means 
of plugging gaps in LyX's functionality (like sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


With this posting there are 9 files:

pLyX.py, pLyX_help.py -- the 'master' script  its help file
qLyX.py -- an 'undo' script which uses the backup file to do the undoing
pLyX.module -- a LyX module defining various custom insets
pLyX(compressed).lyx -- an explanatory LyX document

The explanatory document is in compressed format and needs to be 
uncompressed for the examples in it to work. There are also two 'sub-' 
or 'child' scripts:


calcul8.py, calcul8_help.py -- a calculator  its help file
break.py, break_help.py -- a stop-processing script  its help file

I know LyX users have not been crying out for a calculator but it 
provides an easy illustration of how the system works and was 
ridiculously easy to write, doing little more than feed an arithmetic or 
mathematical expression into the gaping maw of python's eval function. 
(And it's rather nice to see an expression like e**pi - pi**e evaluated 
before one's eyes in LyX.)


To keep this posting and number of files to a reasonable level, there 
are two associated postings, one containing scripts for sorting tables 
(a reworking of a script from some months ago) and sorting lists, 
including sub-lists (to all 6 levels if needed); the other containing a 
script for a system of text macros (the 'jewel in the crown' of the pLyX 
system).


There are other scripts in the offing: find and replace in native LyX 
format; a script for counting various (e.g. LyX format) objects; and one 
for heuristically structuring text 'paste-special-ed' into LyX (e.g. 
from a pdf). I have basic working examples of each of these, but they 
all need polishing.


Andrew



#\DeclareLyXModule{pLyX}
#DescriptionBegin
# Provides custom insets for specifying python scripts
# to run. To be used with the converter pLyX.py which
# exports from LyX to pLyX format. 
#DescriptionEnd
#
#v.1.0 2013-01-01
#Author: Andrew Parsloe apars...@clear.net.nz
#
Preamble
\newcommand{\pLyXgobble}[1]{}
EndPreamble

# All inset names begin with a full stop
# to aid alphabetical grouping
 MultiPar   1   

#(upper-case initial letter for this inset only)
InsetLayout Flex:.Run script(s)
  LyXType   custom
  LatexType command
  LatexName pLyXgobble
  Decorationclassic
  ContentAsLabel0
  Font
Miscno_emph
Miscno_bar
Miscno_noun
Miscno_strikeout
Miscno_uuline
Miscno_uwave
Family  roman
Series  medium
Shape   up
Sizenormal
Color   none
  EndFont
  LabelFont
Color   blue
  EndFont
  LabelString   Run script(s)
  MultiPar  1
  ResetsFont0
  Spellcheck0
End

InsetLayout Flex:.[argument]
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelFont
Color   none
  EndFont
  LabelString   .
  FreeSpacing   0
End

InsetLayout Flex:.expand macro|txtmacs
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelString   Macro
  FreeSpacing   0
End

 MultiPar   0   

InsetLayout Flex:.stop|break
  CopyStyle Flex:.Run script(s)
  LabelString   Stop
  MultiPar  0
End

InsetLayout Flex:.calculate formula|calcul8
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelString   Calculate
  MultiPar  0
End

InsetLayout Flex:.sort table|sortable
  

The pLyX system: sorting tables and lists

2013-01-01 Thread Andrew Parsloe
There are four scripts attached with this email and one 
compressed-format LyX document:


sortable.py, sortable_help.py -- a script for sorting tables in LyX,  
its help file
sortlist.py, sortlist_help.py -- a script for sorting lists in LyX,  
its help file

pLyXSorting(compressed).lyx -- an explanatory document with examples

The LyX document is in compressed LyX format. For the examples to work 
it must be saved in uncompressed format. (The pLyX system depends on LyX 
files being *text* files.) It contains some example tables and a 
substantial multi-level list to play with.


The table sorting script reworks for the pLyX system a script aired on 
this list back in September. On the developer's list I've noticed recent 
work to swap columns or swap rows in tables. I imagine once that is 
done, the next step will be hard to resist: go the whole way and sort 
the table. This might be a short-lived script.


The list sorting script is new and was harder to write because of the 
recursive calls to the sorting routine required by the (possible) 
presence of sub-lists. My underlying interest in sorting lists arose 
from a wish to sort indexes. (With their headings, subheadings, 
sub-subheadings, ... the logic is the same.)


Andrew


def helpnote(hv):
if hv  1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort table
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (15 December 2012) Columns can be sorted more than once for
 inter-filed mixed-case alphabetical sorting.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.4 (1 November 2012) First version for pLyX system.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.3 (17 September 2012) Use of custom insets; yellow notes option,
 hrules and vrules preserved.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 September 2012) Script now ignores ERT insets.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (12 September 2012 Table sorting script posted to user's list.
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort the
\emph on
 rows
\emph default
 by the values in specified columns.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Global options
\end_layout
\begin_layout LyX-Code
\family roman
-
\series bold
h  --help
\series default
  show this help note.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-v --version
\series default
  show version information.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-n  --notes
\series default
make LyX's (yellow) notes sortable; notes are
 sort-neutral by default.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Local options
\end_layout
\begin_layout LyX-Code
\family roman
A sort specification is a sequence like 
\series bold
2a3A1+
\series default
 (or 
\series bold
2a 3A 1+
\series default
 or 
\series bold
2a
\series default
,
\series bold
 3A
\series default
,
\series bold
 1+
\series default
, etc.) where the number indicates the column and the qualifying letter or
 sign indicates the kind of sort. A specification may involve from one to
 all columns in the table and a column may appear in the spec. more than once.
 The primary sort is by the first column specified, the secondary sort by
 the second column, etc. 
\end_layout
\begin_layout Itemize
\family roman
\series bold
a, A, +
\series default
 indicate ascending sorts; 
\end_layout
\begin_layout Itemize
\family roman
\series bold
z, Z, -
\series default
 indicate descending sorts; 
\end_layout
\begin_layout Itemize
\family roman
letters indicate alphabetical sorts, uppercase indicating case sensitivity;
\end_layout
\begin_layout Itemize
\family roman
\series bold
+, -
\series default
 indicate numerical sorts.
\end_layout
\begin_layout LyX-Code
\family roman
The 
\emph on
next
\emph default
 and subsequent rows of a table following a sort specification are sorted.
 For neat alphabetical sorts involving inter-filed mixed case, specify columns
 twice, e.g. 
\series bold
1a1A
\series default
 for an AaBbCc ... sort, or
\series bold
1a1Z
\series default
 for an aAbBcC ... sort.
\end_layout
'''




def helpnote(hv):
if hv  1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort list
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (16 December 2012) Allow secondary, tertiary, etc. sorts.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 December 2012) Include -a and -n options.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (8 November 2012)
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort one or more lists and sub-lists.
\begin_layout LyX-Code

\end_layout
\begin_layout LyX-Code

The pLyX system: text macros

2013-01-01 Thread Andrew Parsloe

There are three files attached to this posting:

txtmacs.py, txtmacs_help.py -- a script implementing a system of text 
macros in LyX, and its help file
pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 
670 text macros just waiting to be expanded)


The explanatory document must be saved in *uncompressed* format for the 
examples in it to work. It explains where to put the python scripts and 
then launches into an extensive explanation of how to use the system.


While I was working on a table sorting script in September, there was a 
brief exchange on the Developer's list about text macros. It occurred to 
me that the scheme of exporting from .lyx to .lyx then doing a 
buffer-reload might lend itself to a text macro implementation. This 
started out as a system of expanding abbreviations (which could be 
nested one within another). Almost immediately I found that an 
'abbreviation' could be essentially any LyX construct -- a word, a 
phrase, a paragraph, a number of paragraphs, an equation, inline or 
display, a picture, an inset, essentially anything.


Then the code generalised so that the abbreviations could take 
arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic 
geometry' but presented with an argument, [hg](H), would expand to 
'Hyperbolic geometry', meaning it could be used within and at the start 
of sentences. With 3 well-chosen keyboard shortcuts, I found macros 
provided a more convenient way of inserting character styles than 
presently available (in my opinion) in LyX. Macros also provide the easy 
insertion of LyX menu selections (as in the LyX manuals) with their sans 
serif formatting and menu separation character. And they enable the 
insertion of a specified number of any given character -- 47 asterisks 
perhaps, or 34 smileys.


There are conditionals available which enlarge the scope of what is 
possible. In fact it is all very new to me and I don't know what is 
possible. But the basic system has proved undeniably useful, and I 
wouldn't consider undertaking any substantial writing task in LyX now 
without this facility to hand.


Andrew

# Define and expand text macros in a LyX document.
# Part of the pLyX.py system; not an independent script
#
# txtmacs.py 
#
# Andrew Parsloe (apars...@clear.net.nz)
#
##

import re, argparse

bs1 = '\n\\backslash\n1\n'
macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1],
   'peel': [[''], bs1]}

def main(infl, outfl, options, guff):
'''Expand text macros.'''
  
flex_arg = r'\begin_inset Flex .[argument]'
begin_layout = r'\begin_layout'
end_layout = r'\end_layout'
begin_inset = r'\begin_inset'
end_inset = r'\end_inset'
begin_note = r'\begin_inset Note Note'
bkslash = '\\'
backslash = '\\backslash\n'
status_open = 'status open\n'
status_coll = 'status collapsed\n'

re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$')
re_lyxcmds = re.compile(r'(\\\w+) \w+')
underscores = set([begin_layout, begin_inset, end_layout, end_inset])
charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \
  '\\noun', '\\underbar', '\\strikeout', '\\uuline', \
  '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \
  '\\no_bar', '\\no_uuline', '\\no_uwave']

def output(depth, L):
# write to file only at top level
if depth == 0:
outfl.write(L)
return ''
else:
return L

def defaults(s):
'''Return used charstyles to default states.'''
temp = r''
for y in (set(re_lyxcmds.findall(s)) - underscores):
if y == r'\color':
temp += y + ' inherit\n'
elif y == r'\lang':
temp += y + ' english\n'
elif y.lower() in charstyles:
temp += y + ' default\n'
return temp

def expand(mname, sup_args, depth):
'''Expand the macro (recursively if necessary).'''
# substitute values for placeholders
macexp = macdict.get(mname)[1]
macprms = macdict.get(mname)[0]
num_params = len(macprms)
macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args
for i in range(num_params, -1, -1):
macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i])
# replace macro  inset with its expansion
#   expand included macros
store = scan(iter(macexp.splitlines(True)), depth + 1)
# return char styles to defaults
store += output(depth + 1, defaults(macexp))
return store

def strip_outers(stuff):
'''Strip enclosing layout statements.'''
stuff = stuff.partition('\n')[2]
stuff = stuff.rpartition(end_layout)[0]
return stuff

def inset_contents(iterable, keepouters):
'''Get contents of inset +/- outer layout 

Re: The pLyX system

2013-01-01 Thread Richard Heck

On 01/01/2013 05:16 AM, Andrew Parsloe wrote:
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a 
different file format name, something other than Lyx. The point of 
doing so was that during the export process one could manipulate the 
file in various ways with a script and then do a buffer-reload to 
overwrite the current document with the altered file. With the speed 
of modern computers, the whole process felt as if it were built-in to 
LyX -- there was no interruption to work flow. Rather like ERT, the 
process offered a means of plugging gaps in LyX's functionality (like 
sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


I would suggest that, for now, you create a page on the LyX wiki, and 
put all of this explanation, and these files, there. Better yet, for the 
files, create a git repo on github (or somewhere) and point at it.


Presumably, this could evolve to the point we'd include it in LyX, but 
obviously we need to see how it works first.


Richard



Re: how to install lyx 2.0.5 if you have full miktex 2.9 installed

2013-01-01 Thread Uwe Stöhr

Am 19.12.2012 09:30, schrieb Gyorgy SZEIDL:


if i choose

LyX-2.0.5-Bundle-4.exe 
ftp://ftp.lyx.org/pub/lyx/bin/2.0.5/LyX-2.0.5-Bundle-4.exe (~200 MB)

then i am made to install a basic miktex which i
do not need at all. (as a matter of fact i have a full
miktex (32 bit) installation which i use with winedt 7.0 )


You can nevertheless use the bundle installer. The installer will detect the existing MiKTeX on your 
PC and not override it.



if i choose

LyX-2.0.5-Installer-4.exe 
ftp://ftp.lyx.org/pub/lyx/bin/2.0.5/LyX-2.0.5-Installer-4.exe (~35 MB)

then i am supposed to have an older installation which
i do not have.


No, you are only supposed to have MiKTeX installed - what is the case for you.


a last question: can lyx work together with miktex 2.9 64 bit?


Yes.

I just released a new Windows installer that fixes some bugs that could occur when LyX is installed 
the first time on a PC. You can download it from here:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

regards Uwe


Re: Italics... in the table-of-contents

2013-01-01 Thread Uwe Stöhr

Am 29.12.2012 12:58, schrieb  Frederick FN Noronha फ्रेड्रिक नोरोन्या *فريدريك 
نورونيا :


Is there some way I could convert particular words in the TOC (table of
contents) into italics? Can't seem to be able to select words in the
addcontentsline entry for italicisation:

\addcontentsline{toc}{chapter}{Preliminary Note: The Relevance of Modo
Goano}


It works for me fine:
Either use the short title and emphasize a word there or emphasize a word in the \addcontentsline 
command. Attached is my LyX example file.


regards Uwe


Neues_Dokument1.lyx
Description: application/lyx


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 00:46, schrieb Filip:


every time I try to install Lyx 2.0.5 on my Windows 7 64bit, it freezes.
Here is screenshot of installation window
http://imageshack.us/photo/my-images/534/lyxl.jpg/


I encountered the same problem recently and therefore already fixed the bug. Since ysterday the new 
LyX installer (version 5) is available:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

Please try it and report back.

regards Uwe


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 23:23, schrieb Paul A. Rubin:


The bundle installer installs MiKTeX and LyX, then launches the configuration
script, which looks for various MiKTeX packages (quite a few of them, actually)
by running tiny LaTeX jobs that require them. The default behavior for MiKTeX's
package manager (mpm.exe) when LaTeX requires a package not currently installed
is to go off to the Internet and download the package. Given the number of
packages sought by the configuration script, this can take a considerable amount
of time, during which the installer looks as if it's stuck (it's not -- it's
just waiting for the configuration script to complete). If you don't have a live
Internet connection, I think mpm will wait indefinitely for one (in which case
the installer really is stuck).


That was not the bug. The problem was either an infinite loop when the installer attempted to 
initialize the spellcheck dictionary installation or the problem that the path to the latex.exe was 
misread by the installed (see in Filips's screenshot the double \\).


regards Uwe

p.s. Can you please try out the new installer and report back?
here is the changelog of the new version:

Changelog for LyX-205-5:
Bugfixes:
- fix bug that installer stopped working if LyX was installed
  the first time on a computer
- fix failing installation of Slovakian spellcheck dictionary
- prevent case that the installer could run an infinite loop if the
  installation of dictionaries was interrupted
- added missing files to the installer source zip-file so that it can now 
really be
  used to compile the installer
- updated to Qt 4.8.4 (Fixes a problem that with some screen font zooms, lines 
and dots disappeared.)

New features:
- give feedback about the state of the package installation
  (Especially if LyX is installed the first time, the package installation can 
take several minutes.
   Now the installer prints in the progress window the name of the package that is currently 
installed.)

- the installer supports now the usage of TeXLive as LaTeX distribution.
  (TeXLive must be manually installed before LyX.)
- updated spell-checker dictionaries for Scottish and Swedish
  (To benefit from them you must uninstall an already installed LyX 2.0.x and
   then use this installer.)
- updated thesaurus for Slovenian
  (need to reinstall LyX to benefit from this)
- updated Hungarian, Indonesian and Swedish translation of the installer 
messages
- new Basque translation of the installer messages


Re: Lyx 2.05 for Windows can't export any PDF

2013-01-01 Thread Uwe Stöhr

Am 18.12.2012 00:21, schrieb Douglas Leadenham:


I recently upgraded from Lyx 2.0 to 2.0.5, and now the software will not make
any PDF files.  Worse, the editors of the journal I'm trying to submit to will
not take plain Latex.  Can you help, please?


Please try this:

1. uninstall all versions of LyX 2.x _completely_
2. open an Internet connection
3. reinstall LyX 2.0.5 using the latest installer:
http://sourceforge.net/projects/lyxwininstaller/

The installer asks you to update MiKTeX, please do so.
Afterwards please update again MiKTeX manually.

regards Uwe


Re: The pLyX system

2013-01-01 Thread Liviu Andronic
On Tue, Jan 1, 2013 at 4:32 PM, Richard Heck rgh...@lyx.org wrote:
 all of this explanation, and these files, there. Better yet, for the files,
 create a git repo on github (or somewhere) and point at it.

Could we have a 'wiki' branch on our GIT server? So that contributed
files (modules, scripts, etc.) remain in-house, and contributors can
commit their files there?

Liviu


Re: Using Mac Lion Dictate

2013-01-01 Thread Uwe Ade
Hey Anna

I sometimes use Mac Lion Dictate with Lyx and it works direkt out of the box. I 
work with Lyx 2.04. Its nessecary that the focus is on lyx, that mean, the 
Cursor has to be in the Document in witch you want dictate.

Sincerly

uwe


Am 31.12.2012 um 14:28 schrieb Anna Maria Obertacke a...@obertacke.de:

 Hallo,
 
 I use Lyx for years with Mac for my study.
 
 Is it planned to support Mac OS Lion build-in dictation?
 http://support.apple.com/kb/HT5449
 
 Or is it a bug, that it does not work?
 
 I can start dictation by pressing Fn twice, but after speaking no text is 
 inserted. 
 Other writing applications work well, but I want to use only Lyx.
 
 Best regards, 
 
 Anna
 
 
 



Re: Mac OSX LyX Install: No templates included

2013-01-01 Thread ericob
At least with the LyX 2.0.5 distribution for Macintosh, the disk image
provided contains the LyX application and an alias to the Applications
folder. Nothing else.  It does /not/ include an installer program.  

Lacking an installer program, I wonder how the resource files (templates and
such), that are stored /inside/ the LyX application bundle are supposed to
come to be at ~/Library/Application Support/LyX-2.0.  I didn't know they
were inside the app, so I ended up downloading the source and digging around
in /that/ folder in order to find these things.  Ugh.  If there is no
installer available to move these resources, perhaps the application should
just look for them where they /are/, rather than in my user's Application
Support folder.

LyX.app is the LyX application.  If you do not have the Finder Preference
Show all file extensions set, the file name for the app will be only LyX
- without the dot and app.  

With Mac OS X, complex applications often exist as bundles (which I
suppose you could think of a special kind of folder).  To view the contents
of such a bundle, Context-click (right-click) on the bundle and choose Show
Package Contents.  The application will open onto a view just like you see
when you open a folder.

There, open the Contents folder, then the Resources folder and /copy/
what you want in order to fill up the empty folders in ~/Library/Application
Support/LyX-2.0.  You don't need to work from the distribution disk image -
the application you dragged to your hard disk is the same thing as the one
in the disk image.

Although if you /do/ work from the disk image, you will avoid accidentally
moving the items out of the application bundle, rather than copying them.



--
View this message in context: 
http://lyx.475766.n2.nabble.com/Mac-OSX-LyX-Install-No-templates-included-tp478050p7580198.html
Sent from the LyX - Users mailing list archive at Nabble.com.


The pLyX system

2013-01-01 Thread Andrew Parsloe
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a different 
file format name, something other than Lyx. The point of doing so was 
that during the export process one could manipulate the file in various 
ways with a script and then do a buffer-reload to overwrite the current 
document with the altered file. With the speed of modern computers, the 
whole process felt as if it were built-in to LyX -- there was no 
interruption to work flow. Rather like ERT, the process offered a means 
of plugging gaps in LyX's functionality (like sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


With this posting there are 9 files:

pLyX.py, pLyX_help.py -- the 'master' script  its help file
qLyX.py -- an 'undo' script which uses the backup file to do the undoing
pLyX.module -- a LyX module defining various custom insets
pLyX(compressed).lyx -- an explanatory LyX document

The explanatory document is in compressed format and needs to be 
uncompressed for the examples in it to work. There are also two 'sub-' 
or 'child' scripts:


calcul8.py, calcul8_help.py -- a calculator  its help file
break.py, break_help.py -- a stop-processing script  its help file

I know LyX users have not been crying out for a calculator but it 
provides an easy illustration of how the system works and was 
ridiculously easy to write, doing little more than feed an arithmetic or 
mathematical expression into the gaping maw of python's eval function. 
(And it's rather nice to see an expression like e**pi - pi**e evaluated 
before one's eyes in LyX.)


To keep this posting and number of files to a reasonable level, there 
are two associated postings, one containing scripts for sorting tables 
(a reworking of a script from some months ago) and sorting lists, 
including sub-lists (to all 6 levels if needed); the other containing a 
script for a system of text macros (the 'jewel in the crown' of the pLyX 
system).


There are other scripts in the offing: find and replace in native LyX 
format; a script for counting various (e.g. LyX format) objects; and one 
for heuristically structuring text 'paste-special-ed' into LyX (e.g. 
from a pdf). I have basic working examples of each of these, but they 
all need polishing.


Andrew



#\DeclareLyXModule{pLyX}
#DescriptionBegin
# Provides custom insets for specifying python scripts
# to run. To be used with the converter pLyX.py which
# exports from LyX to pLyX format. 
#DescriptionEnd
#
#v.1.0 2013-01-01
#Author: Andrew Parsloe apars...@clear.net.nz
#
Preamble
\newcommand{\pLyXgobble}[1]{}
EndPreamble

# All inset names begin with a full stop
# to aid alphabetical grouping
 MultiPar   1   

#(upper-case initial letter for this inset only)
InsetLayout Flex:.Run script(s)
  LyXType   custom
  LatexType command
  LatexName pLyXgobble
  Decorationclassic
  ContentAsLabel0
  Font
Miscno_emph
Miscno_bar
Miscno_noun
Miscno_strikeout
Miscno_uuline
Miscno_uwave
Family  roman
Series  medium
Shape   up
Sizenormal
Color   none
  EndFont
  LabelFont
Color   blue
  EndFont
  LabelString   Run script(s)
  MultiPar  1
  ResetsFont0
  Spellcheck0
End

InsetLayout Flex:.[argument]
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelFont
Color   none
  EndFont
  LabelString   .
  FreeSpacing   0
End

InsetLayout Flex:.expand macro|txtmacs
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelString   Macro
  FreeSpacing   0
End

 MultiPar   0   

InsetLayout Flex:.stop|break
  CopyStyle Flex:.Run script(s)
  LabelString   Stop
  MultiPar  0
End

InsetLayout Flex:.calculate formula|calcul8
  CopyStyle Flex:.Run script(s)
  ContentAsLabel1
  LabelString   Calculate
  MultiPar  0
End

InsetLayout Flex:.sort table|sortable
  

The pLyX system: sorting tables and lists

2013-01-01 Thread Andrew Parsloe
There are four scripts attached with this email and one 
compressed-format LyX document:


sortable.py, sortable_help.py -- a script for sorting tables in LyX,  
its help file
sortlist.py, sortlist_help.py -- a script for sorting lists in LyX,  
its help file

pLyXSorting(compressed).lyx -- an explanatory document with examples

The LyX document is in compressed LyX format. For the examples to work 
it must be saved in uncompressed format. (The pLyX system depends on LyX 
files being *text* files.) It contains some example tables and a 
substantial multi-level list to play with.


The table sorting script reworks for the pLyX system a script aired on 
this list back in September. On the developer's list I've noticed recent 
work to swap columns or swap rows in tables. I imagine once that is 
done, the next step will be hard to resist: go the whole way and sort 
the table. This might be a short-lived script.


The list sorting script is new and was harder to write because of the 
recursive calls to the sorting routine required by the (possible) 
presence of sub-lists. My underlying interest in sorting lists arose 
from a wish to sort indexes. (With their headings, subheadings, 
sub-subheadings, ... the logic is the same.)


Andrew


def helpnote(hv):
if hv  1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort table
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (15 December 2012) Columns can be sorted more than once for
 inter-filed mixed-case alphabetical sorting.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.4 (1 November 2012) First version for pLyX system.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.3 (17 September 2012) Use of custom insets; yellow notes option,
 hrules and vrules preserved.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 September 2012) Script now ignores ERT insets.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (12 September 2012 Table sorting script posted to user's list.
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort the
\emph on
 rows
\emph default
 by the values in specified columns.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Global options
\end_layout
\begin_layout LyX-Code
\family roman
-
\series bold
h  --help
\series default
  show this help note.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-v --version
\series default
  show version information.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-n  --notes
\series default
make LyX's (yellow) notes sortable; notes are
 sort-neutral by default.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Local options
\end_layout
\begin_layout LyX-Code
\family roman
A sort specification is a sequence like 
\series bold
2a3A1+
\series default
 (or 
\series bold
2a 3A 1+
\series default
 or 
\series bold
2a
\series default
,
\series bold
 3A
\series default
,
\series bold
 1+
\series default
, etc.) where the number indicates the column and the qualifying letter or
 sign indicates the kind of sort. A specification may involve from one to
 all columns in the table and a column may appear in the spec. more than once.
 The primary sort is by the first column specified, the secondary sort by
 the second column, etc. 
\end_layout
\begin_layout Itemize
\family roman
\series bold
a, A, +
\series default
 indicate ascending sorts; 
\end_layout
\begin_layout Itemize
\family roman
\series bold
z, Z, -
\series default
 indicate descending sorts; 
\end_layout
\begin_layout Itemize
\family roman
letters indicate alphabetical sorts, uppercase indicating case sensitivity;
\end_layout
\begin_layout Itemize
\family roman
\series bold
+, -
\series default
 indicate numerical sorts.
\end_layout
\begin_layout LyX-Code
\family roman
The 
\emph on
next
\emph default
 and subsequent rows of a table following a sort specification are sorted.
 For neat alphabetical sorts involving inter-filed mixed case, specify columns
 twice, e.g. 
\series bold
1a1A
\series default
 for an AaBbCc ... sort, or
\series bold
1a1Z
\series default
 for an aAbBcC ... sort.
\end_layout
'''




def helpnote(hv):
if hv  1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort list
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (16 December 2012) Allow secondary, tertiary, etc. sorts.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 December 2012) Include -a and -n options.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (8 November 2012)
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort one or more lists and sub-lists.
\begin_layout LyX-Code

\end_layout
\begin_layout LyX-Code

The pLyX system: text macros

2013-01-01 Thread Andrew Parsloe

There are three files attached to this posting:

txtmacs.py, txtmacs_help.py -- a script implementing a system of text 
macros in LyX, and its help file
pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 
670 text macros just waiting to be expanded)


The explanatory document must be saved in *uncompressed* format for the 
examples in it to work. It explains where to put the python scripts and 
then launches into an extensive explanation of how to use the system.


While I was working on a table sorting script in September, there was a 
brief exchange on the Developer's list about text macros. It occurred to 
me that the scheme of exporting from .lyx to .lyx then doing a 
buffer-reload might lend itself to a text macro implementation. This 
started out as a system of expanding abbreviations (which could be 
nested one within another). Almost immediately I found that an 
'abbreviation' could be essentially any LyX construct -- a word, a 
phrase, a paragraph, a number of paragraphs, an equation, inline or 
display, a picture, an inset, essentially anything.


Then the code generalised so that the abbreviations could take 
arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic 
geometry' but presented with an argument, [hg](H), would expand to 
'Hyperbolic geometry', meaning it could be used within and at the start 
of sentences. With 3 well-chosen keyboard shortcuts, I found macros 
provided a more convenient way of inserting character styles than 
presently available (in my opinion) in LyX. Macros also provide the easy 
insertion of LyX menu selections (as in the LyX manuals) with their sans 
serif formatting and menu separation character. And they enable the 
insertion of a specified number of any given character -- 47 asterisks 
perhaps, or 34 smileys.


There are conditionals available which enlarge the scope of what is 
possible. In fact it is all very new to me and I don't know what is 
possible. But the basic system has proved undeniably useful, and I 
wouldn't consider undertaking any substantial writing task in LyX now 
without this facility to hand.


Andrew

# Define and expand text macros in a LyX document.
# Part of the pLyX.py system; not an independent script
#
# txtmacs.py 
#
# Andrew Parsloe (apars...@clear.net.nz)
#
##

import re, argparse

bs1 = '\n\\backslash\n1\n'
macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1],
   'peel': [[''], bs1]}

def main(infl, outfl, options, guff):
'''Expand text macros.'''
  
flex_arg = r'\begin_inset Flex .[argument]'
begin_layout = r'\begin_layout'
end_layout = r'\end_layout'
begin_inset = r'\begin_inset'
end_inset = r'\end_inset'
begin_note = r'\begin_inset Note Note'
bkslash = '\\'
backslash = '\\backslash\n'
status_open = 'status open\n'
status_coll = 'status collapsed\n'

re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$')
re_lyxcmds = re.compile(r'(\\\w+) \w+')
underscores = set([begin_layout, begin_inset, end_layout, end_inset])
charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \
  '\\noun', '\\underbar', '\\strikeout', '\\uuline', \
  '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \
  '\\no_bar', '\\no_uuline', '\\no_uwave']

def output(depth, L):
# write to file only at top level
if depth == 0:
outfl.write(L)
return ''
else:
return L

def defaults(s):
'''Return used charstyles to default states.'''
temp = r''
for y in (set(re_lyxcmds.findall(s)) - underscores):
if y == r'\color':
temp += y + ' inherit\n'
elif y == r'\lang':
temp += y + ' english\n'
elif y.lower() in charstyles:
temp += y + ' default\n'
return temp

def expand(mname, sup_args, depth):
'''Expand the macro (recursively if necessary).'''
# substitute values for placeholders
macexp = macdict.get(mname)[1]
macprms = macdict.get(mname)[0]
num_params = len(macprms)
macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args
for i in range(num_params, -1, -1):
macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i])
# replace macro  inset with its expansion
#   expand included macros
store = scan(iter(macexp.splitlines(True)), depth + 1)
# return char styles to defaults
store += output(depth + 1, defaults(macexp))
return store

def strip_outers(stuff):
'''Strip enclosing layout statements.'''
stuff = stuff.partition('\n')[2]
stuff = stuff.rpartition(end_layout)[0]
return stuff

def inset_contents(iterable, keepouters):
'''Get contents of inset +/- outer layout 

Re: The pLyX system

2013-01-01 Thread Richard Heck

On 01/01/2013 05:16 AM, Andrew Parsloe wrote:
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a 
different file format name, something other than Lyx. The point of 
doing so was that during the export process one could manipulate the 
file in various ways with a script and then do a buffer-reload to 
overwrite the current document with the altered file. With the speed 
of modern computers, the whole process felt as if it were built-in to 
LyX -- there was no interruption to work flow. Rather like ERT, the 
process offered a means of plugging gaps in LyX's functionality (like 
sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


I would suggest that, for now, you create a page on the LyX wiki, and 
put all of this explanation, and these files, there. Better yet, for the 
files, create a git repo on github (or somewhere) and point at it.


Presumably, this could evolve to the point we'd include it in LyX, but 
obviously we need to see how it works first.


Richard



Re: how to install lyx 2.0.5 if you have full miktex 2.9 installed

2013-01-01 Thread Uwe Stöhr

Am 19.12.2012 09:30, schrieb Gyorgy SZEIDL:


if i choose

LyX-2.0.5-Bundle-4.exe 
ftp://ftp.lyx.org/pub/lyx/bin/2.0.5/LyX-2.0.5-Bundle-4.exe (~200 MB)

then i am made to install a basic miktex which i
do not need at all. (as a matter of fact i have a full
miktex (32 bit) installation which i use with winedt 7.0 )


You can nevertheless use the bundle installer. The installer will detect the existing MiKTeX on your 
PC and not override it.



if i choose

LyX-2.0.5-Installer-4.exe 
ftp://ftp.lyx.org/pub/lyx/bin/2.0.5/LyX-2.0.5-Installer-4.exe (~35 MB)

then i am supposed to have an older installation which
i do not have.


No, you are only supposed to have MiKTeX installed - what is the case for you.


a last question: can lyx work together with miktex 2.9 64 bit?


Yes.

I just released a new Windows installer that fixes some bugs that could occur when LyX is installed 
the first time on a PC. You can download it from here:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

regards Uwe


Re: Italics... in the table-of-contents

2013-01-01 Thread Uwe Stöhr

Am 29.12.2012 12:58, schrieb  Frederick FN Noronha फ्रेड्रिक नोरोन्या *فريدريك 
نورونيا :


Is there some way I could convert particular words in the TOC (table of
contents) into italics? Can't seem to be able to select words in the
addcontentsline entry for italicisation:

\addcontentsline{toc}{chapter}{Preliminary Note: The Relevance of Modo
Goano}


It works for me fine:
Either use the short title and emphasize a word there or emphasize a word in the \addcontentsline 
command. Attached is my LyX example file.


regards Uwe


Neues_Dokument1.lyx
Description: application/lyx


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 00:46, schrieb Filip:


every time I try to install Lyx 2.0.5 on my Windows 7 64bit, it freezes.
Here is screenshot of installation window
http://imageshack.us/photo/my-images/534/lyxl.jpg/


I encountered the same problem recently and therefore already fixed the bug. Since ysterday the new 
LyX installer (version 5) is available:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

Please try it and report back.

regards Uwe


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 23:23, schrieb Paul A. Rubin:


The bundle installer installs MiKTeX and LyX, then launches the configuration
script, which looks for various MiKTeX packages (quite a few of them, actually)
by running tiny LaTeX jobs that require them. The default behavior for MiKTeX's
package manager (mpm.exe) when LaTeX requires a package not currently installed
is to go off to the Internet and download the package. Given the number of
packages sought by the configuration script, this can take a considerable amount
of time, during which the installer looks as if it's stuck (it's not -- it's
just waiting for the configuration script to complete). If you don't have a live
Internet connection, I think mpm will wait indefinitely for one (in which case
the installer really is stuck).


That was not the bug. The problem was either an infinite loop when the installer attempted to 
initialize the spellcheck dictionary installation or the problem that the path to the latex.exe was 
misread by the installed (see in Filips's screenshot the double \\).


regards Uwe

p.s. Can you please try out the new installer and report back?
here is the changelog of the new version:

Changelog for LyX-205-5:
Bugfixes:
- fix bug that installer stopped working if LyX was installed
  the first time on a computer
- fix failing installation of Slovakian spellcheck dictionary
- prevent case that the installer could run an infinite loop if the
  installation of dictionaries was interrupted
- added missing files to the installer source zip-file so that it can now 
really be
  used to compile the installer
- updated to Qt 4.8.4 (Fixes a problem that with some screen font zooms, lines 
and dots disappeared.)

New features:
- give feedback about the state of the package installation
  (Especially if LyX is installed the first time, the package installation can 
take several minutes.
   Now the installer prints in the progress window the name of the package that is currently 
installed.)

- the installer supports now the usage of TeXLive as LaTeX distribution.
  (TeXLive must be manually installed before LyX.)
- updated spell-checker dictionaries for Scottish and Swedish
  (To benefit from them you must uninstall an already installed LyX 2.0.x and
   then use this installer.)
- updated thesaurus for Slovenian
  (need to reinstall LyX to benefit from this)
- updated Hungarian, Indonesian and Swedish translation of the installer 
messages
- new Basque translation of the installer messages


Re: Lyx 2.05 for Windows can't export any PDF

2013-01-01 Thread Uwe Stöhr

Am 18.12.2012 00:21, schrieb Douglas Leadenham:


I recently upgraded from Lyx 2.0 to 2.0.5, and now the software will not make
any PDF files.  Worse, the editors of the journal I'm trying to submit to will
not take plain Latex.  Can you help, please?


Please try this:

1. uninstall all versions of LyX 2.x _completely_
2. open an Internet connection
3. reinstall LyX 2.0.5 using the latest installer:
http://sourceforge.net/projects/lyxwininstaller/

The installer asks you to update MiKTeX, please do so.
Afterwards please update again MiKTeX manually.

regards Uwe


Re: The pLyX system

2013-01-01 Thread Liviu Andronic
On Tue, Jan 1, 2013 at 4:32 PM, Richard Heck rgh...@lyx.org wrote:
 all of this explanation, and these files, there. Better yet, for the files,
 create a git repo on github (or somewhere) and point at it.

Could we have a 'wiki' branch on our GIT server? So that contributed
files (modules, scripts, etc.) remain in-house, and contributors can
commit their files there?

Liviu


Re: Using Mac Lion Dictate

2013-01-01 Thread Uwe Ade
Hey Anna

I sometimes use Mac Lion Dictate with Lyx and it works direkt out of the box. I 
work with Lyx 2.04. Its nessecary that the focus is on lyx, that mean, the 
Cursor has to be in the Document in witch you want dictate.

Sincerly

uwe


Am 31.12.2012 um 14:28 schrieb Anna Maria Obertacke a...@obertacke.de:

 Hallo,
 
 I use Lyx for years with Mac for my study.
 
 Is it planned to support Mac OS Lion build-in dictation?
 http://support.apple.com/kb/HT5449
 
 Or is it a bug, that it does not work?
 
 I can start dictation by pressing Fn twice, but after speaking no text is 
 inserted. 
 Other writing applications work well, but I want to use only Lyx.
 
 Best regards, 
 
 Anna
 
 
 



Re: Mac OSX LyX Install: No templates included

2013-01-01 Thread ericob
At least with the LyX 2.0.5 distribution for Macintosh, the disk image
provided contains the LyX application and an alias to the Applications
folder. Nothing else.  It does /not/ include an installer program.  

Lacking an installer program, I wonder how the resource files (templates and
such), that are stored /inside/ the LyX application bundle are supposed to
come to be at ~/Library/Application Support/LyX-2.0.  I didn't know they
were inside the app, so I ended up downloading the source and digging around
in /that/ folder in order to find these things.  Ugh.  If there is no
installer available to move these resources, perhaps the application should
just look for them where they /are/, rather than in my user's Application
Support folder.

"LyX.app" is the LyX application.  If you do not have the Finder Preference
"Show all file extensions" set, the file name for the app will be only "LyX"
- without the dot and "app."  

With Mac OS X, complex applications often exist as "bundles" (which I
suppose you could think of a special kind of folder).  To view the contents
of such a bundle, Context-click (right-click) on the bundle and choose "Show
Package Contents."  The application will open onto a view just like you see
when you open a folder.

There, open the "Contents" folder, then the "Resources" folder and /copy/
what you want in order to fill up the empty folders in ~/Library/Application
Support/LyX-2.0.  You don't need to work from the distribution disk image -
the application you dragged to your hard disk is the same thing as the one
in the disk image.

Although if you /do/ work from the disk image, you will avoid accidentally
moving the items out of the application bundle, rather than copying them.



--
View this message in context: 
http://lyx.475766.n2.nabble.com/Mac-OSX-LyX-Install-No-templates-included-tp478050p7580198.html
Sent from the LyX - Users mailing list archive at Nabble.com.


The pLyX system

2013-01-01 Thread Andrew Parsloe
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a different 
file format name, something other than Lyx. The point of doing so was 
that during the export process one could manipulate the file in various 
ways with a script and then do a buffer-reload to overwrite the current 
document with the altered file. With the speed of modern computers, the 
whole process felt as if it were built-in to LyX -- there was no 
interruption to work flow. Rather like ERT, the process offered a means 
of plugging gaps in LyX's functionality (like sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


With this posting there are 9 files:

pLyX.py, pLyX_help.py -- the 'master' script & its help file
qLyX.py -- an 'undo' script which uses the backup file to do the undoing
pLyX.module -- a LyX module defining various custom insets
pLyX(compressed).lyx -- an explanatory LyX document

The explanatory document is in compressed format and needs to be 
uncompressed for the examples in it to work. There are also two 'sub-' 
or 'child' scripts:


calcul8.py, calcul8_help.py -- a calculator & its help file
break.py, break_help.py -- a stop-processing script & its help file

I know LyX users have not been crying out for a calculator but it 
provides an easy illustration of how the system works and was 
ridiculously easy to write, doing little more than feed an arithmetic or 
mathematical expression into the gaping maw of python's eval function. 
(And it's rather nice to see an expression like e**pi - pi**e evaluated 
before one's eyes in LyX.)


To keep this posting and number of files to a reasonable level, there 
are two associated postings, one containing scripts for sorting tables 
(a reworking of a script from some months ago) and sorting lists, 
including sub-lists (to all 6 levels if needed); the other containing a 
script for a system of text macros (the 'jewel in the crown' of the pLyX 
system).


There are other scripts in the offing: find and replace in native LyX 
format; a script for counting various (e.g. LyX format) objects; and one 
for heuristically structuring text 'paste-special-ed' into LyX (e.g. 
from a pdf). I have basic working examples of each of these, but they 
all need polishing.


Andrew



#\DeclareLyXModule{pLyX}
#DescriptionBegin
# Provides custom insets for specifying python scripts
# to run. To be used with the converter pLyX.py which
# exports from LyX to pLyX format. 
#DescriptionEnd
#
#v.1.0 2013-01-01
#Author: Andrew Parsloe 
#
Preamble
\newcommand{\pLyXgobble}[1]{}
EndPreamble

# All inset names begin with a full stop
# to aid alphabetical grouping
 MultiPar   1   

#(upper-case initial letter for this inset only)
InsetLayout "Flex:.Run script(s)"
  LyXType   custom
  LatexType command
  LatexName pLyXgobble
  Decorationclassic
  ContentAsLabel0
  Font
Miscno_emph
Miscno_bar
Miscno_noun
Miscno_strikeout
Miscno_uuline
Miscno_uwave
Family  roman
Series  medium
Shape   up
Sizenormal
Color   none
  EndFont
  LabelFont
Color   blue
  EndFont
  LabelString   "Run script(s)"
  MultiPar  1
  ResetsFont0
  Spellcheck0
End

InsetLayout Flex:.[argument]
  CopyStyle "Flex:.Run script(s)"
  ContentAsLabel1
  LabelFont
Color   none
  EndFont
  LabelString   .
  FreeSpacing   0
End

InsetLayout "Flex:.expand macro|txtmacs"
  CopyStyle "Flex:.Run script(s)"
  ContentAsLabel1
  LabelString   Macro
  FreeSpacing   0
End

 MultiPar   0   

InsetLayout Flex:.stop|break
  CopyStyle "Flex:.Run script(s)"
  LabelString   Stop
  MultiPar  0
End

InsetLayout "Flex:.calculate formula|calcul8"
  CopyStyle "Flex:.Run script(s)"
  ContentAsLabel1
  LabelString   Calculate
  MultiPar  0
End

InsetLayout "Flex:.sort 

The pLyX system: sorting tables and lists

2013-01-01 Thread Andrew Parsloe
There are four scripts attached with this email and one 
compressed-format LyX document:


sortable.py, sortable_help.py -- a script for sorting tables in LyX, & 
its help file
sortlist.py, sortlist_help.py -- a script for sorting lists in LyX, & 
its help file

pLyXSorting(compressed).lyx -- an explanatory document with examples

The LyX document is in compressed LyX format. For the examples to work 
it must be saved in uncompressed format. (The pLyX system depends on LyX 
files being *text* files.) It contains some example tables and a 
substantial multi-level list to play with.


The table sorting script reworks for the pLyX system a script aired on 
this list back in September. On the developer's list I've noticed recent 
work to swap columns or swap rows in tables. I imagine once that is 
done, the next step will be hard to resist: go the whole way and sort 
the table. This might be a short-lived script.


The list sorting script is new and was harder to write because of the 
recursive calls to the sorting routine required by the (possible) 
presence of sub-lists. My underlying interest in sorting lists arose 
from a wish to sort indexes. (With their headings, subheadings, 
sub-subheadings, ... the logic is the same.)


Andrew


def helpnote(hv):
if hv > 1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort table
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (15 December 2012) Columns can be sorted more than once for
 inter-filed mixed-case alphabetical sorting.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.4 (1 November 2012) First version for pLyX system.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.3 (17 September 2012) Use of custom insets; yellow notes option,
 hrules and vrules preserved.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 September 2012) Script now ignores ERT insets.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (12 September 2012 Table sorting script posted to user's list.
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort the
\emph on
 rows
\emph default
 by the values in specified columns.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Global options
\end_layout
\begin_layout LyX-Code
\family roman
-
\series bold
h  --help
\series default
  show this help note.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-v --version
\series default
  show version information.
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
-n  --notes
\series default
make LyX's (yellow) notes sortable; notes are
 sort-neutral by default.
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout LyX-Code
\family roman
\series bold
Local options
\end_layout
\begin_layout LyX-Code
\family roman
A sort specification is a sequence like 
\series bold
2a3A1+
\series default
 (or 
\series bold
2a 3A 1+
\series default
 or 
\series bold
2a
\series default
,
\series bold
 3A
\series default
,
\series bold
 1+
\series default
, etc.) where the number indicates the column and the qualifying letter or
 sign indicates the kind of sort. A specification may involve from one to
 all columns in the table and a column may appear in the spec. more than once.
 The primary sort is by the first column specified, the secondary sort by
 the second column, etc. 
\end_layout
\begin_layout Itemize
\family roman
\series bold
a, A, +
\series default
 indicate ascending sorts; 
\end_layout
\begin_layout Itemize
\family roman
\series bold
z, Z, -
\series default
 indicate descending sorts; 
\end_layout
\begin_layout Itemize
\family roman
letters indicate alphabetical sorts, uppercase indicating case sensitivity;
\end_layout
\begin_layout Itemize
\family roman
\series bold
+, -
\series default
 indicate numerical sorts.
\end_layout
\begin_layout LyX-Code
\family roman
The 
\emph on
next
\emph default
 and subsequent rows of a table following a sort specification are sorted.
 For neat alphabetical sorts involving inter-filed mixed case, specify columns
 twice, e.g. 
\series bold
1a1A
\series default
 for an AaBbCc ... sort, or
\series bold
1a1Z
\series default
 for an aAbBcC ... sort.
\end_layout
'''




def helpnote(hv):
if hv > 1:
return header + version
else:
return header + tail

header = r'''\begin_layout LyX-Code
\family roman
\series bold
.sort list
\end_layout
'''
version = r'''\begin_layout LyX-Code
\family roman
Version 1.0 (16 December 2012) Allow secondary, tertiary, etc. sorts.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.2 (13 December 2012) Include -a and -n options.
\end_layout
\begin_layout LyX-Code
\family roman
Version 0.1 (8 November 2012)
\end_layout
'''
tail = r'''\begin_layout LyX-Code
\family roman
Sort one or more lists and sub-lists.
\begin_layout LyX-Code

\end_layout
\begin_layout 

The pLyX system: text macros

2013-01-01 Thread Andrew Parsloe

There are three files attached to this posting:

txtmacs.py, txtmacs_help.py -- a script implementing a system of text 
macros in LyX, and its help file
pLyXTexTMacros(compressed).lyx -- an explanatory document (with nearly 
670 text macros just waiting to be expanded)


The explanatory document must be saved in *uncompressed* format for the 
examples in it to work. It explains where to put the python scripts and 
then launches into an extensive explanation of how to use the system.


While I was working on a table sorting script in September, there was a 
brief exchange on the Developer's list about text macros. It occurred to 
me that the scheme of exporting from .lyx to .lyx then doing a 
buffer-reload might lend itself to a text macro implementation. This 
started out as a system of expanding abbreviations (which could be 
nested one within another). Almost immediately I found that an 
'abbreviation' could be essentially any LyX construct -- a word, a 
phrase, a paragraph, a number of paragraphs, an equation, inline or 
display, a picture, an inset, essentially anything.


Then the code generalised so that the abbreviations could take 
arguments. Thus a macro [hg] might, by itself, expand to 'hyperbolic 
geometry' but presented with an argument, [hg](H), would expand to 
'Hyperbolic geometry', meaning it could be used within and at the start 
of sentences. With 3 well-chosen keyboard shortcuts, I found macros 
provided a more convenient way of inserting character styles than 
presently available (in my opinion) in LyX. Macros also provide the easy 
insertion of LyX menu selections (as in the LyX manuals) with their sans 
serif formatting and menu separation character. And they enable the 
insertion of a specified number of any given character -- 47 asterisks 
perhaps, or 34 smileys.


There are conditionals available which enlarge the scope of what is 
possible. In fact it is all very new to me and I don't know what is 
possible. But the basic system has proved undeniably useful, and I 
wouldn't consider undertaking any substantial writing task in LyX now 
without this facility to hand.


Andrew

# Define and expand text macros in a LyX document.
# Part of the pLyX.py system; not an independent script
#
# txtmacs.py 
#
# Andrew Parsloe (apars...@clear.net.nz)
#
##

import re, argparse

bs1 = '\n\\backslash\n1\n'
macdict = {'toggle': [[], ''], 'if0': [[''], bs1], 'if1': [[''], bs1],
   'peel': [[''], bs1]}

def main(infl, outfl, options, guff):
'''Expand text macros.'''
  
flex_arg = r'\begin_inset Flex .[argument]'
begin_layout = r'\begin_layout'
end_layout = r'\end_layout'
begin_inset = r'\begin_inset'
end_inset = r'\end_inset'
begin_note = r'\begin_inset Note Note'
bkslash = '\\'
backslash = '\\backslash\n'
status_open = 'status open\n'
status_coll = 'status collapsed\n'

re_macro = re.compile(r'(\w+)\n*(\w*)\s*(\d*)\s*$')
re_lyxcmds = re.compile(r'(\\\w+) \w+')
underscores = set([begin_layout, begin_inset, end_layout, end_inset])
charstyles = ['\\family', '\\series', '\\shape', '\\size', '\\emph', \
  '\\noun', '\\underbar', '\\strikeout', '\\uuline', \
  '\\uwave', '\\no_emph', '\\no_noun', '\\no_strikeout', \
  '\\no_bar', '\\no_uuline', '\\no_uwave']

def output(depth, L):
# write to file only at top level
if depth == 0:
outfl.write(L)
return ''
else:
return L

def defaults(s):
'''Return used charstyles to default states.'''
temp = r''
for y in (set(re_lyxcmds.findall(s)) - underscores):
if y == r'\color':
temp += y + ' inherit\n'
elif y == r'\lang':
temp += y + ' english\n'
elif y.lower() in charstyles:
temp += y + ' default\n'
return temp

def expand(mname, sup_args, depth):
'''Expand the macro (recursively if necessary).'''
# substitute values for placeholders
macexp = macdict.get(mname)[1]
macprms = macdict.get(mname)[0]
num_params = len(macprms)
macprms = ['\n'] + macprms[:num_params - len(sup_args)] + sup_args
for i in range(num_params, -1, -1):
macexp = macexp.replace('\n\\backslash\n' + str(i), macprms[i])
# replace macro & inset with its expansion
#  & expand included macros
store = scan(iter(macexp.splitlines(True)), depth + 1)
# return char styles to defaults
store += output(depth + 1, defaults(macexp))
return store

def strip_outers(stuff):
'''Strip enclosing layout statements.'''
stuff = stuff.partition('\n')[2]
stuff = stuff.rpartition(end_layout)[0]
return stuff

def inset_contents(iterable, keepouters):
'''Get contents of inset +/- outer layout 

Re: The pLyX system

2013-01-01 Thread Richard Heck

On 01/01/2013 05:16 AM, Andrew Parsloe wrote:
Sometime in the first half of last year (2012) I discovered that LyX 
allowed one to export from a file with extension .lyx to a file with 
extension .lyx. What was needed to make the process work was a 
different file format name, something other than Lyx. The point of 
doing so was that during the export process one could manipulate the 
file in various ways with a script and then do a buffer-reload to 
overwrite the current document with the altered file. With the speed 
of modern computers, the whole process felt as if it were built-in to 
LyX -- there was no interruption to work flow. Rather like ERT, the 
process offered a means of plugging gaps in LyX's functionality (like 
sorting for instance).


I accumulated a variety of scripts to perform a variety of tasks, 
thinking I needed a new file format name for each script. That became 
unwieldy. Then it occurred to me that only one script was needed, a 
master script, which would launch a secondary script to do the actual 
export processing depending on a signal in the document. The signal is 
provided by a custom inset. This is 'the pLyX system' offered in the 
attached files to this posting and in two associated postings.


I would suggest that, for now, you create a page on the LyX wiki, and 
put all of this explanation, and these files, there. Better yet, for the 
files, create a git repo on github (or somewhere) and point at it.


Presumably, this could evolve to the point we'd include it in LyX, but 
obviously we need to see how it works first.


Richard



Re: how to install lyx 2.0.5 if you have full miktex 2.9 installed

2013-01-01 Thread Uwe Stöhr

Am 19.12.2012 09:30, schrieb Gyorgy SZEIDL:


if i choose

LyX-2.0.5-Bundle-4.exe 
 (~200 MB)

then i am made to install a basic miktex which i
do not need at all. (as a matter of fact i have a full
miktex (32 bit) installation which i use with winedt 7.0 )


You can nevertheless use the bundle installer. The installer will detect the existing MiKTeX on your 
PC and not override it.



if i choose

LyX-2.0.5-Installer-4.exe 
 (~35 MB)

then i am supposed to have an older installation which
i do not have.


No, you are only supposed to have MiKTeX installed - what is the case for you.


a last question: can lyx work together with miktex 2.9 64 bit?


Yes.

I just released a new Windows installer that fixes some bugs that could occur when LyX is installed 
the first time on a PC. You can download it from here:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

regards Uwe


Re: Italics... in the table-of-contents

2013-01-01 Thread Uwe Stöhr

Am 29.12.2012 12:58, schrieb  Frederick FN Noronha फ्रेड्रिक नोरोन्या *فريدريك 
نورونيا :


Is there some way I could convert particular words in the TOC (table of
contents) into italics? Can't seem to be able to select words in the
addcontentsline entry for italicisation:

\addcontentsline{toc}{chapter}{Preliminary Note: The Relevance of Modo
Goano}


It works for me fine:
Either use the short title and emphasize a word there or emphasize a word in the \addcontentsline 
command. Attached is my LyX example file.


regards Uwe


Neues_Dokument1.lyx
Description: application/lyx


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 00:46, schrieb Filip:


every time I try to install Lyx 2.0.5 on my Windows 7 64bit, it freezes.
Here is screenshot of installation window
http://imageshack.us/photo/my-images/534/lyxl.jpg/


I encountered the same problem recently and therefore already fixed the bug. Since ysterday the new 
LyX installer (version 5) is available:

https://sourceforge.net/projects/lyxwininstaller/
(will soon also be on ftp.lyx.org)

Please try it and report back.

regards Uwe


Re: Installation freezes

2013-01-01 Thread Uwe Stöhr

Am 23.12.2012 23:23, schrieb Paul A. Rubin:


The bundle installer installs MiKTeX and LyX, then launches the configuration
script, which looks for various MiKTeX packages (quite a few of them, actually)
by running tiny LaTeX jobs that require them. The default behavior for MiKTeX's
package manager (mpm.exe) when LaTeX requires a package not currently installed
is to go off to the Internet and download the package. Given the number of
packages sought by the configuration script, this can take a considerable amount
of time, during which the installer looks as if it's stuck (it's not -- it's
just waiting for the configuration script to complete). If you don't have a live
Internet connection, I think mpm will wait indefinitely for one (in which case
the installer really is stuck).


That was not the bug. The problem was either an infinite loop when the installer attempted to 
initialize the spellcheck dictionary installation or the problem that the path to the latex.exe was 
misread by the installed (see in Filips's screenshot the double "\\").


regards Uwe

p.s. Can you please try out the new installer and report back?
here is the changelog of the new version:

Changelog for LyX-205-5:
Bugfixes:
- fix bug that installer stopped working if LyX was installed
  the first time on a computer
- fix failing installation of Slovakian spellcheck dictionary
- prevent case that the installer could run an infinite loop if the
  installation of dictionaries was interrupted
- added missing files to the installer source zip-file so that it can now 
really be
  used to compile the installer
- updated to Qt 4.8.4 (Fixes a problem that with some screen font zooms, lines 
and dots disappeared.)

New features:
- give feedback about the state of the package installation
  (Especially if LyX is installed the first time, the package installation can 
take several minutes.
   Now the installer prints in the progress window the name of the package that is currently 
installed.)

- the installer supports now the usage of TeXLive as LaTeX distribution.
  (TeXLive must be manually installed before LyX.)
- updated spell-checker dictionaries for Scottish and Swedish
  (To benefit from them you must uninstall an already installed LyX 2.0.x and
   then use this installer.)
- updated thesaurus for Slovenian
  (need to reinstall LyX to benefit from this)
- updated Hungarian, Indonesian and Swedish translation of the installer 
messages
- new Basque translation of the installer messages


Re: Lyx 2.05 for Windows can't export any PDF

2013-01-01 Thread Uwe Stöhr

Am 18.12.2012 00:21, schrieb Douglas Leadenham:


I recently upgraded from Lyx 2.0 to 2.0.5, and now the software will not make
any PDF files.  Worse, the editors of the journal I'm trying to submit to will
not take plain Latex.  Can you help, please?


Please try this:

1. uninstall all versions of LyX 2.x _completely_
2. open an Internet connection
3. reinstall LyX 2.0.5 using the latest installer:
http://sourceforge.net/projects/lyxwininstaller/

The installer asks you to update MiKTeX, please do so.
Afterwards please update again MiKTeX manually.

regards Uwe


Re: The pLyX system

2013-01-01 Thread Liviu Andronic
On Tue, Jan 1, 2013 at 4:32 PM, Richard Heck  wrote:
> all of this explanation, and these files, there. Better yet, for the files,
> create a git repo on github (or somewhere) and point at it.
>
Could we have a 'wiki' branch on our GIT server? So that contributed
files (modules, scripts, etc.) remain in-house, and contributors can
commit their files there?

Liviu


Re: Using Mac Lion Dictate

2013-01-01 Thread Uwe Ade
Hey Anna

I sometimes use Mac Lion Dictate with Lyx and it works direkt out of the box. I 
work with Lyx 2.04. Its nessecary that the focus is on lyx, that mean, the 
Cursor has to be in the Document in witch you want dictate.

Sincerly

uwe


Am 31.12.2012 um 14:28 schrieb Anna Maria Obertacke :

> Hallo,
> 
> I use Lyx for years with Mac for my study.
> 
> Is it planned to support Mac OS Lion build-in dictation?
> http://support.apple.com/kb/HT5449
> 
> Or is it a bug, that it does not work?
> 
> I can start dictation by pressing Fn twice, but after speaking no text is 
> inserted. 
> Other writing applications work well, but I want to use only Lyx.
> 
> Best regards, 
> 
> Anna
> 
> 
>