Local Layouts - Additional Features manual?
Dear LyX documenters, I recently needed to turn a big LyX document into a number of Word documents (one for each chapter). Because the export to OpenOffice format no longer worked on my system (I can't find oolatex in a new install of MiKTeX 2.9), and time was short, I resorted to pasting from the pdf to Word. Using non-default fonts in LyX this meant that all bolding (section headings) and emphasis (as italic) was preserved. The big problem in pasting from a pdf is that each line in the pdf is treated by Word as a separate paragraph. I worked around that by noting that the final line of most paragraphs was shorter than the lines in the paragraph body, but there were enough exceptions to make the process only semi-automatic. Thinking about this later, it would have helped if the first word or letter of each paragraph was a different colour -- say, red -- and I could have searched for that. Colour, like bolding and emphasis, is preserved on pasting into Word (at least for non-default fonts). (The alternative of putting a special symbol at the start of each paragraph disturbs line length, and hence, possibly, pagination.) After much huffing and puffing I managed to create a module that did this colouring most of the time, but it was ugly. Richard Heck suggested using Local Layouts instead, and gave some helpful hints. The local layout below does exactly what I want, colouring the first letter of a Standard style paragraph red. Many users might find it valuable to have some of these tricks, special features, quirky variations, perhaps like the Firstred Local Layout, collected in one place. Looking at the LyX documents, the Additional Features manual, in Chapter 8, Special Features, is getting close to this territory (strange paragraph shapes, columns within columns). A listing of selected Local Layouts with a paragraph of description (see the example) seems fully in keeping with this chapter. I'm sure many of you will have little LyX tricks that you handle in this way and which should be given an airing. A reader/user could simply copy and paste the code from the manual into the Local Layout pane, and use it as is, or experiment or adjust further. For someone who isn't constantly immersed in TeX or Latex code, seeing other people's efforts and adjusting them is a good and satisfying way of achieving a desired result. Andrew Parsloe Local Layouts * Name: Firstred Action: Colours the first letter of every Standard paragraph red. Purpose: For pasting from a pdf into Word etc. Provided non-default fonts are used in LyX, character formatting (bold, emphasis, colour) is preserved when pasted. However, each line of the pdf is treated by Word as a separate paragraph. The red letter shows where each *real* paragraph begins. Format 35 AddToPreamble \usepackage{color} \def\firstred#1{\textcolor{red}#1} EndPreamble Style Standard LatexName firstred LatexType command End
/ for \
Something I tripped on when defining a converter recently was the need to use / rather than \ when specifying the path to a python script. The converter is in my personal scripts folder. Copying the Windows address from an explorer window, this is C:\Users\Andrew\AppData\Roaming\LyX2.0\scripts\converter.py All the backslashes need to be changed to forward slashes for this to work. Presumably this is a Windows-only problem, but a comment noting this in the customization manual (Section 3.3 Converters) might save someone else much hair pulling and teeth gnashing. Andrew
Custom insets 3: CopyStyle
Does CopyStyle do *anything* in custom insets? I was just about to send off another Custom insets query when a last trial--error thought struck me: although CopyStyle name doesn't seem to do anything, where name is the name of a previously defined inset, perhaps CopyStyle Flex:name will work? And to my surprise, because I have struggled with this for far too long, it *does* work. Dear Documentation people, *please* include something to this effect in the Customization manual. Andrew
makeindex citation needs changing
The final paragraph of section 6.6.5 of the User's Guide ends For more advanced tasks you have to set up a so-called Index Style File, see the makeindex or xindy documentation for details, [makeindex, xindy]. Section 6.6.6 also cites the same source. The citation is to http://mirrors.ctan.org/indexing/makeindex/doc/makeindex.pdf I think it should be to http://mirrors.ctan.org/indexing/makeindex/doc/manpages.dvi makeindex.pdf nowhere discusses style files or command line options (it's really the same material as is in the User's Guide). For style files and command line options you need to go to manpages.dvi. Andrew
Local Layouts -> Additional Features manual?
Dear LyX documenters, I recently needed to turn a big LyX document into a number of Word documents (one for each chapter). Because the export to OpenOffice format no longer worked on my system (I can't find oolatex in a new install of MiKTeX 2.9), and time was short, I resorted to pasting from the pdf to Word. Using non-default fonts in LyX this meant that all bolding (section headings) and emphasis (as italic) was preserved. The big problem in pasting from a pdf is that each line in the pdf is treated by Word as a separate paragraph. I worked around that by noting that the final line of most paragraphs was shorter than the lines in the paragraph body, but there were enough exceptions to make the process only semi-automatic. Thinking about this later, it would have helped if the first word or letter of each paragraph was a different colour -- say, red -- and I could have searched for that. Colour, like bolding and emphasis, is preserved on pasting into Word (at least for non-default fonts). (The alternative of putting a special symbol at the start of each paragraph disturbs line length, and hence, possibly, pagination.) After much huffing and puffing I managed to create a module that did this colouring most of the time, but it was ugly. Richard Heck suggested using Local Layouts instead, and gave some helpful hints. The local layout below does exactly what I want, colouring the first letter of a Standard style paragraph red. Many users might find it valuable to have some of these "tricks", special features, quirky variations, perhaps like the Firstred Local Layout, collected in one place. Looking at the LyX documents, the Additional Features manual, in Chapter 8, Special Features, is getting close to this territory (strange paragraph shapes, columns within columns). A listing of selected Local Layouts with a paragraph of description (see the example) seems fully in keeping with this chapter. I'm sure many of you will have little LyX tricks that you handle in this way and which should be given an airing. A reader/user could simply copy and paste the code from the manual into the Local Layout pane, and use it as is, or experiment or adjust further. For someone who isn't constantly immersed in TeX or Latex code, seeing other people's efforts and adjusting them is a good and satisfying way of achieving a desired result. Andrew Parsloe Local Layouts * Name: Firstred Action: Colours the first letter of every Standard paragraph red. Purpose: For pasting from a pdf into Word etc. Provided non-default fonts are used in LyX, character formatting (bold, emphasis, colour) is preserved when pasted. However, each line of the pdf is treated by Word as a separate paragraph. The red letter shows where each *real* paragraph begins. Format 35 AddToPreamble \usepackage{color} \def\firstred#1{\textcolor{red}#1} EndPreamble Style Standard LatexName firstred LatexType command End
/ for \
Something I tripped on when defining a converter recently was the need to use / rather than \ when specifying the path to a python script. The converter is in my personal scripts folder. Copying the Windows address from an explorer window, this is C:\Users\Andrew\AppData\Roaming\LyX2.0\scripts\ All the backslashes need to be changed to forward slashes for this to work. Presumably this is a Windows-only problem, but a comment noting this in the customization manual (Section 3.3 Converters) might save someone else much hair pulling and teeth gnashing. Andrew
Custom insets 3: CopyStyle
Does CopyStyle do *anything* in custom insets? I was just about to send off another Custom insets query when a last trial-&-error thought struck me: although CopyStyle doesn't seem to do anything, where is the name of a previously defined inset, perhaps CopyStyle Flex: will work? And to my surprise, because I have struggled with this for far too long, it *does* work. Dear Documentation people, *please* include something to this effect in the Customization manual. Andrew
makeindex citation needs changing
The final paragraph of section 6.6.5 of the User's Guide ends "For more advanced tasks you have to set up a so-called Index Style File, see the makeindex or xindy documentation for details, [makeindex, xindy]." Section 6.6.6 also cites the same source. The citation is to http://mirrors.ctan.org/indexing/makeindex/doc/makeindex.pdf I think it should be to http://mirrors.ctan.org/indexing/makeindex/doc/manpages.dvi makeindex.pdf nowhere discusses style files or command line options (it's really the same material as is in the User's Guide). For style files and command line options you need to go to manpages.dvi. Andrew
Re: Referencing subnumbered equations
On 17/02/2016 1:05 p.m., Uwe Stöhr wrote: Am 16.02.2016 um 10:37 schrieb Andrew Parsloe: The math manual, section 19.3,... Hi Andrew, this is something for the lyx-docs list. gives a method for numbering and referencing subnumbered equations so that although the equations are numbered, e.g., (1a), (1b), (1c), it is possible to reference them collectively, e.g. as the equations (1) (without the a, b, c). The method seems "messy". I am confused because I wanted to show how to reference the equations correctly, meaning as (1a), (1b), (1c). If you want to omit the subnumbering you can do this but this won't be part of Math.lyx since it is the idea of the subnumbering to get the a, b, c. regards Uwe Rather than try to explain things, I've attached two example documents Uwe, one using ERT and one with a local layout that requires no ERT. They show how to reference both a group of equations as a whole and the subequations in the group. (These documents were written with your beta2 LyX on Windows 7.) Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus #LyX 2.2 created this file. For more info see http://www.lyx.org/ \lyxformat 506 \begin_document \begin_header \save_transient_properties true \origin unavailable \textclass book \begin_preamble \end_preamble \use_default_options false \begin_modules calculyx \end_modules \maintain_unincluded_children false \language english \language_package none \inputencoding utf8 \fontencoding T1 \font_roman "lmodern" "default" \font_sans "lmss" "default" \font_typewriter "lmtt" "default" \font_math "auto" "auto" \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize default \use_geometry false \use_package amsmath 2 \use_package amssymb 2 \use_package cancel 0 \use_package esint 1 \use_package mathdots 0 \use_package mathtools 0 \use_package mhchem 0 \use_package stackrel 0 \use_package stmaryrd 0 \use_package undertilde 0 \cite_engine basic \cite_engine_type default \biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \justification true \use_refstyle 0 \branch Note \selected 0 \filename_suffix 0 \color #7f \end_branch \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Standard Here is an example using ERT with a label inserted immediately after the \series bold \backslash begin{subequations} \series default (it could also be inserted immediately before the \series bold \backslash end{subequations} \series default ), and labels inserted into the subequations, so that they too can be referenced. I've had to write the prefix \begin_inset Quotes els \end_inset eq: \begin_inset Quotes ers \end_inset explicitly for the first label. \end_layout \begin_layout Standard This first example, i.e. the equations ( \begin_inset CommandInset ref LatexCommand ref reference "eq:example-one" \end_inset ), is a functional equation for \begin_inset Formula $M$ \end_inset and \begin_inset Formula $m$ \end_inset in terms of \begin_inset Formula $\mathbf{U}$ \end_inset and \begin_inset Formula $\mathbf{u}$ \end_inset respectively. This becomes clear on substituting ( \begin_inset CommandInset ref LatexCommand ref reference "eq:second" \end_inset ) into ( \begin_inset CommandInset ref LatexCommand ref reference "eq:first" \end_inset ), \begin_inset ERT status open \begin_layout Plain Layout \backslash begin{subequations} \end_layout \end_inset \begin_inset CommandInset label LatexCommand label name "eq:example-one" \end_inset \begin_inset Formula \begin{align} M(\mathbf{U}) & =m(\mathbf{u})A+\sum_{j}u^{j}B_{j},\label{eq:first}\\ U^{i} & =m(\mathbf{u})C^{i}+\sum_{j}u^{j}D_{j}^{i},\label{eq:second} \end{align} \end_inset \begin_inset ERT status open \begin_layout Plain Layout \backslash end{subequations} \end_layout \end_inset where \begin_inset Formula $\mathbf{U}=(U^{1},\ldots,U^{N})$ \end_inset and \begin_inset Formula $\mathbf{u}=(u^{1},\ldots,u^{N})$ \end_inset . \end_layout \begin_layout Standard When compiled to pdf (the example needs the \family typewriter amsmath \family default package) the two equations as a whole are referenced correctly, i.e. ( \begin_inset CommandInset ref LatexCommand
Re: Referencing subnumbered equations
On 17/02/2016 3:08 p.m., Andrew Parsloe wrote: On 17/02/2016 1:05 p.m., Uwe Stöhr wrote: Rather than try to explain things, I've attached two example documents Uwe, one using ERT and one with a local layout that requires no ERT. They show how to reference both a group of equations as a whole and the subequations in the group. (These documents were written with your beta2 LyX on Windows 7.) Andrew I see that the two documents I attached to my earlier email had the module "Calculyx" added. It has nothing to do with them and can be deleted in the Document > Settings > Module window. Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: Referencing subnumbered equations
On 20/02/2016 3:32 p.m., Uwe Stöhr wrote: However, the question for me is if your method should be part of math.lyx or not. ... But maybe you find a nice solution in stackexchange. If so, please send me a LyX file how it is done and i will have a look what could be ported to Math.lyx. many thanks and regards Uwe Hullo Uwe, I thought I would do some serious searching through the AMS documentation. I find amsldoc.pdf in the amsmath document folder in MiKTeX. I confess I've never looked at this before. My eyes light up at two items. Sec 3.11.3: "A \label command immediately after \begin{subequations} will produce a \ref of the parent number 4.9, not 4.9a.". And particularly section 3.7, "Alignment building blocks", where they discuss the environments aligned, gathered and alignedat, and give Maxwell's equations as an example. These are exactly the environments I had in mind, and have seen used so often, and was consequently puzzled that AMS (and LyX) didn't seem to provide them. Well, obviously I was wrong about AMS. They do provide them. I will put in an enhancement request that LyX also provide them (if there isn't one already buried somewhere on trac). Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: Referencing subnumbered equations
On 21/02/2016 3:56 p.m., Uwe Stöhr wrote: Am 20.02.2016 um 20:41 schrieb Andrew Parsloe: Sec 3.11.3: "A \label command immediately after \begin{subequations} will produce a \ref of the parent number 4.9, not 4.9a.". OK, so it seems that this referencing method is used. I will add it to the Math manual. And particularly section 3.7, "Alignment building blocks", where they discuss the environments aligned, gathered and alignedat, and give Maxwell's equations as an example. But this is in LyX for many years, see the math manual, sec. 18.6. regards Uwe OK, sometimes one makes a complete oaf of oneself and I have just done that. Of course they are in LyX already now that you point it out to me. I have always just looked at that menu, Insert > Math, scanned down through the AMS environments, come to the separator followed immediately by the Array environment, and shut off my brain apparently. I was quite unaware of their presence here despite considerable use of this menu over the past 10 years. Good grief! I retire in humiliation. Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: Referencing subnumbered equations
On 21/02/2016 4:49 p.m., Uwe Stöhr wrote: Am 21.02.2016 um 03:56 schrieb Uwe Stöhr: OK, so it seems that this referencing method is used. I will add it to the Math manual. Attached is the changed Math manual (sec. 19.3). Is this OK? regards Uwe Thank you Uwe (and apologies for the recent noise). You write in 19.3, "If you want to reference the subequations at once". I don't think "at once" sounds right to a native English speaker. "At once" means "immediately" rather than "as a whole" or "collectively". Thus I would prefer, "If you want to reference the subequations collectively". Andrew LyX Document --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Format number in Customization manual
I was checking the Customization manual for something recently and noticed that the current Format number is listed variously as 5.2.1.1 "In LyX 2.1, the current layout format is 48." 5.2.2the module example near the end of the section uses Format 35 5.3.3"The format for the present version of LyX is format 59." Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Typo in Embedded Objects manual
I notice in the discussion of the diagbox package, section 2.8.4, that the optional directions of the diagonal line are listed as "NE, DE, SW or NW". Obviously (& I checked with the diagbox documentation) "DE" should be "SE". Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Required packages
I recently needed to re-install MiKTeX. I chose the basic package to make the download manageable, but it installs nothing like all the packages that LyX uses. For additional packages I was guided by the packages listed under Help > LaTeX Configuration, and then by the packages listed in the yellow notes at the start of some of the LyX docs. However this is still inadequate for compiling the LyX docs. dvips is required for the Introduction There is no note indicating additional required packages at the start of the Additional LyX Features manual, but I found I needed to download shapepar, lipsum, babel-latin (The last is certainly "out of left field", presumably required to correctly hyphenate the lorem ipsum nonsense!) For the Embedded Objects manual there is a yellow note with additional packages listed but I found I needed also eso-pic, ms, pict2e For at least one of the manuals (but I didn't note which) I needed zhmetrics (presumably for a font used in one of the manuals), and also graphics-cfg. Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus