making \citep the default natbib citation style?

2010-03-11 Thread Justin Wood
Hi all. The usual apologies for asking a dumb and/or tired question, but I
have hunted through the list archive and online in general to no avail.

[System: LyX 1.6.5 on Mac OS X 10.6.2]

I'm using natbib citation style, set to *author-year*, with a 3rd party
style file for Chicago
format.
This works perfectly. As is normal in Chicago -- unless mentioning the
author name(s) explicitly in the text -- I use the *parenthetical *citation
format of *(Jones, 2001)*, which is readily provided by natbib's
*\citep*command. So far so good.

However, when LyX initially inserts a citation from a *new* reference not
previously used, it defaults to the *textual *citation format: natbib's *
\citet* command. This is not what I need. I can of course change any such
citation to parenthetical (\citep), or any of the other options, quite
simply with the GUI, but I would dearly love to be able to specify which
citation format is the *default*. As a workaround I can redefine the \citet
command using something like: \renewcommand{\citet}{\citep}. That nicely
changes the citation style to parenthetical in any output file.

But there are two problems with that kludge. One, I can't then use \citet if
I genuinely want to in the same document for some reason. And two, it still
displays as textual in LyX itself -- which may or may not be a real issue,
depending on how pedantic you are (and I am).

So is there any way in the natbib configuration, in LyX itself, or with some
other LaTeX preamble, that I can change the default insert-citation to be
\citep?

Thanks! And big respect to the general LyX community for this excellent
tool.

PS - for the most part my citations are inserted via lyxpipe using this
tasty little plugin for Zotero :
LyZ
.
~:justin.wood :~ ≤ 350ppm
CO2-eq


LyX 2.0 Native HTML export

2010-03-11 Thread john
Will the upcoming export to HTML support making separate web pages for
each subsection and provide overall navigation (in the manner of
latex2html) ?

John O'Gorman


announce: template to write Ph.D. theses with LyX

2010-03-11 Thread Uwe Stöhr

Dear LyX users,

there was often the question on this LyX how to write a thesis with LyX. There are many templates 
available on the Internet but LyX itself does not yet have one. The next major LyX version 2.0 will 
have one.


The template can be found here as ZIP-file:
http://fkurth.de/uwest/LyX/ThesisTemplate/Diss-Template.zip

It is designed to give people a starting point. The template is slightly minimalistic but highly 
customizable. It shows how to handle child documents and section headers.
The included BibTeX example files gives an overview about the different possible BibTeX entries and 
their formattings (e.g. how to handle chemical equations in titles, or how to cite standards).


Please give it a try and report what you think that should be changed.

thanks and regards
Uwe


RE: Realistic Size Limit in LyX

2010-03-11 Thread Rob Oakes
Dear LyX Users,

Thank you everyone for the very helpful recommendations.  I finally narrowed 
down what my problem was.  Turns out, it wasn't related to RAM, LaTeX, LyX or 
number of floats.   (Just for the record, XeLaTeX and LyX 2.0 are doing a 
marvelous job with 153 figure and table floats and more than 300 individual 
images.  I think that is rather neat.)

