Re: way to add code before \documentclass{}

2012-01-03 Thread Bogdan

On 03-Jan-12 4:11 pm, Richard Heck wrote:

On 01/03/2012 03:45 AM, Guenter Milde wrote:

On 2012-01-01, Bogdan wrote:

On 01-Jan-12 6:07 pm, Uwe Stöhr wrote:

Am 01.01.2012 16:15, schrieb Richard Heck:

On 12/31/2011 05:51 PM, Bogdan wrote:

Is there *any* way to make LyX add latex code before the
\documentclass{} call?

I do not think so.

And I have never seen this and I doubt that this will work because
without loading the document class or any package, you cannot do much.

There are several use cases. I remember a similar request some time
(maybe
years) ago. A "hook" for pre-documentclass code could also solve some
of the
"how do I configure auto-loaded packages" problems.

I could imagine a layout keyword like

PrePreamble
% this should appear before the \documentclass call in the latex source
EndPrePreamble

This could then be used by layouts like "IEEEtranA4" as well as
in idividual documents via the local layout feature.

If this is definitely needed, it is easy to provide it. Adding Layout
stuff is fairly trivial. I guess the question was: Do we need it? or is
there some other way around this?

Richard


I guess the "need" question depends on the time and attitude of the 
devs. I agree that most users probably do not need it and then you as 
devs may argue that you don't want to bother for a minority. However, 
LyX is a truly great piece of software and would be nice to cover all 
user base, not just the majority (granted, the latter could be 
overwhelming).


I for one needed this fairly often for the IEEEtran class. In a reply to 
this thread I pointed to the official IEEEtran FAQ which requires code 
before \documentclass{} in order to set page margins: 
http://article.gmane.org/gmane.editors.lyx.general/73642


I also found older requests for this in the LyX list from users that 
were in the same situation: 
http://article.gmane.org/gmane.editors.lyx.general/50299


In my previous reply to this topic, I provided a hack that makes it 
possible (converter wrapper that parses and replaces the .tex output of 
LyX on the fly based on a placeholder in the LyX document class options 
before passing it to pdflatex). I did it in a matter of minutes so I 
believe (or want to believe) that it's trivial for the devs to add an 
extra text field next to the document class options field for code that 
goes before \documentclass{}.


See my hack here: http://article.gmane.org/gmane.editors.lyx.general/73663

Bogdan.

--
Bogdan Roman, http://www.cl.cam.ac.uk/~abr28/
Computer Laboratory, University of Cambridge



Re: way to add code before \documentclass{}

2012-01-02 Thread Bogdan

On 03-Jan-12 3:18 am, Bogdan wrote:

Whenever the converter is called (view, update, export, etc), the
wrapper will parse and replace the \documentclass[]{} definition
accordingly. In my example above, LyX would output the following tex code:

%% LyX 2.0.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,british,a4paper,nofonttune,\newcommand{\CLASSINPUTbottomtextmargin}{2cm}]{IEEEtran}

\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
...


Sorry, the above code should read:

%% LyX 2.0.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,british,a4paper,nofonttune,predocclass=\newcommand{\CLASSINPUTbottomtextmargin}{2cm}]{IEEEtran}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
...



Re: way to add code before \documentclass{}

2012-01-02 Thread Bogdan

On 02-Jan-12 12:46 am, Richard Heck wrote:

On 01/01/2012 06:46 PM, Bogdan wrote:

On 01-Jan-12 10:00 pm, Richard Heck wrote:

On 01/01/2012 04:27 PM, Bogdan wrote:


pdflatex "\def\myvar{true}\input{myfile.tex}"


One way to do this, then, would be (a) to define a new file format, call
it pdfx (more or less copy over the definition of the PDF (pdflatex)
format, but making that one change from pdf2 to pdfx) and then define a
custom converter for latex --> pdfx. The one for latex --> pdf2 is:
pdflatex $$i
so you'd have to get the quotes right, etc, to make that work.

Not ideal, I know. But if we fix this, it will be 2.1 before the fix is
out, since it will definitely change the file format (probably of layout
files).


Thanks for replying Richard. I already defined a new converter like
the above. I use it to compile two versions of the same problem sheet,
one with answers, one without (there is a bug with defining that
converter for which I found a workaround but I'll make a separate post
about it).

However, as you say, it's quite far from ideal for the purpose of
paper margins since I'd have to keep modifying the converter and/or
file format to fit each document margin requirements etc. Gets the job
done for now but it would quite nice to have the possibility of adding
code before calling \documentclass{} in the future. Shall I file an
enhancement request about this, pointing to this discussion?


Sure.


I hacked a nice workaround for this that works transparently and safely 
in all cases. I created a converter wrapper (works for any latex 
converter) which replaces the \documentclass[...]{...} after searching 
for the string "predocclass=" inside [...] and then prepends 
that to \documentclass{}. This is safe, doesn't break anything as far as 
I've seen and works on the fly whenever the converter is invoked 
(update, view, export etc).


I uploaded the windows package at http://db.tt/5jfLpZh4 (unzip it into 
$LyXDir\bin). I provide the code and explanations below as well. The 
*nix folks would find it trivial to port since I'm using sed in windows 
anyway.


In LyX I modify the document class options in Document > Options > 
Document Class > Class options to read for example:


a4paper,nofonttune,predocclass=\newcommand{\CLASSINPUTbottomtextmargin}{2cm}

The windows shell script lyxwrap.bat which I placed in $LyXDir\bin has 
the following contents (you can download sed for windows from the 
unxutils or gnuwin32 projects on sourceforge):


@echo off
for %%a in (%*) do set last=%%~a
sed -i -r -e "s/^(\\documentclass\[.*?)predocclass=([^],]+)/\2\n\1/" 
"%last%"

%*

In LyX, I change the Latex (pdflatex) -> PDF (pdflatex) converter from:

pdflatex --synctex=-1 $$i

into:

lyxwrap pdflatex --synctex=-1 $$i

All *tex ones can be changed, including those that do not have 
placeholders like $$i, e.g. from "pdflatex" into "lyxwrap pdflatex", 
from "xelatex" into "lyxwrap xelatex", etc.


Whenever the converter is called (view, update, export, etc), the 
wrapper will parse and replace the \documentclass[]{} definition 
accordingly. In my example above, LyX would output the following tex code:


%% LyX 2.0.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,british,a4paper,nofonttune,\newcommand{\CLASSINPUTbottomtextmargin}{2cm}]{IEEEtran}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
...

and the lyxwrap script replaces it on the fly with

%% LyX 2.0.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\newcommand{\CLASSINPUTbottomtextmargin}{2cm}
\documentclass[12pt,british,a4paper,nofonttune,]{IEEEtran}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
...

The dangling "," hasn't been a problem until now and should't be. I 
couldn't get rid of it with sed since sed can't do non-greedy matching. 
If you have Perl installed then use that since the PCREs are better. 
There is an issue if your predocclass=<...> contains a comma "," but you 
can fix that if you need to by encoding it into "{COMMA}" and replacing 
it back into "," inside lyxwrap (I couldn't be bothered that far).


I think the devs could add an extra text field next to "Class options" 
(called, say, Pre documentclass code) that would be parsed in the same 
way that my hack does, which doesn't break anything and would not need 
any alteration of the LyX layout format or anything, it's perfectly 
backwards-compatible.


Hopefully this is useful for others too.
Bogdan.



Re: problem with custom converter (bug?) - workaround provided

2012-01-02 Thread Bogdan

On 02-Jan-12 10:32 pm, Richard Heck wrote:

On 01/02/2012 05:10 PM, Richard Heck wrote:

On 01/02/2012 04:35 PM, Bogdan Roman wrote:

- create format "foo" with short name "pdf7" and extension "pdf" and
check all 3 checkboxes
- create a converter Latex (pdflatex) -> foo with the command
"pdflatexfoo $$i 20 20" and the extra flag "latex=pdflatex"
- create a batch file pdflatexfoo.bat and place it in lyx\bin with
the following contents:
@echo off
echo %* > c:\args.txt

save, make a change and then do "Update foo". If you look in
c:\args.txt you'll see "20 20 file.tex"

I did exactly the above steps and that's what I see on Win7 x64 with
latest stable LyX 2.0.2 which is consistent with my findings from
yesterday.


It seems to be the latex=pdflatex flag that is triggering the bug.
Please file a bug.


Actually, I think you do not want this latex flag here at all. That
means you want LyX to run LaTeX for you, and the argument (if any) tells
LyX which flavor to run. Lots of magic happens then. If you are running
LaTeX on your own, you don't want this flag.



I might be misunderstanding you so please correct me if I'm wrong.

But according to the docs, the "latex=pdflatex" only informs LyX about 
the output type of the tool in order to parse errors. If I remove the 
flag, LyX won't even execute the converter and gives a crude error "An 
error occured while running: pdflatex "sheet.tex"". It seems we need 
that flag ...


Also, if you look at my last message in the other thread about code 
before \documentclass{}, you will see that I defined a converter that is 
in fact a shell script which launches an executable itself and it runs 
just fine with the "latex=pdflatex" flag present.


My converter is lyxwrap.bat and looking at what happens with Process 
Explorer, it doesn't seem that LyX would try to execute pdflatex but 
correctly executes lyxwrap.bat.


Regardless, I think the above quoted behavior is still a bug that should 
be fixed, i.e. the $$i placeholder should not be moved around to the end 
of the argument list.


Bogdan.



Re: problem with custom converter (bug?) - workaround provided

2012-01-02 Thread Bogdan

On 02-Jan-12 9:23 pm, Richard Heck wrote:

On 01/01/2012 07:43 PM, Bogdan wrote:

Actually, I just discovered that the expansion of $$i is put at the
end of the actual command LyX launches no matter what I use for the
converter command, e.g. if the converter command is:

pdflatexna $$i 20 20

then LyX is actually executing:

pdflatexna 20 20 sheet.tex

Nasty :)


I don't see this. I have defined a Dummy format and a LyX --> Dummy
converter that does this:
dummy $$p $$i $$o 30 30
The dummy program just prints its arguments, so I get eg:
/tmp/lyx_tmpdir.T12123/lyx_tmpbuf2/
Customization.lyx
Customization.dum
30
30
I get the same output if I instead define a LaTeX --> Dummy converter,
so that we have to go through LaTeX to get to Dummy.

Richard


Are you using windows? If yes, try this:

- create format "foo" with short name "pdf7" and extension "pdf" and 
check all 3 checkboxes
- create a converter Latex (pdflatex) -> foo with the command 
"pdflatexfoo $$i 20 20" and the extra flag "latex=pdflatex"
- create a batch file pdflatexfoo.bat and place it in lyx\bin with the 
following contents:

@echo off
echo %* > c:\args.txt

save, make a change and then do "Update foo". If you look in c:\args.txt 
you'll see "20 20 file.tex"


I did exactly the above steps and that's what I see on Win7 x64 with 
latest stable LyX 2.0.2 which is consistent with my findings from yesterday.


Would you like me to submit any debug/conf files?

Bogdan.




Re: problem with custom converter (bug?) - workaround provided

2012-01-02 Thread Bogdan
Hi Murat, thanks for replying. My example was only to illustrate that 
there seems to be a bug when defining converters.


Thanks for reminding me about branches though.

Bogdan.


On 02-Jan-12 6:30 am, Murat Yildizoglu wrote:

Hi Bogdan,

I have not yet used it myself but, it seems that this is a typical
situation to be handled with branches in Lyx, no?
One branch for only the questions and another one for questions and
answers? SO, you can selectively compile the branch that interests you.

2012/1/2 Bogdan mailto:bog...@mentalgate.net>>

Actually, I just discovered that the expansion of $$i is put at the
end of the actual command LyX launches no matter what I use for the
converter command, e.g. if the converter command is:

pdflatexna $$i 20 20

then LyX is actually executing:

pdflatexna 20 20 sheet.tex

Nasty :)

Bogdan.



On 02-Jan-12 12:08 am, Bogdan wrote:

As part of my course, I've been traditionally maintaining a problem
sheet in latex and compile two versions, one with answers, and one
without. To achieve that, I hide the answers based on whether a
certain
variable was defined in latex or not and then compile it
accordingly:

with answers: pdflatex sheet.tex
without answers: pdflatex "\def\noanswers{yes}\input{__sheet.tex}"

I defined a new converter in LyX do achieve the same but I could
not do
it without wrapping the 2nd command in a shell script (I'm using
windows). What I did:

- defined a new file format pdf6: PDF (pdflatex-na) with the same
settings as pdf2: PDF (pdflatex).
- defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the
following for converter: pdflatex "\def\noanswers{yes}\input{$$__i}"

Checking the lyx preferences file, I see it correctly escaped as:

\converter "pdflatex" "pdf6" "pdflatex
\"\\def\\noanswers{yes}\\__input{$$i}\"" "latex=pdflatex"

However, when I try to use it (update or export) then LyX
launches the
converter and keeps waiting for it to terminate. Investigating the
matter with a task manager like Process Hacker or Process
Explorer, in
order to see what command was actually executed, I notice that LyX
started a cmd shell which in fact executed the following:

pdflatex "\def\noanswers{yes}\input{ }" sheet.tex

Note the empty \input{} and the file name sheet.tex at the end,
instead
of inside \input{sheet.tex}.

I tried with the other variables $$b.tex, $$p, $$r etc, to no avail.

Unless I'm missing something, this looks like a bug. Is there a
python
script anywhere that launches the cmd shell? It's probably there
and I
could fix it.

My workaround is to wrap the whole thing in a cmd script
pdflatexna.bat
placed in lyx/bin with the contents:

@pdflatex "\def\noanswers{yes}\input{%~__1}"

(the %~1 instead of %1 is to strip any double quotes)

    ... and then use the following command for the converter:
pdflatexna $$i

Cheers,
Bogdan.







--
Prof. Murat Yildizoglu

Université Montesquieu Bordeaux IV
GREThA (UMR CNRS 5113)
Avenue Léon Duguit
33608 Pessac cedex
France

Bureau : F-331

yi...@u-bordeaux4.fr <mailto:yi...@u-bordeaux4.fr>

http://yildizoglu.info

http://www.twitter.com/yildizoglu






Re: problem with custom converter (bug?) - workaround provided

2012-01-01 Thread Bogdan
Actually, I just discovered that the expansion of $$i is put at the end 
of the actual command LyX launches no matter what I use for the 
converter command, e.g. if the converter command is:


pdflatexna $$i 20 20

then LyX is actually executing:

pdflatexna 20 20 sheet.tex

Nasty :)

Bogdan.


On 02-Jan-12 12:08 am, Bogdan wrote:

As part of my course, I've been traditionally maintaining a problem
sheet in latex and compile two versions, one with answers, and one
without. To achieve that, I hide the answers based on whether a certain
variable was defined in latex or not and then compile it accordingly:

with answers: pdflatex sheet.tex
without answers: pdflatex "\def\noanswers{yes}\input{sheet.tex}"

I defined a new converter in LyX do achieve the same but I could not do
it without wrapping the 2nd command in a shell script (I'm using
windows). What I did:

- defined a new file format pdf6: PDF (pdflatex-na) with the same
settings as pdf2: PDF (pdflatex).
- defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the
following for converter: pdflatex "\def\noanswers{yes}\input{$$i}"

Checking the lyx preferences file, I see it correctly escaped as:

\converter "pdflatex" "pdf6" "pdflatex
\"\\def\\noanswers{yes}\\input{$$i}\"" "latex=pdflatex"

However, when I try to use it (update or export) then LyX launches the
converter and keeps waiting for it to terminate. Investigating the
matter with a task manager like Process Hacker or Process Explorer, in
order to see what command was actually executed, I notice that LyX
started a cmd shell which in fact executed the following:

pdflatex "\def\noanswers{yes}\input{ }" sheet.tex

Note the empty \input{} and the file name sheet.tex at the end, instead
of inside \input{sheet.tex}.

I tried with the other variables $$b.tex, $$p, $$r etc, to no avail.

Unless I'm missing something, this looks like a bug. Is there a python
script anywhere that launches the cmd shell? It's probably there and I
could fix it.

My workaround is to wrap the whole thing in a cmd script pdflatexna.bat
placed in lyx/bin with the contents:

@pdflatex "\def\noanswers{yes}\input{%~1}"

(the %~1 instead of %1 is to strip any double quotes)

... and then use the following command for the converter: pdflatexna $$i

Cheers,
Bogdan.







problem with custom converter (bug?) - workaround provided

2012-01-01 Thread Bogdan
As part of my course, I've been traditionally maintaining a problem 
sheet in latex and compile two versions, one with answers, and one 
without. To achieve that, I hide the answers based on whether a certain 
variable was defined in latex or not and then compile it accordingly:


with answers:pdflatex sheet.tex
without answers: pdflatex "\def\noanswers{yes}\input{sheet.tex}"

I defined a new converter in LyX do achieve the same but I could not do 
it without wrapping the 2nd command in a shell script (I'm using 
windows). What I did:


- defined a new file format pdf6: PDF (pdflatex-na) with the same 
settings as pdf2: PDF (pdflatex).
- defined a converter Latex (pdflatex) -> PDF (pdflatex-na) with the 
following for converter: pdflatex "\def\noanswers{yes}\input{$$i}"


Checking the lyx preferences file, I see it correctly escaped as:

\converter "pdflatex" "pdf6" "pdflatex 
\"\\def\\noanswers{yes}\\input{$$i}\"" "latex=pdflatex"


However, when I try to use it (update or export) then LyX launches the 
converter and keeps waiting for it to terminate. Investigating the 
matter with a task manager like Process Hacker or Process Explorer, in 
order to see what command was actually executed, I notice that LyX 
started a cmd shell which in fact executed the following:


pdflatex "\def\noanswers{yes}\input{ }" sheet.tex

Note the empty \input{} and the file name sheet.tex at the end, instead 
of inside \input{sheet.tex}.


I tried with the other variables $$b.tex, $$p, $$r etc, to no avail.

Unless I'm missing something, this looks like a bug. Is there a python 
script anywhere that launches the cmd shell? It's probably there and I 
could fix it.


