LyX to latex encoding

2007-02-09 Thread Kevin Paunovic
When exporting a LyX file to latex (pdflatex) in MacOSX, the .tex  
file is encoded using Western MacOS Roman but the .tex file declares  
\usepackage[latin1]{inputenc} (it should be applemac and not latin1).
	I tried to specify applemac with no luck: one can only choose  
between latin1, latex default (ie nothing), and some codepages (no  
cp1252).
	Does anyone know how to do this? (of course, one solution is to set  
the encoding to 'latex default' then manually add inputenc in the  
preamble)
	Is there a way to teach LyX to use common characters when possible  
while exporting? Mine transforms double quotes to \char`\"{} instead  
of using the " char. Latin1, applemac, or whatever encoding you use,  
the double quote exists for all encoding and there is absolutely

no need to make this transformation.
	Another problem with quotes: I checked the document option to use  
English opening and closing double quotes (``and '') but when  
exported to latex, my .tex file contains those "quotes" (straight).  
It would be great if either LyX exports ``quotes'' like this (latex  
style), or "quotes" like this and uses csquotes package, making  
double quotes active.




Re: LyX adds packages declaration I already use

2007-02-07 Thread Kevin Paunovic


On Feb 7, 2007, at 12:00 PM, Jean-Marc Lasgouttes wrote:


"Kevin" == Kevin Paunovic <[EMAIL PROTECTED]> writes:


Kevin> The problem now is that LyX automatically adds things like:
Kevin> \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc}
Kevin> \usepackage{graphicx} \usepackage{babel}

Kevin> so, as you might expect, this leads to crashes at compilation.

Kevin> How to get rid of all those things LyX adds?

I am not sure I understand. Do you really need to keep the things that
are included in the preamble? Why?



I would prefer, in my case, to have an option to tell LyX to stop  
putting things in the preamble except for the documentclass.


LyX is smart enough to add required packages (ex. graphicx when a  
graphic is included) but unfortunatly, it can't see if a package was  
(or will be) already loaded by the user.


In my case, I have a mystyle.sty file that contains:
%% mystyle.sty
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
%%

Now, if you include a graphic with LyX, you will get something like:
%%
\documentclass{...}

\usepackage{graphicx}
\usepackage{mystyle}
...
%%
and this crashes. You'll get:


! LaTeX Error: Option clash for package graphicx.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
...

l.40 \RequirePackage
[cmyk,fixpdftex,pdftex]{xcolor}
?
! Emergency stop.
...

l.40 \RequirePackage
[cmyk,fixpdftex,pdftex]{xcolor}
The package graphicx has already been loaded with options:
  []
There has now been an attempt to load it with options
  [pdftex]
Adding the global options:
  ,pdftex
to your \documentclass declaration may fix this.


Latex compiler suggests to include the driver name option to the  
documentclass options. But this isn't possible for me because the  
graphicx package is called inside a conditional (ifpdf to name it) to  
load dvips if pdflatex is not used or pdftex if pdflatex is used.  
Plus, the fixpdftex option is for pdfoutput only.


The best solution is to stop calling usepackage{graphicx} 2 times. I  
can't avoid the second time, so I'm looking for a way to remove the  
first occurency, that is, the one LyX automatically adds.



Kevin> PS: Please note that I find this feature (automatically adding
Kevin> common packages) very great.

Actually, LyX adds the packages that are required by the document
contents.

JMarc


Yep, I appreciate this feature, really. It will be perfect if one can  
have a checkbox that enable or disable this feature, and if the  
package names are written in a config file (and not hard-coded in the  
executable). For example, LyX uses "graphicx". You know that there is  
also a package called "graphics". What if one prefer using this one?  
And what if a new package called "gfx" is released on CTAN and  
improve greatly the old graphicx? This only is a suggestion, but  
giving a customization method here would be great.


Kevin



Re: LyX adds packages declaration I already use

2007-02-07 Thread Kevin Paunovic
I've found the worst solution ever to solve my problem. Please  
forgive me and light a candle for me.


Rest of the mail is coded in rot13 so common people won't read it for  
their own sake.


1) YlK -> Cersrerapr -> Ynathntr naq lbh erzbir rirelguvat  
(\hfrcnpxntr{onory}, \fryrpgynathntr{&&ynat} naq hapxrpx rirelguvat).  
abj, ab zber onory co
2) (guvf vf gur orfg cneg, V qrfreir n gevny sbe guvf), bcra YlK  
ovanel jvgu n urkn rqvgbe, svaq nfpvv fgevat 'tencuvpk' (naq bgure  
cnpxntr lbh jnag gb erzbir) naq ercynpr nyy gur punef ol n fvzcyr  
fcnpr. Guvf jvyy cebqhpr guvatf yvxr \hfrcnpxntr{   } va lbhe  
qbphzrag, ohg ng yrnfg vg jbexf.


Gbb onq guvf jnf uneq-pbqrq naq gbb onq vg frrzf gurer vf ab jnl gb  
pbageby gung.



On Feb 6, 2007, at 5:26 PM, Richard Heck wrote:



Ah, yes, true.

The only other option I can see, if the "declare options later" method
won't work, is to mess with the compilation process itself, so that  
you
can remove the offending lines that LyX inserts. If you look under  
Tools

Preferences > Converters, you'll see the command LyX is using to
"convert" LaTeX to DVI, say. (Yes, unfortunately, you would have  
several

of these to change.) The idea would be to write a little filter that
would strip out those lines before calling latex. So you'd have a  
script

that looked roughly like:

filterlyx $1
latex $1

Then we can arrange to call this script instead of whatever LyX is
calling to do the LaTeX to DVI conversion.

Obviously, an enhancement request is certainly in order here. I  
suppose
the request would be for there to be a way to suppress the  
inclusion of

these sorts of packages.

Richard

Kevin Paunovic wrote:

Aye aye, but this becomes tweaky when LyX declares a "nude" package
(without any option) and you declare, after that, the same package  
but

this time with options.
Ex: \usepackage{graphicx}
\usepackage[dvips]{graphicx}

This causes Latex compiler hauling that graphicx was already loaded
(this is ok), but without the same options (this bugs). Most packages
give commands to declare options after the package is loaded
(something like \graphicx{dvips}, etc. geometry package is good at
that :) but sometimes you may find no answer.


On Feb 6, 2007, at 5:07 PM, Richard Heck wrote:



The way to handle this, I'd think, is to use some kind of  
conditional.
LyX adds its material BEFORE your custom preamble stuff gets  
included.
So you basically just need to check for the existence of  
something you
know LyX will have done. LyX pretty much always to use  
inputenc.sty, so

perhaps checking for \inputencoding via
\ifx\inputencoding\undefined
would work.

It might be worth filing an enhancement request, asking that LyX  
should

define \iflyx or something.

Richard

Kevin Paunovic wrote:
I use LyX as a structured content editor. I mean, I need people  
write
the documentation of software manuals in a structured language  
and, as

they fear xml, I proposed LyX. So I wrote a .sty that contains
everything we need to generate manuals and documentation. This
includes commands Latex like:

...
\RequirePackage[latin1]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[frenchb,english]{babel}
\ifpdf
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
\else
\RequirePackage[dvips]{graphicx}
\RequirePackage[cmyk,dvips]{xcolor}
\fi
...

The problem now is that LyX automatically adds things like:
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{babel}

so, as you might expect, this leads to crashes at compilation.

How to get rid of all those things LyX adds?

PS: Please note that I find this feature (automatically adding  
common
packages) very great. I know I use LyX a strange way and I  
shouldn't

include everything in a .sty file, but you know, people I work with
are far more strange than this ;)



--==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://bobjweil.com/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto






--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://bobjweil.com/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto





Re: LyX adds packages declaration I already use

2007-02-06 Thread Kevin Paunovic
Aye aye, but this becomes tweaky when LyX declares a "nude" package  
(without any option) and you declare, after that, the same package  
but this time with options.

Ex: \usepackage{graphicx}
\usepackage[dvips]{graphicx}

This causes Latex compiler hauling that graphicx was already loaded  
(this is ok), but without the same options (this bugs). Most packages  
give commands to declare options after the package is loaded  
(something like \graphicx{dvips}, etc. geometry package is good at  
that :) but sometimes you may find no answer.



On Feb 6, 2007, at 5:07 PM, Richard Heck wrote:



The way to handle this, I'd think, is to use some kind of conditional.
LyX adds its material BEFORE your custom preamble stuff gets included.
So you basically just need to check for the existence of something you
know LyX will have done. LyX pretty much always to use  
inputenc.sty, so

perhaps checking for \inputencoding via
\ifx\inputencoding\undefined
would work.

It might be worth filing an enhancement request, asking that LyX  
should

define \iflyx or something.

Richard

Kevin Paunovic wrote:

I use LyX as a structured content editor. I mean, I need people write
the documentation of software manuals in a structured language  
and, as

they fear xml, I proposed LyX. So I wrote a .sty that contains
everything we need to generate manuals and documentation. This
includes commands Latex like:

...
\RequirePackage[latin1]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[frenchb,english]{babel}
\ifpdf
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
\else
\RequirePackage[dvips]{graphicx}
\RequirePackage[cmyk,dvips]{xcolor}
\fi
...

The problem now is that LyX automatically adds things like:
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{babel}

so, as you might expect, this leads to crashes at compilation.

How to get rid of all those things LyX adds?

PS: Please note that I find this feature (automatically adding common
packages) very great. I know I use LyX a strange way and I shouldn't
include everything in a .sty file, but you know, people I work with
are far more strange than this ;)



--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://bobjweil.com/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto





.tex to .lyx to .tex problem

2007-02-06 Thread Kevin Paunovic

I start from a .tex latex file that contains:
\lipsum[11] blahblah

I import this in LyX.

Then I export the .lyx file to plain latex (.tex) and I find this line:
\lipsum{[}11]

This seems to be due to the fact \lipsum command don't take arguments  
but a unique optional argument (between square brackets). So LyX may  
consider, as no '{' was found after \lipsum, that lipsum command  
takes the next char as argument (the opening square bracket) and puts  
it between accolades. Maybe there is a way to fix this a simple way?


LyX adds packages declaration I already use

2007-02-06 Thread Kevin Paunovic
I use LyX as a structured content editor. I mean, I need people write  
the documentation of software manuals in a structured language and,  
as they fear xml, I proposed LyX. So I wrote a .sty that contains  
everything we need to generate manuals and documentation. This  
includes commands Latex like:


...
\RequirePackage[latin1]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[frenchb,english]{babel}
\ifpdf
\RequirePackage[pdftex]{graphicx}
\RequirePackage[cmyk,fixpdftex,pdftex]{xcolor}
\else
\RequirePackage[dvips]{graphicx}
\RequirePackage[cmyk,dvips]{xcolor}
\fi
...

The problem now is that LyX automatically adds things like:
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{babel}

so, as you might expect, this leads to crashes at compilation.

How to get rid of all those things LyX adds?

PS: Please note that I find this feature (automatically adding common  
packages) very great. I know I use LyX a strange way and I shouldn't  
include everything in a .sty file, but you know, people I work with  
are far more strange than this ;)


Crash when using TitlelatexCommand in layout def

2007-02-06 Thread Kevin Paunovic

Hi,
I'm having problems when using TitleLatexCommand in my .layout file.

I use the command \coverpage instead of \maketitle to generate the  
title page. This command is defined in my .sty file (included in the  
Preamble section of the layout file).


Everything goes well until I specify "TitleLatexCommandcoverpage"  
in my layout file. When doing this, LyX can't create/convert a  
document to my own class named ezbook (a customized book class that  
uses ezstyle.sty). it raises the following error message:

"The document could not be converted into the document class ezbook."

When loading a .lyx file that uses ezbook class (but done prior  
adding TitleLatexCommand to the layout file), LyX crashes after saying:
"Using the default document class, because the  class ezbook could  
not be loaded."


I thought I had done something the wrong way, but it's strange that  
removing TitleLatexCommand line solve this (it solves the problem of  
crashing the app, but of course, it doesn't solve using a custom  
title command :)


Any one could help?

A.D.