The problem is related to my very complicated Ubuntu installation.  I've been 
using LyX from within a VMware virtual machine on my MacBook Pro.  I do this 
because managing packages within Ubuntu is very easy and trying to make things 
work on Mac can be very hard.  (After much trial and error and otherwise head 
banging, I've just decided to run a virtual instance of Ubuntu.)

Anyway ... I have a number of shared directories so that I can access my files 
from both operating systems.  I've noticed on a number of occasions that Ubuntu 
crawls to a halt if the drive happens to be busy.  I think this is due to the 
way that VMware implements shared folders, but I honestly don't know.  But as 
all of my files are stored on the main hard drive (not in the virtual machine), 
launching xelatex with a large file will often cause Vmware to hang.  It also 
so happens that trying to convert a large SVN repository to a Bzr branch will 
cause the same thing.

For the past three days, I have been converting one of our larger SVN repos 
into a Bzr branch so that we could open source the code (of course, this was 
being done in the Ubuntu virtual machine).  As soon as the conversion finished, 
I found that I was no longer able to reproduce my problem.  The book magically 
started to compile without problems.

It turns out that the errors I was receiving were due to individual instances 
of xelatex  stalling and then getting killed by the OS.  That is why I was 
seeing bizarre errors in the debug screen of LyX, the xelatex jobs weren't 
finishing completely and subsequent runs were unable to correctly parse the 
code.  Once the hard drive was no longer busy, xelatex was able to successfully 
complete it's run and create a beautiful PDF of the book.

Not sure what the moral of this story should be, but at least I can report that 
the problem has been solved.

Cheers,

Rob



Re: Did I ever mention how much I like LyX?

2010-03-11 Thread john
Steve Litt wrote:
> Hi all,
>
> Did I ever mention how much I like LyX? It's wonderful. I'm writing my new 
> book right now, and LyX is so easy and transparent that I'm pounding out an 
> average of 3,000 words per day. LyX just stays out of your way and let's you 
> whomp out content. It's great.
>
> Thanks to the developers for making this great bookmaking software, and the 
> community for making it better and providing information.
>   
Amen to that!
It's my favourite piece of software and has been for more than a decade!

John O'Gorman

> SteveT
>
> Steve Litt
> Recession Relief Package
> http://www.recession-relief.US
> Twitter: http://www.twitter.com/stevelitt
>
>
>
>   



Blogging with LyX

2010-03-11 Thread Jack Desert
For those of you who are interested in using LyX as a blog editor, I
have put together a tool called LyxPoster. You
can read about it at
http://letseatalready.com/2010/03/08/lyxposter-blogging-with-lyx/

-Jack

-- 
~~~
Jack Desert --Writer, Entrepeneur
Author and Spokesman: www.LetsEATalready.com
Software Developer:   http://GrooveTask.org
Email: jwo...@gmail.com
Phone: (208) 366-6059
~~~


Re: Realistic Size Limit in LyX

2010-03-11 Thread Les Denham
On Thursday 11 March 2010 06:41:05 Helge Hafting wrote:
> Possible fixes for float problems:
> * Upgrade your latex, if possible. May also help with
>other limits.
> * Make sure you don't have an "unplaceable float". Typically
>one that is bigger than a page, so it forces all floats
>to the end of the chapter/book. And that don't work
>if there are "too many".
> * Fewer floats, but you probably doesn't want that.
> * More text between floats, so one float can be placed before
>the next is issued. If some "clearpages" help, then more
>text in those locations will help too.
>If you started by outlining with some headings and then
>added all your figures before writing the text, then
>you might get such trouble.
> * Merge adjacent floats into a single float containing
>several figures. (You can still have several numbered captions
>and cross-reference each of them.)
> * Reduce the size of some figures, placement becomes easier
>for latex.
> 
> If your problems aren't float-related, then this isn't
> likely to help.
> 
If it helps, I have written a document with 197 floats on 165 pages in the 
output PDF file.  While working on it, I did have problems with floats.  Here 
is how I fixed it:

1. Put the following in the Preamble:
  \usepackage{morefloats}
  \renewcommand{\bottomfraction}{.7}
  \renewcommand{\textfraction}{.05}

2. Put \clearpage (in ERT) at the end of each of 12 chapters.

That's all it took.  I did this over two years ago, when I was a few versions 
back for LyX, and I think I was still using a fairly ancient version of TeTeX.

Les

-- 
Les Denham
---
http://www.hal-pc.org/~ldenham
---
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


bubbles IDE... making a splash. Some ideas useful for organizing text too (LyX could adopt)

2010-03-11 Thread Jose Quesada
Hi All,

There's a new concept for an IDE going around.
It's called bubbles IDE... making a splash. From slashdot:
covered on hacker news too http://news.ycombinator.com/item?id=1181742
*A team at Brown University has developed an IDE for Java called Code
Bubbles that makes a fairly radical departure from current IDEs — it is based
on fragments instead of
files
. *
 Some ideas useful for organizing text too (LyX could adopt). The basic
idea: Mindmap + IDE = great

The way I write in LyX uses many files. In many editors there's a clumsiness
of going from one file to another and then back to the original. This bubble
idea could go a long way.

I thought I'd drop it here. LyX has the best outliner I know of, but it'd be
good to keep an eye on new concepts.

Best,
-Jose

Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition,
Berlin
http://www.josequesada.name/
http://twitter.com/Quesada


Re: Did I ever mention how much I like LyX?

2010-03-11 Thread Jose Quesada
I have to say... +1.
Very glad I found LyX.
Best,
-Jose

Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition,
Berlin
http://www.josequesada.name/
http://twitter.com/Quesada


On Thu, Mar 11, 2010 at 10:50 PM, Julio Rojas  wrote:

> I'm right now trying to finish a paper in OO with OOLaTeX. It has to
> be submitted in Word format. A total nightmare!!! This is the moment
> when I really know how good Lyx is. Thank you very much to the hard
> working developing team.
> -
> Julio Rojas
> jcredbe...@gmail.com
>
>
>
> On Thu, Mar 11, 2010 at 10:46 PM, jezZiFeR 
> wrote:
> > Yes, LyX is great indeed, and it gets even better with every update. It
> is
> > the most important software for me. Thanks to developers also from my
> part.
> > Thanksthanksthanks*!
> >
> >
> >> Did I ever mention how much I like LyX? It's wonderful. I'm writing my
> new
> >> book right now, and LyX is so easy and transparent that I'm pounding out
> >> an
> >> average of 3,000 words per day. LyX just stays out of your way and let's
> >> you
> >> whomp out content. It's great.
> >>
> >> Thanks to the developers for making this great bookmaking software, and
> >> the
> >> community for making it better and providing information.
> >>
> >> SteveT
> >
>


Re: Did I ever mention how much I like LyX?

2010-03-11 Thread Julio Rojas
I'm right now trying to finish a paper in OO with OOLaTeX. It has to
be submitted in Word format. A total nightmare!!! This is the moment
when I really know how good Lyx is. Thank you very much to the hard
working developing team.
-
Julio Rojas
jcredbe...@gmail.com



On Thu, Mar 11, 2010 at 10:46 PM, jezZiFeR  wrote:
> Yes, LyX is great indeed, and it gets even better with every update. It is
> the most important software for me. Thanks to developers also from my part.
> Thanksthanksthanks*!
>
>
>> Did I ever mention how much I like LyX? It's wonderful. I'm writing my new
>> book right now, and LyX is so easy and transparent that I'm pounding out
>> an
>> average of 3,000 words per day. LyX just stays out of your way and let's
>> you
>> whomp out content. It's great.
>>
>> Thanks to the developers for making this great bookmaking software, and
>> the
>> community for making it better and providing information.
>>
>> SteveT
>


Re: Did I ever mention how much I like LyX?

2010-03-11 Thread jezZiFeR
Yes, LyX is great indeed, and it gets even better with every update.  
It is the most important software for me. Thanks to developers also  
from my part.

Thanksthanksthanks*!


Did I ever mention how much I like LyX? It's wonderful. I'm writing  
my new
book right now, and LyX is so easy and transparent that I'm pounding  
out an
average of 3,000 words per day. LyX just stays out of your way and  
let's you

whomp out content. It's great.

Thanks to the developers for making this great bookmaking software,  
and the

community for making it better and providing information.

SteveT


Re: catdoc (from .doc to ascii/TeX)

2010-03-11 Thread stephen's mailinglist account
2010/3/10 Νίκος Αλεξανδρής :
> Just FYI,
>
> if you don't know already the tool 'catdoc' (quotting from its official
> web-page [1]):
>
>  "is program which reads one or more Microsoft word files and outputs
> text, contained insinde them to standard output."
> ...
>
>  "Optionaly, catdoc is able to translate some non-ASCII chars into
> correspoindig TeX escape sequences and convert charsets from Windows
> ANSI codepage to local codepage of target machine."
>
>
> I ran a quick test on a "greek" .doc file and it looks good (=gives
> clean text). The "Import > MS-Word..." tool from within LyX gave a very
> messy content.
>
> Regards, Nikos
>
> ---
> [1] http://wagner.pp.ru/~vitus/software/catdoc/
>