My workaround is to wrap the whole thing in a cmd script pdflatexna.bat 
placed in lyx/bin with the contents:


@pdflatex "\def\noanswers{yes}\input{%~1}"

(the %~1 instead of %1 is to strip any double quotes)

... and then use the following command for the converter: pdflatexna $$i

Cheers,
Bogdan.



Re: way to add code before \documentclass{}

2012-01-01 Thread Bogdan

On 01-Jan-12 10:00 pm, Richard Heck wrote:

On 01/01/2012 04:27 PM, Bogdan wrote:


pdflatex "\def\myvar{true}\input{myfile.tex}"


One way to do this, then, would be (a) to define a new file format, call
it pdfx (more or less copy over the definition of the PDF (pdflatex)
format, but making that one change from pdf2 to pdfx) and then define a
custom converter for latex --> pdfx. The one for latex --> pdf2 is:
pdflatex $$i
so you'd have to get the quotes right, etc, to make that work.

Not ideal, I know. But if we fix this, it will be 2.1 before the fix is
out, since it will definitely change the file format (probably of layout
files).


Thanks for replying Richard. I already defined a new converter like the 
above. I use it to compile two versions of the same problem sheet, one 
with answers, one without (there is a bug with defining that converter 
for which I found a workaround but I'll make a separate post about it).


However, as you say, it's quite far from ideal for the purpose of paper 
margins since I'd have to keep modifying the converter and/or file 
format to fit each document margin requirements etc. Gets the job done 
for now but it would quite nice to have the possibility of adding code 
before calling \documentclass{} in the future. Shall I file an 
enhancement request about this, pointing to this discussion?


Bogdan.



Re: way to add code before \documentclass{}

2012-01-01 Thread Bogdan

On 01-Jan-12 6:07 pm, Uwe Stöhr wrote:

Am 01.01.2012 16:15, schrieb Richard Heck:


On 12/31/2011 05:51 PM, Bogdan wrote:

Is there *any* way to make LyX add latex code before the
\documentclass{} call?


I do not think so.


And I have never seen this and I doubt that this will work because
without loading the document class or any package, you cannot do much.


For the IEEEtran class for instance, the page margins can be set only
by setting some IEEEtran
latex variables before the \documentclass{} call ... the use of
geometry package or the likes is
highly discouraged for IEEEtran.


Can you please point me to the IEEEtran documentation where this is
described? No example nor the documentation of IEEEtran on CTAN
http://ctan.org/tex-archive/macros/latex/contrib/IEEEtran/
describe or use this.


Sure, the official FAQ: http://www.michaelshell.org/tex/ieeetran/

Search for the string "incorrect margins". The PDF doc of the IEEEtran 
does not list many tricks.



But what exactly do you want? Can you send me a _small_ LyX file with a
short explanation?


I'm occasionally using IEEEtran in A4 paper format for other purposes 
than submitting academic papers to IEEE journals/conferences. IEEEtran 
fixes the content size regardless of the paper size, hence the top and 
bottom paper margins become quite large when using the a4paper class 
option. I want to use shorter top and bottom margins but the usage of 
the geometry package is highly discouraged in conjunction with IEEEtran.


Others ran into the same issue:

http://andrejserafim.wordpress.com/2009/04/28/ieeetran-page-margins/

Being able to input code before the \documentclass call is actually not 
uncommon. In fact, it is mentioned in many latex tutorials/docs 
indirectly. I'm sure you all know that you can compile a latex file 
either like:


pdflatex myfile.tex

or

pdflatex "\def\myvar{true}\input{myfile.tex}"

e.g. http://en.wikibooks.org/wiki/LaTeX/Customizing_LaTeX#Command-line_LaTeX

The 2nd command above is equivalent to declaring "\def\myvar{true}" 
before \documentclass. This way, \myvar may be used internally by the 
class, allowing fixing such things like the margin issue in IEEEtran.


I hope the above explanations are sufficient but I can still submit a 
LyX file if you want me. I wouldn't be able to show much in it though 
since this is what I would like LyX to do: allow me to input code before 
\documentclass :)


Bogdan.

p.s. I'm also using the 2nd example to compile two versions of the same 
latex document, one with just maths questions (for students), and the 
other with questions+answers (for supervisors). Saves time, different 
issue though.




way to add code before \documentclass{}

2011-12-31 Thread Bogdan
Is there *any* way to make LyX add latex code before the 
\documentclass{} call?


For the IEEEtran class for instance, the page margins can be set only by 
setting some IEEEtran latex variables before the \documentclass{} call 
... the use of geometry package or the likes is highly discouraged for 
IEEEtran.


Could I define a new layout, inheriting from the IEEEtran one and have 
my latex code appear there maybe?


