Re: Straghtforward XML export?
On Thu, May 10, 2012 at 8:27 PM, Richard Heck wrote: > On 05/10/2012 04:52 PM, Nico Williams wrote: >> On Thu, May 10, 2012 at 3:31 PM, Richard Heck wrote: >> Here's a LyX snippet: > > OK, I see the problem. The vertical space gets moved, for reasons > that probably aren't very interesting. Can you file a bug about this on > trac? I can fix it, but it will take a little thought about how best to do > it. Filed http://www.lyx.org/trac/ticket/8154 Thanks. >> FYI, right now I'm struggling with how to transform h2, h3, h4 >> elements into nested section elements; [...] >> > It could be done in LyX, but I guess I'd suggest pre-processing the > whole thing with some kind of script. It shouldn't be too hard to do. > Find h1, write a start tag; when you see another h1, write the end tag > for the first one; etc. I've figured out how to handle this with XSLT 2.0. Here's a snippet: The key is the << operator (here encoded, so <<). The right operand had to be stored in a variable because there's no other way (that I could find!) to refer to the node I wanted to there. That took a lot of effort to work out. Much more than I'd wanted to. And it requires XSLT 2.0. But it works and it's not terribly inelegant -- more elegant than any robust script to do the same, most likely. >> [I'm guessing that LyX's XHTML output is not stable, but I can cope, >> provided I find a way to transform those h elements into nested >> sections.] >> > It's generally stable, but of course under development. Mostly, I want > it to be as modular and customizable as possible, in which case we can > all make it do what we want. Great. Thanks so much for your work and your help! Nico --
Re: Straghtforward XML export?
On 05/10/2012 04:52 PM, Nico Williams wrote: On Thu, May 10, 2012 at 3:31 PM, Richard Heck wrote: Actually, it looks like this got fixed a while ago. In a simple text document I get: I'm running LyX 2.0.0. The vspace I had was in an author inset, FWIW. The output you show is certainly fine. If you want to post a simple example file that does the wrong thing, please do. Here's a LyX snippet: \begin_layout Standard A paragraph. \begin_inset VSpace defskip \end_inset Text after a vspace. \end_layout OK, I see the problem. The vertical space gets moved, for reasons that probably aren't very interesting. Can you file a bug about this on trac? I can fix it, but it will take a little thought about how best to do it. FYI, right now I'm struggling with how to transform h2, h3, h4 elements into nested section elements; this seems very difficult to do in XSLT 1.0, but I'm still exploring ideas, including XSLT 2.0. (This actually seems like a common problem, some recipes for which I do find online and in books, but no solutions general enough.) Of course, the way LyX represents sections/subsections/subsubsections internally is exactly the same as in its XHTML output, and it'd be asking a lot to ask for LyX to wrap section contents in a div -- if I can do this with XSLT you might be able to incorporate that solution as an option in LyX, say. It could be done in LyX, but I guess I'd suggest pre-processing the whole thing with some kind of script. It shouldn't be too hard to do. Find h1, write a start tag; when you see another h1, write the end tag for the first one; etc. [I'm guessing that LyX's XHTML output is not stable, but I can cope, provided I find a way to transform those h elements into nested sections.] It's generally stable, but of course under development. Mostly, I want it to be as modular and customizable as possible, in which case we can all make it do what we want. Richard
Re: Straghtforward XML export?
On Thu, May 10, 2012 at 3:31 PM, Richard Heck wrote: > Actually, it looks like this got fixed a while ago. In a simple text > document I get: I'm running LyX 2.0.0. The vspace I had was in an author inset, FWIW. The output you show is certainly fine. > If you want to post a simple example file that does the wrong thing, please > do. Here's a LyX snippet: \begin_layout Standard A paragraph. \begin_inset VSpace defskip \end_inset Text after a vspace. \end_layout FYI, right now I'm struggling with how to transform h2, h3, h4 elements into nested section elements; this seems very difficult to do in XSLT 1.0, but I'm still exploring ideas, including XSLT 2.0. (This actually seems like a common problem, some recipes for which I do find online and in books, but no solutions general enough.) Of course, the way LyX represents sections/subsections/subsubsections internally is exactly the same as in its XHTML output, and it'd be asking a lot to ask for LyX to wrap section contents in a div -- if I can do this with XSLT you might be able to incorporate that solution as an option in LyX, say. [I'm guessing that LyX's XHTML output is not stable, but I can cope, provided I find a way to transform those h elements into nested sections.] Nico --
Re: Straghtforward XML export?
On 05/10/2012 11:52 AM, Nico Williams wrote: On Thu, May 10, 2012 at 10:02 AM, Richard Heck wrote: On 05/09/2012 02:29 AM, Nico Williams wrote: [Actually, I'm noticing one problem with LyXHTML: it doesn't preserve vertical spacing in any way, not even as horizontal spacing! I'm talking about Insert->Formatting->Vertical Space. I suspect that there are other such things that aren't preserved. For now I'll live. Vertical space is useful for multi-paragraph list items, which are very common in RFCs and Internet-Drafts. If need be I suspect I can write a patch and submit it.] I basically didn't know what to do with the vspace stuff, the issue being that HTML in a way just doesn't have that kind of concept. But if you have an idea, please let me know, and I'll be happy to put it in. Ah, good point. Hmmm, could you use? Or maybe an XML entity that gets defined into a newline but with a processor could replace with an element? Actually, it looks like this got fixed a while ago. In a simple text document I get: this that. If you want to post a simple example file that does the wrong thing, please do. Richard
Re: aspect ratio in figures
On 05/10/2012 11:00 AM, Paul A. Rubin wrote: Well, that took a bit of sorting. Turns out it has nothing to do with either LyX or LaTeX; it's something sneaky in your image. Your screenshot is 296x296 pixels, which sounds (and looks on the desktop, or in an image viewer, or in the LyX GUI) square. The catch is that the resolution is (rounding a bit) 1024 ppi (pixels per inch) horizontal v. 768 ppx vertical. 296 px at 768 ppi is more inches than 296 px at 1024 ppi. So the "distorted" PDF output is technically correct. Thanks for tracking that down. It seems a bit strange that GIMP would crop an image with respect to pixels (displaying the result as square) and yet keep the same resolution. I had never noticed that it has a separate Image > Print Size menu. Changing that does fix the PDF. The problem seems to have stemmed from using the option -density 1024x768 in the import program. If I don't use that option the .png image seems to display and print OK, even after cropping. You can, of course, set both the height and width to equal values in LyX and force a square image. I also converted your image (using GIMP, but other image editors can probably do it too) to 296x296 px at 768x768 ppi, and included that in the document while setting just the width. That worked too. Paul
Re: Straghtforward XML export?
On Thu, May 10, 2012 at 10:02 AM, Richard Heck wrote: > On 05/09/2012 02:29 AM, Nico Williams wrote: >>> [Actually, I'm noticing one problem with LyXHTML: it doesn't preserve >>> vertical spacing in any way, not even as horizontal spacing! I'm >>> talking about Insert->Formatting->Vertical Space. I suspect that >>> there are other such things that aren't preserved. For now I'll live. >>> Vertical space is useful for multi-paragraph list items, which are >>> very common in RFCs and Internet-Drafts. If need be I suspect I can >>> write a patch and submit it.] > > I basically didn't know what to do with the vspace stuff, the issue being > that > HTML in a way just doesn't have that kind of concept. But if you have an > idea, > please let me know, and I'll be happy to put it in. Ah, good point. Hmmm, could you use ? Or maybe an XML entity that gets defined into a newline but with a processor could replace with an element? Nico --
Re: Embedding arrows & stuff
El 10/05/2012 09:02 a.m., Paul A. Rubin escribió: Guenter Milde users.sf.net> writes: It would be nice, if a math inset would behave like a float, minipage or branch: if you go to the first position inside the inset and press backspace, the inset is dissolved and the content inlined. This would give a consistent user experience. I'll second that motion. Paul And when it is inlined you go to the first position, press TAB and the inline should go back to inset. The reverse case would be great too! Alex
Re: Straghtforward XML export?
On 05/09/2012 02:14 AM, Nico Williams wrote: On Tue, May 8, 2012 at 10:58 PM, Richard Heck wrote: On 05/08/2012 07:30 PM, Nico Williams wrote: LyXHTML looks very promising. It certainly preserves everything I have in my [admittedly small] test file. If it preserves custom inset names then I could probably use custom insets to provide the additional metadata I need (I still haven't quite figured out how to create custom insets, but give me time). XSLT can do the rest. It will do with custom insets whatever you ask it to do. If I remember correctly, it defaults to something like: or an equivalent span, depending upon whether its a charstyle or a flex inset. Excellent. I've got an XSLT stylesheet in the works that does what I want. I don't know how to create a custom inset that does.. nothing much except have a custom inset name. Specifically I need variants of the Author inset to represent the metadata I need (author organization, e-mail address, and postal address). With that I'd be set. Try putting this into Local Layout, under Document>Settings: Format 31 InsetLayout Flex:MyInset LyXType Custom End InsetLayout Flex:MyInsets LyXType Custom HTMLTag mytag End You can specify more if you wish, but that gets you started. (As LaTeX, these export as normal text.) I guess if you want these as metadata, you should also add: InTitle 1 to each of them. Richard
Re: color url ONLY
El 10/05/2012 08:33 a.m., Paul A. Rubin escribió: UD gmail.com> writes: Is there a way to color (and make clickable) only URLs, but not citations? When I use the Document/Settings/PDF properties, both URLs and citations are colored and are clickable. Thanks, Ehud Kaplan Assuming your text is black, you can add 'citecolor=black' as an additional option for hyperref. Citations will still be clickable, but they'll be "colored" black. Paul I think Mr. Ehud means to have the citation in one color i.e black as you suppose, but the URL in another color i.e blue as in: some authors, title, publication, available at _http://somewhere.com_ I agree that the full citation should be clickable. Alex
Re: Embedding arrows & stuff
Guenter Milde users.sf.net> writes: > It would be nice, if a math inset would behave like a float, minipage or > branch: if you go to the first position inside the inset and press > backspace, the inset is dissolved and the content inlined. This would > give a consistent user experience. I'll second that motion. Paul
Re: Straghtforward XML export?
On 05/09/2012 02:29 AM, Nico Williams wrote: [Actually, I'm noticing one problem with LyXHTML: it doesn't preserve vertical spacing in any way, not even as horizontal spacing! I'm talking about Insert->Formatting->Vertical Space. I suspect that there are other such things that aren't preserved. For now I'll live. Vertical space is useful for multi-paragraph list items, which are very common in RFCs and Internet-Drafts. If need be I suspect I can write a patch and submit it.] Found a solution to that: a nest list with no bulleting/numbering is rendered as a single withs for the nested list elements, which works out perfectly. No doubt the vspace loss will come up elsewhere, but for now it's fine. I basically didn't know what to do with the vspace stuff, the issue being that HTML in a way just doesn't have that kind of concept. But if you have an idea, please let me know, and I'll be happy to put it in. Richard
Re: aspect ratio in figures
Well, that took a bit of sorting. Turns out it has nothing to do with either LyX or LaTeX; it's something sneaky in your image. Your screenshot is 296x296 pixels, which sounds (and looks on the desktop, or in an image viewer, or in the LyX GUI) square. The catch is that the resolution is (rounding a bit) 1024 ppi (pixels per inch) horizontal v. 768 ppx vertical. 296 px at 768 ppi is more inches than 296 px at 1024 ppi. So the "distorted" PDF output is technically correct. You can, of course, set both the height and width to equal values in LyX and force a square image. I also converted your image (using GIMP, but other image editors can probably do it too) to 296x296 px at 768x768 ppi, and included that in the document while setting just the width. That worked too. Paul
Re: color url ONLY
UD gmail.com> writes: > > > Is there a way to color (and make clickable) only URLs, but not > citations? > When I use the Document/Settings/PDF properties, both URLs and > citations are colored and are clickable. > Thanks, > Ehud Kaplan > Assuming your text is black, you can add 'citecolor=black' as an additional option for hyperref. Citations will still be clickable, but they'll be "colored" black. Paul
Re: Lyx on Windows: ps2eps missing?
Ah sorry, that LyX Version number was lost during editing the email. LyX was installed using the installer "LyX-2.0.3-1-Installer.exe", which should be the latest one. There is a newer installer which fixes a security issue in the same ImageMagick library. Anyway, the problem did not seem Image-Magick related to me. Switching to using "convert.exe" for PDF->PNG conversion fixed the problem after all. It was the default converter, that did not work -- and that uses ps2eps in an intermediate step, which should be related to the LaTeX distribution rather than Image Magick. Your answer seems to indicate, that LyX is meant to use Image Magick for PDF previewing by default though. The default should use the script "Resources\convertDefault.py" which indeed should use ImageMagick's convert.exe. I'm not sure which step goes wrong for you. Vincent
Re: Lyx on Windows: ps2eps missing?
2012/5/10 Vincent van Ravesteijn : > Op 7-5-2012 15:29, Klaus-Dieter Bauer schreef: > >> Hello! >> >> I stumbled into problems previewing PDF graphics inside LyX. It would >> give me the error "Unable to Convert to Loadable Format". > > You didn't mention which version of LyX you have installed. There was a bug > in the version of ImageMagick that was included in the LyX installer. This > bug prevented pdf images to be previewed. The latest LyX installer has a > newer version of ImageMagick that fixes this. > [...] > Vincent Ah sorry, that LyX Version number was lost during editing the email. LyX was installed using the installer "LyX-2.0.3-1-Installer.exe", which should be the latest one. Anyway, the problem did not seem Image-Magick related to me. Switching to using "convert.exe" for PDF->PNG conversion fixed the problem after all. It was the default converter, that did not work -- and that uses ps2eps in an intermediate step, which should be related to the LaTeX distribution rather than Image Magick. Your answer seems to indicate, that LyX is meant to use Image Magick for PDF previewing by default though. Deleting my local LyX settings and running "reconfigure" didn't solve the problem, so it SHOULD not be a problem with my local settings. Just to be sure, I found a work-around, as said before. So my interest in that behaviour is more or less academic right now. :-) kind regards, Klaus-Dieter
Re: Lyx on Windows: ps2eps missing?
Op 7-5-2012 15:29, Klaus-Dieter Bauer schreef: Hello! I stumbled into problems previewing PDF graphics inside LyX. It would give me the error "Unable to Convert to Loadable Format". You didn't mention which version of LyX you have installed. There was a bug in the version of ImageMagick that was included in the LyX installer. This bug prevented pdf images to be previewed. The latest LyX installer has a newer version of ImageMagick that fixes this. 3. Would ps2eps be included if I had chosen the combined LyX/MiKTeX installer? CTAN says, that it is not part of MiKTeX ( http://www.ctan.org/pkg/ps2eps ). 3a. If yes, is there anywhere any indication that the combined installer should be preferred? No, it should be ok to install MikTex separately. I don't have ps2eps as well, so that is not the problem. Vincent
Re: Scrolling Slowness [Re: keyboard Scrolling Anomaly]
On 5 May 2012 16:56, Wolfgang Engelmann wrote: > Is scrolling still slow if you save your file under another name and use > that? Yes. > Is scrolling still slow if you take out your inserts (figures, notes) Yep. > Is scrolling still slow if you take out the bibtex generated bibliography > at the end of your document? There was no generated bibliography to begin with, so yes. -- GPG/PGP ID: C0711BF1