That could be very handy - particularly if you can clean-up characters
that TeX/LaTeX/LyX  don't t recognise

-- 
Stephen


Did I ever mention how much I like LyX?

2010-03-11 Thread Steve Litt
Hi all,

Did I ever mention how much I like LyX? It's wonderful. I'm writing my new 
book right now, and LyX is so easy and transparent that I'm pounding out an 
average of 3,000 words per day. LyX just stays out of your way and let's you 
whomp out content. It's great.

Thanks to the developers for making this great bookmaking software, and the 
community for making it better and providing information.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt



Re: How to tell Lyx to use a different Tex installation?

2010-03-11 Thread Ignacio Garcia
Stefano Franchi  writes:

> 
> Suppose I have two complete TeX installation trees:
> 
> 1. /usr/share/texlive/*
> 
> 2. /usr/local/texlive/2009/*
> 
> Is there any way to tell Lyx to switch from (1) to (2) (and back)? Reading 
> the 
> manuals proved unhelpful. Perhaps I am looking in the wrong places?
> 

I have texlive-2007 deb/ubuntu packages (executables in /usr/bin)
and the texlive-2009 in /usr/local directory (executables in ... see below)
By default LyX use 2009 because in my .bashrc file I added the line

PATH=/usr/local/texlive/2009/bin/x86_64-linux:$PATH; export PATH

Then the active latex is 2009.

If I want to test anything using texlive-2007 (hardly ever),
I comment (#) the above line and then the active latex is the
one from the default PATH, i.e. /usr/bin, i.e. texlive-2007.  

You can test the running latex with 'tex --version' command



Re: How to tell Lyx to use a different Tex installation?

2010-03-11 Thread Paul A. Rubin

rgheck wrote:

On 03/11/2010 10:58 AM, Stefano Franchi wrote:

Suppose I have two complete TeX installation trees:

1. /usr/share/texlive/*

2. /usr/local/texlive/2009/*


Is there any way to tell Lyx to switch from (1) to (2) (and back)? 
Reading the

manuals proved unhelpful. Perhaps I am looking in the wrong places?

   
You could give the complete path in the LaTex-->DVI converter settings, 
I think.




That will steer you to one or the other version of the LaTeX executable, 
but what happens when it tries to load a class or style file -- will it 
look in the correct texmf database?  If latex runs another executable, 
will it grab the right one, or the first one on the system command path?


There should be a way to specify the TeX tree root via an environment 
variable (and run LyX within a shell that sets the variable one way or 
the other), but I don't know it off hand.


/Paul



Re: How to tell Lyx to use a different Tex installation?

2010-03-11 Thread BH
On Thu, Mar 11, 2010 at 11:20 AM, stefano franchi
 wrote:
>
>
> On Thu, Mar 11, 2010 at 10:07 AM, BH  wrote:
>>
>> On Thu, Mar 11, 2010 at 10:58 AM, Stefano Franchi
>>  wrote:
>> > Suppose I have two complete TeX installation trees:
>> >
>> > 1. /usr/share/texlive/*
>> >
>> > 2. /usr/local/texlive/2009/*
>> >
>> >
>> > Is there any way to tell Lyx to switch from (1) to (2) (and back)?
>> > Reading the
>> > manuals proved unhelpful. Perhaps I am looking in the wrong places?
>>
>> Preferences > Paths > PATH prefix?
>>
>
>
> I checked that, but there is no "Tex path" or "Latex Path"

But the order you put paths there determines the order LyX will check
for executables like latex, so I think changing the PATH prefix will
do what you want. (I haven't tested it, though.)

>> (On Mac the TeX Distribution preference pane that comes with TeXLive
>> can switch it system wide.)
>>
>
> I am on Linux/Ubuntu.  Are you referring to a TeXLive preference that can be
> set (and is presumably platform-neutral)?

No -- as far as I know, this is Mac only. (There may be equivalent
functionality for Linux or Windows, but I just don't know what it is.)

BH


Re: Python-generated diagram as "external material"

2010-03-11 Thread Julien Rioux
> > I haven't seen any description for "UpdateCommand" anywhere.
> 
> I saw it in another posting to this list, and there's a few other
> similar examples that use it on the web:
> http://www.google.com.au/#hl=en&q=lyx+%2BUpdateCommand

OK. Interesting. In fact it has been removed because it could be wrongfully
exploited. See this post [1] from Angus Leeming:

"Interestingly, the LyX 1.4.x series uses the converter mechanism to 
convert files. Ie, the "Update Command" line no longer exists in the 
template file so the templates themselves are now perfectly safe."

> I can define a new Python file format, but strangely, no matter what
> I do the "Add" button in the converters section is greyed out. I can
> only create the converter by editing and saving over an existing
> converter in the list.

Good luck navigating the unconventional interface. Once you change the formats
you actually create a new converter. Did it work?

> > Once you have that I believe it will work. In fact once you have
> > that you could simply use the graphics inset in the usual way to
> > insert your .py file, that is, no need for an external material
> > template.
> 
> Makes sense, but then what are the external material templates actually
> meant to be used for?

External material is the only option if the stuff to be included is not suited
for a \includegraphics command. In your case you can do it either way. It seems
more natural to use Insert > Graphics.

> 
> J
> 

Cheers,
Julien

[1] http://www.mail-archive.com/lyx-de...@lists.lyx.org/msg66742.html




Re: How to tell Lyx to use a different Tex installation?

2010-03-11 Thread rgheck

On 03/11/2010 10:58 AM, Stefano Franchi wrote:

Suppose I have two complete TeX installation trees:

1. /usr/share/texlive/*

2. /usr/local/texlive/2009/*


Is there any way to tell Lyx to switch from (1) to (2) (and back)? Reading the
manuals proved unhelpful. Perhaps I am looking in the wrong places?

   
You could give the complete path in the LaTex-->DVI converter settings, 
I think.


rh



Re: How to tell Lyx to use a different Tex installation?

2010-03-11 Thread BH
On Thu, Mar 11, 2010 at 10:58 AM, Stefano Franchi
 wrote:
> Suppose I have two complete TeX installation trees:
>
> 1. /usr/share/texlive/*
>
> 2. /usr/local/texlive/2009/*
>
>
> Is there any way to tell Lyx to switch from (1) to (2) (and back)? Reading the
> manuals proved unhelpful. Perhaps I am looking in the wrong places?

Preferences > Paths > PATH prefix?

(On Mac the TeX Distribution preference pane that comes with TeXLive
can switch it system wide.)

BH


How to tell Lyx to use a different Tex installation?

2010-03-11 Thread Stefano Franchi
Suppose I have two complete TeX installation trees:

1. /usr/share/texlive/*

2. /usr/local/texlive/2009/*


Is there any way to tell Lyx to switch from (1) to (2) (and back)? Reading the 
manuals proved unhelpful. Perhaps I am looking in the wrong places?

Thanks,

S.




__
Stefano Franchi
Department of Philosophy  Ph:  (979) 862-2211
Texas A&M University  Fax: (979) 845-0458
305B Bolton Hall  fran...@philosophy.tamu.edu
College Station, TX 77843-4237


Re: start Abstract,Acknowledgement, and each chapter with odd page number

2010-03-11 Thread Julien Rioux
Sajjad  writes:

> 
> Hello Juilen,
> 
> I have tried this, but i am getting blank pages with some chapters.
> 
> Regards
> Sajjad
> 

Sorry, I must have misunderstood what you are trying to accomplish.  If you
insert Clear Double Page in a two-sided document, what follows will start on a
odd page.  That could require an entire blank even page to be inserted in the
output, if necessary.  That's what I would expect in two-sided documents; books,
for example.

Cheers,
Julien




Re: Fwd: Background color for sections or subsection

2010-03-11 Thread Uwe Stöhr

pierre delaunoy schrieb:

In fact, I only want to have a background color for the title of section 
or for the title of a subsection. Sorry for the misunderstanding


In the file attached, is it possible to have "1.1 Programme 0 - 
Subsistance administration - Enseignement et recherche" with a 
background color and "1.1.1 AB 12.01.02 - Dépenses permanentes pour 
achats de biens non durables et de services" with another one ?


This is possible. But every section in your document should have the 
same color to get a readable book.
(Personally, I don't think it is a good idea to change the background 
color. If colors are really necessary, then better change the color of 
the text.)


I attached a LyX file where I colored the background of all section 
headings and the text color of all subsection headings.


Some further hints for writing a book:

- Better use the book (KOMA-script) or memoir document class. These 
classes provide much more featues than the default book class. For 
example automatic print space calculation, title page formatting, 
binding correction, etc.
(The LyX UserGuide is an example how the power of KOMA-script is uses - 
look at its document settings.)


- If possible, use short titles for all section headings that are 
running in the PDF-output over more than one line. Otherwise the table 
of contents and the PDF bookmarks would become unreadable.


- Don't overuse colors and horizontal lines. Good books use both very 
rarely.


regards Uwe


test_pdy.lyx
Description: application/lyx


Re: Python-generated diagram as "external material"

2010-03-11 Thread Guenter Milde
On 2010-03-11, John K wrote:

>> I think you need to define an input format and a .py -> .pdf converter which
>> runs the python interpreter on your file.

This is an alternative way to the "external inset".

...

>> Try the way I described above: defining the file format and converter
>> under the menu : Tools> Preferences...> File Handling.

> I can define a new Python file format, but strangely, no matter what I
> do the "Add" button in the converters section is greyed out. I can only
> create the converter by editing and saving over an existing converter
> in the list.

The UI is somewhat strange in this area. You can modify an existing
converter + its input/output formats and it will be saved as a new
converter.

Consider a name more specific than Python as input format description,
as there could be also Python scripts requiring other processing or
resulting in a different output format.

>> Once you have that I believe it will work. In fact once you have that
>> you could simply use the graphics inset in the usual way to insert
>> your .py file, that is, no need for an external material template.

> Makes sense, but then what are the external material templates actually
> meant to be used for?

There is external material that does not fit in the converter tool
paradiga. Also, with 'external inset' you can specify parameters in the
LyX document. If these are not needed, defining a Converter is simpler
and enables a preview.

Günter



Re: Realistic Size Limit in LyX

2010-03-11 Thread Helge Hafting

Rob Oakes wrote:

Dear LyX Users,

 


Is anyone aware if there is a realistic limitation on the number of images
you can have in a long document (or the size of the resultant PDF)?
Yesterday, I've run into a problem that I don't know how to solve.

 


I have been working on the "Writing with open source tools" book, but my
overall PDF master document will no longer build.  It fails with an
extremely obscure errors.  Though they vary, the most common contain
reference to:



@@BOOKMARK

 


What is truly bizarre, however, is that if I remove one of several chapter
that has a very large number of images (examples, screenshots, etc), then
the book will compile without problem.  It does not seem to matter which,
I've tested several different configurations and it seems to be overall
number of images that is the problem.  (Also, I've tested all of the
individual chapter files that have been removed, and they all compile.)

 


I am also seeing errors in the debug output (I'm using an SVN version), and
it appears as though the worker thread is timing out.

 


Does anyone know what might be the cause of these problems?  Does LyX or
LaTeX have any kind of limit on the number of files that it can
realistically handle?  I'd be extremely appreciative of any advice.


I don't know of any limits in LyX, except for whatever limits your pc
and operating system have. Hitting those is not likely.

Latex have various limitations, especially for floating material. Is 
your graphics in floats? Floats may float around, bumping into other 
floats. There are some limits on how many floats latex can consider at

the same time.

If "Insert->Formatting->Clearpage" between your floats help, then
you probably hit some obscure "too many simultaneous floats" limit.

Same diagnosis if removing every other float in the chapter helps.
To distinguish between "too many floats" and "too many graphics files",
try dissolving floats instead of removing them. (i.e. the image remain
in the text, but non-floating.) If it helps, then you had a float
problem. If not, then you might have a problem with many files. Try
removing some.

Destructive tests are best done on a copy of your book. :-)

Possible fixes for float problems:
* Upgrade your latex, if possible. May also help with
  other limits.
* Make sure you don't have an "unplaceable float". Typically
  one that is bigger than a page, so it forces all floats
  to the end of the chapter/book. And that don't work
  if there are "too many".
* Fewer floats, but you probably doesn't want that.
* More text between floats, so one float can be placed before
  the next is issued. If some "clearpages" help, then more
  text in those locations will help too.
  If you started by outlining with some headings and then
  added all your figures before writing the text, then
  you might get such trouble.
* Merge adjacent floats into a single float containing
  several figures. (You can still have several numbered captions
  and cross-reference each of them.)
* Reduce the size of some figures, placement becomes easier
  for latex.

If your problems aren't float-related, then this isn't
likely to help.




RE: Python-generated diagram as "external material"

2010-03-11 Thread John K

> John K  writes:
>> I added the following to the Lyx external_templates file:
>>
>> Template Python
>> GuiName "Python: $$AbsOrRelPathParent$$Basename"
>> HelpText
>> Python diagram.
>> HelpTextEnd
>> InputFormat "*"
>
> I think you need to define an input format and a .py -> .pdf converter which
> runs the python interpreter on your file.
>
>> FileFilter "*.py"
>> AutomaticProduction true
>> Preview Graphics
>> Format PDFLaTeX
>> Product "\\includegraphics{$$AbsPath$$Basename.pdf}"
>> Requirement "graphicx"
>> UpdateCommand "python $$AbsPath$$Basename.py"
>
> I haven't seen any description for "UpdateCommand" anywhere. Where does that
> come from? It's not in the documentation, or?

I saw it in another posting to this list, and there's a few other similar 
examples that use it on the web:
http://www.google.com.au/#hl=en&q=lyx+%2BUpdateCommand

>> UpdateFormat pdf
>> UpdateResult "$$AbsPath$$Basename.pdf"
>> Requirement "graphicx"
>> ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
>> FormatEnd
>> TemplateEnd
>>
>> However, when I insert the Python script in Lyx, it draws a box that says
> "Error converting to loadable
>> format".
>
> Yes, because LyX doesn't know how to convert a python file to a graphics file.
> Try the way I described above: defining the file format and converter under 
> the
> menu : Tools> Preferences...> File Handling.

I can define a new Python file format, but strangely, no matter what I do the 
"Add" button
in the converters section is greyed out. I can only create the converter by 
editing
and saving over an existing converter in the list.


> Once you have that I believe it will work. In fact once you have that you 
> could
> simply use the graphics inset in the usual way to insert your .py file, that 
> is,
> no need for an external material template.

Makes sense, but then what are the external material templates actually meant 
to be used for?

J
  
_
Get the latest jobs delivered. Sign up for SEEK Jobmail.
http://clk.atdmt.com/NMN/go/157639755/direct/01/

RE: Python-generated diagram as "external material"

2010-03-11 Thread John K

> John K wrote:
>> 
>> 
>> I am trying to auto-generate a diagram from a Python script in my Lyx 
>> document using the "External Material" function. I have created a Python 
>> script called "myscript.py" which generates a diagram and saves it to 
>> "myscript.pdf". I am trying to make Lyx run my script to generate the 
>> diagram when I export my document to PDF.
>> 
>> I added the following to the Lyx external_templates file:
>> 
>> Template Python
>> GuiName "Python: $$AbsOrRelPathParent$$Basename"
>> HelpText
>> Python diagram.
>> HelpTextEnd
>> InputFormat "*"
>> FileFilter "*.py"
>> AutomaticProduction true
>> Preview Graphics
>> Format PDFLaTeX
>> Product "\\includegraphics{$$AbsPath$$Basename.pdf}"
>> Requirement "graphicx"
>> UpdateCommand "python $$AbsPath$$Basename.py"
>> UpdateFormat pdf
>> UpdateResult "$$AbsPath$$Basename.pdf"
>> Requirement "graphicx"
>> ReferencedFile pdflatex "$$AbsPath$$Basename.pdf"
>> FormatEnd
>> TemplateEnd
>> 
>> However, when I insert the Python script in Lyx, it draws a box that says 
>> "Error converting to loadable format".
> This isn't critical, it merely means you won't get a preview within LyX 
> because of a failure to convert to something displayable. (png, I believe.)
> 
> Of course, this may also be a symptom of what's wrong with the main 
> conversion.
> 
>> If I try exporting to PDF using pdflatex, I get the following error:
>> 
>> "Missing $ inserted. Missing { inserted. I've inserted a begin-math/end-math 
>> symbol since I think you left one out. Proceed, with fingers crossed."
>> 
>> If I export to Latex using pdflatex, it seems to export correctly, and my 
>> text file contains something like this:
>> 
>> begin{document}
>> \includegraphics{C:/Documents and Settings/MyUsername/Desktop/myscript.pdf}
>> \end{document}
>> 
>> However, it doesn't run my update command, i.e. doesn't run the Python 
>> script. (I've even tried changing my update command to things like "echo 
>> test> output.txt" but I can't seem to get any commands to run at all.)
>> 
> That is the problem, and I guess it explains why everything else goes 
> wrong too.
> 
> First thing to check: is python in the path? I.e. can you give the 
> command "python filename.py" on the command line - will that work?
> 
> If python isn't in the path, then LyX won't find it.

Yes, Python is on the path. I tried putting the full path to Python in the 
UpdateCommand as well but that didn't work either. I don't think it's a path 
issue because even a command like "echo test> output.txt" does not work.

> If this succeed, will the latex export then work, as long as  the 
> manually converted file is present?

If I first run the Python script manually and then try exporting the Lyx 
document to PDF (pdflatex), I still get this error:

"Missing $ inserted. Missing { inserted. I've inserted a
begin-math/end-math symbol since I think you left one out. Proceed,
with fingers crossed."

However, if I export to LaTeX (pdflatex), and then open this LaTeX file in 
TeXnicCenter, I can export to PDF with no problems and the Python-generated 
figure shows up correctly.

>> Any ideas what I am doing wrong? I've tried on Lyx 1.6.3 and 1.6.5-1 on 
>> Windows XP.
> 
> Another wild guess: You have a path with spaces in it, e.g. "Documents 
> and Settings". Some versions of LyX can't deal with that. Some can, but 
> you have to take care when a path is passed to external utilities (such 
> as python) Otherwise, you risk that:
> 
> python "C:\documents and settings\folder\file.py"
> becomes
> python "C:\documents" "and" "settings\folder\file.py"
> and the latter just won't work.
> 
> To check if you have space problems, copy the document and all files
> to some space-free path such as C:\test\
> See if that changes anything.

I tried putting everything in to the root directory C:\ but had the same 
problem.

J
  
_
Link all your email accounts and social updates with Hotmail. Find out now.
http://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G