Thanks in advance (and Happy new year by the way),
Bogdan

p.s. If not, I think this is a worthy enhancement to have in LyX. Opinions?



Re: paragraph inside environments and other issues

2011-12-30 Thread Bogdan

On 30-Dec-11 9:34 pm, Bogdan wrote:

On 29-Dec-11 10:08 pm, Paul A. Rubin wrote:

First issue: insert a separator environment between the two problems.

Second issue: try nesting the subenvironment within the proof. I don't
have LyX
handy, but there are menu and (I believe) tool bar entries for
increasing the
depth of an entry. I don't know if a paragraph can be nested, but
enumerations
etc. can.

Paul


Thanks for the tips, Paul, I completely missed the separator environment.

As for the second issue, I'm not sure I understand. Simply put, how do I
insert a Paragraph *inside* a Proof (without resorting to latex code)?

Right now LyX terminates the Proof and the Paragraph appears outside the
Proof.


Strike that, works fine by increasing the nesting depth from the Edit 
menu, just like you said. Sorry for the confusion and thanks again.


Bogdan.




Re: paragraph inside environments and other issues

2011-12-30 Thread Bogdan

On 29-Dec-11 10:08 pm, Paul A. Rubin wrote:

First issue: insert a separator environment between the two problems.

Second issue: try nesting the subenvironment within the proof. I don't have LyX
handy, but there are menu and (I believe) tool bar entries for increasing the
depth of an entry. I don't know if a paragraph can be nested, but enumerations
etc. can.

Paul


Thanks for the tips, Paul, I completely missed the separator environment.

As for the second issue, I'm not sure I understand. Simply put, how do I 
insert a Paragraph *inside* a Proof (without resorting to latex code)?


Right now LyX terminates the Proof and the Paragraph appears outside the 
Proof.


Bogdan.



paragraph inside environments and other issues

2011-12-29 Thread Bogdan

Hi all,

How do I insert consecutive "Problem" entries?

Also, is there a way to insert a (sub)paragraph inside an environment 
such as Proof? How about a custom defined section style?


Let me explain.

Let's say I'm using the IEEEtran class (although others exhibit the same 
issue). I click on the "Problem" to insert a problem and type in some 
text. I'd like to insert a new problem immediately below the previous 
one. I might be missing something very easy but I can't seem to manage 
... it keeps making the new paragraph part of the previous Problem. If I 
insert a different section/environment after the Problem, e.g. a Proof, 
then I can insert a new Problem, but I'd like consecutive Problems.


For the second issue: In Latex I can very well insert a (sub)paragraph, 
or some other user defined section, inside a Proof environment or the 
likes. However, if I try this in LyX then the entire Proof turns into a 
Paragraph. How can I easily do this without resorting to typing in Latex 
code (CTRL-L) while inside a Proof?


Would defining additional layout style in LyX allow this? I'd like to 
preserve the Proof's environment QED square symbol at the end. Any tips?


Cheers,
Bogdan.




Re: line break with extra space in equations, how?

2011-12-28 Thread Bogdan

On 28-Dec-11 9:36 pm, Richard Heck wrote:

On 12/28/2011 03:31 PM, Bogdan wrote:

On 28-Dec-11 6:04 pm, Richard Heck wrote:

On 12/28/2011 12:49 PM, Richard Heck wrote:

On 12/28/2011 10:00 AM, Bogdan wrote:

Hi all,

When editing plain .tex files I used to do this all the time to leave
extra space between equation lines in, say, an align environment,
e.g.:

\begin{align}
f(x) &= \left(x^2\right)^n\\[10pt]
&= x^{2n}
\end{align}

Note the \\[10pt]

How do I do this (easily) in LyX? I notice that if I import a piece
of plain .tex then LyX does preserve those extra spaces as I can see
it in the source code, but I haven't yet managed to it directly in
LyX.


This is weird. Type exactly that into LyX, as normal text (for some
reason copy and paste is not working), then highlight it and hit
Ctrl-M to make math. Not only will you see the space in the source but
in LyX itself. But I cannot see how to modify it once it's there. So
here's one way to do it that isn't too hard: Enter the equation as you
normally would in LyX, without the extra space; when it is right, do
View>Source, copy the source of the equation, paste it into LyX as
normal text; add the code for the extra space, and then highlight and
hit Ctrl-M. Not ideal but it works.


I've looked into this, and there doesn't seem to be UI for setting this,
or any way to enter it directly into a formula. Please feel free to file
an enhancement request for this.


Yes, I've already tried copy/paste or manual back and forth between
plain text and ctrl-m. As you've discovered, once it's there, it's
even more hassle to edit it. The whole procedure is more cumbersome
than editing latex directly (which I take it LyX is trying to avoid).



LyX doesn't natively support every TeX construct, so there will always
be things like this.


Is there a way to edit the lyx source directly while in LyX? I know I
can do it separately.

It would be quite nice if LyX offered a feature to edit, say, the
source of a highlighted portion of text/math. That way, for any such
unsupported features like \\[10pt], I could just select text, edit lyx
source, a separate window/panel appears with the source, do my edits
there e.g. add \\[10pt], press done to go back to normal LyX view. I
know it looks like it defeats the purpose of LyX but would allow quick
workarounds of any troublesome situations.

What do others think?


For the math case, this actually wouldn't be that hard.


I noticed that in my lyx documents, the lyx source is the same as the 
latex source for the math parts. It would be great to have a source 
panel editor available at hand, especially for maths which are the most 
problematic in my case.


Thanks for replying.

Bogdan.



Re: line break with extra space in equations, how?

2011-12-28 Thread Bogdan

On 28-Dec-11 6:04 pm, Richard Heck wrote:

On 12/28/2011 12:49 PM, Richard Heck wrote:

On 12/28/2011 10:00 AM, Bogdan wrote:

Hi all,

When editing plain .tex files I used to do this all the time to leave
extra space between equation lines in, say, an align environment, e.g.:

\begin{align}
f(x) &= \left(x^2\right)^n\\[10pt]
&= x^{2n}
\end{align}

Note the \\[10pt]

How do I do this (easily) in LyX? I notice that if I import a piece
of plain .tex then LyX does preserve those extra spaces as I can see
it in the source code, but I haven't yet managed to it directly in LyX.


This is weird. Type exactly that into LyX, as normal text (for some
reason copy and paste is not working), then highlight it and hit
Ctrl-M to make math. Not only will you see the space in the source but
in LyX itself. But I cannot see how to modify it once it's there. So
here's one way to do it that isn't too hard: Enter the equation as you
normally would in LyX, without the extra space; when it is right, do
View>Source, copy the source of the equation, paste it into LyX as
normal text; add the code for the extra space, and then highlight and
hit Ctrl-M. Not ideal but it works.


I've looked into this, and there doesn't seem to be UI for setting this,
or any way to enter it directly into a formula. Please feel free to file
an enhancement request for this.


Yes, I've already tried copy/paste or manual back and forth between 
plain text and ctrl-m. As you've discovered, once it's there, it's even 
more hassle to edit it. The whole procedure is more cumbersome than 
editing latex directly (which I take it LyX is trying to avoid).


Is there a way to edit the lyx source directly while in LyX? I know I 
can do it separately.


It would be quite nice if LyX offered a feature to edit, say, the source 
of a highlighted portion of text/math. That way, for any such 
unsupported features like \\[10pt], I could just select text, edit lyx 
source, a separate window/panel appears with the source, do my edits 
there e.g. add \\[10pt], press done to go back to normal LyX view. I 
know it looks like it defeats the purpose of LyX but would allow quick 
workarounds of any troublesome situations.


What do others think?

Bogdan.



line break with extra space in equations, how?

2011-12-28 Thread Bogdan

Hi all,

When editing plain .tex files I used to do this all the time to leave 
extra space between equation lines in, say, an align environment, e.g.:


\begin{align}
f(x) &= \left(x^2\right)^n\\[10pt]
 &= x^{2n}
\end{align}

Note the \\[10pt]

How do I do this (easily) in LyX? I notice that if I import a piece of 
plain .tex then LyX does preserve those extra spaces as I can see it in 
the source code, but I haven't yet managed to it directly in LyX.


Cheers,
Bogdan.



Re: unknown graphic extension: .eps (again)

2011-12-27 Thread Bogdan
Even though I tried commenting out the two lines in the python 
converting script at first, I was still getting the error.


I then tried to export to PDF (luatex), which worked!

Afterwards I tried to export to PDF (pdflatex), which worked!

Restarting LyX now also shows the pdf image inside LyX. So everything 
now appears to work as expected.


I wonder why I was getting those glitches. Also, the wiki says that 
GhostScript >8.70 should no longer exhibit that bug. I have 9.04 
installed and I still can't see pdf images inside LyX without commenting 
the two lines in the python script. Is this normal?


Cheers,
Bogdan.


On 28-Dec-11 4:13 am, Bogdan wrote:

Hi all,

I know this has popped up before as I've searched the list, but I'm
still stumped. I only just started with LyX (v2.0.2 under Windows).

I inserted a .pdf image and am trying to view the output with pdflatex,
i.e. View [PDF (pdflatex)], which gives me the above error. I get the
same error when I try to export to pdf (File > Export > PDF (pdflatex)).
Without the image, it views and exports the document just fine.

Digging into the issue a little, I notice that LyX is trying to convert
the .pdf image into a .eps image.

Exporting the file to Latex (File > Export > Latex (pdflatex)) and then
manually running "pdflatex myfile.tex" works just fine ...

pdflatex accepts .pdf images directly so why is LyX trying to convert it
to .eps?

If I actually convert the pdf image into eps, and knowing pdflatex
cannot accept eps images, does LyX actually converts pdf to eps and then
back to pdf for pdflatex? That would be too silly ...

What am I missing?

Many thanks in advance,
Bogdan.







unknown graphic extension: .eps (again)

2011-12-27 Thread Bogdan

Hi all,

I know this has popped up before as I've searched the list, but I'm 
still stumped. I only just started with LyX (v2.0.2 under Windows).


I inserted a .pdf image and am trying to view the output with pdflatex, 
i.e. View [PDF (pdflatex)], which gives me the above error. I get the 
same error when I try to export to pdf (File > Export > PDF (pdflatex)). 
Without the image, it views and exports the document just fine.


Digging into the issue a little, I notice that LyX is trying to convert 
the .pdf image into a .eps image.


Exporting the file to Latex (File > Export > Latex (pdflatex)) and then 
manually running "pdflatex myfile.tex" works just fine ...


pdflatex accepts .pdf images directly so why is LyX trying to convert it 
to .eps?


If I actually convert the pdf image into eps, and knowing pdflatex 
cannot accept eps images, does LyX actually converts pdf to eps and then 
back to pdf for pdflatex? That would be too silly ...


What am I missing?

Many thanks in advance,
Bogdan.



Re: Teouble with the tufte-book class

2010-10-28 Thread Bogdan Burlacu
On Thu, 28 Oct 2010 17:00:36 +0200
"Roel Schipper - CITG"  wrote:

> Why are you using all the extra packages in the Preamble? I also use
> Tufte-book (Lyx 1.6.5 in Lyx! portable build) and only have the title
> and author defined in the preamble. But I am a novice using LaTeX, so
> maybe I'm just naive...
> 
> kindly,
> Roel Schipper
> 
> 
> -Original Message-
> From: lyx-users@lists.lyx.org [mailto:lyx-us...@lists.lyx.org] On
> Behalf Of Bogdan Burlacu
> Sent: donderdag 28 oktober 2010 9:52
> To: lyx-users@lists.lyx.org
> Subject: Teouble with the tufte-book class
> 
> Hello everyone,
> 
> I am trying to use the tufte-book class in lyx, but the document won't
> build, here is an excerpt of the log: http://pastie.org/1254866.
> 
> I've also attached a minimal example. I am using Gentoo Linux, Lyx
> 1.6.7 and Texlive 2010. Both my example and the tufte-book example
> file that comes with Lyx fail in the same way.
> 
> How can I fix this?
> 
> Thanks in advance,
> Bogdan B

On Thu, 28 Oct 2010 17:00:36 +0200
"Roel Schipper - CITG"  wrote:

> Why are you using all the extra packages in the Preamble? I also use
> Tufte-book (Lyx 1.6.5 in Lyx! portable build) and only have the title
> and author defined in the preamble. But I am a novice using LaTeX, so
> maybe I'm just naive...
> 
> kindly,
> Roel Schipper

Hello,

I've figured it out, just posting it here for future reference, it
looks like it is a tufte bug:
http://code.google.com/p/tufte-latex/issues/detail?id=45

Workaround: use \documentclass[nols]{tufte-book} or tufte-handout.

Regards,
Bogdan B


signature.asc
Description: PGP signature


Teouble with the tufte-book class

2010-10-28 Thread Bogdan Burlacu
Hello everyone,

I am trying to use the tufte-book class in lyx, but the document won't
build, here is an excerpt of the log: http://pastie.org/1254866.

I've also attached a minimal example. I am using Gentoo Linux, Lyx
1.6.7 and Texlive 2010. Both my example and the tufte-book example
file that comes with Lyx fail in the same way.

How can I fix this?

Thanks in advance,
Bogdan B


example.lyx
Description: application/lyx


signature.asc
Description: PGP signature


Lyx document preview

2010-02-27 Thread Bogdan Burlacu
Greetings,

Is it possible to add some kind of hook to the Lyx preview facility, so
that when the user hits the preview button (or keyboard shortcut)
inside one of the child documents, the whole document would be
updated ? Currently I can only update the preview by going to the root
document tab and launch the command from there.

Regards,
Bogdan B






signature.asc
Description: PGP signature