LyX ⇒ Creating a controllable text "Layer" in a master document
Creating a controllable text "Layer" in a master document
I'm a complete n00b at LyX and haven't yet messed with LaTeX, at all. I've produced several documents in LyX and love it. I need help with a bit of complicated formatting that I'm pretty sure can be done... it just escapes me.
I'm writing an Instructor's Guide for an adult training course which will contain the student handbook as part of the instructor material. I want to create an overlay environment, like a CAD layer, which could be made visible for producing the instructor guide, but could be toggled to remove all the instructor advice from the student guide. I could then produce both the Instructor Guide and Student Guide from the same source.
I basically only want to type the information once and use the program to separate instructor advice from what is visible to the student. Does such a construct exist in LyX or LaTeX?
Thanks in advance and apologize if the question was basic.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: Creating a controllable text "Layer" in a master documen
Re: Creating a controllable text "Layer" in a master documen
I'm going to annotate the process here because I hope it may interest people and hopefully generate some feedback. Comments are highly solicited and deeply appreciated!
****BEGIN
I'm a hardware engineer with a heavy UNIX background. I'm a decent structured programmer. I've got a working knowledge of OOP but haven't used it much (not a software developer by trade). I know a fair bit about Markup Languages (HTML, XHTML), but not LATEX, specifically.
Here's how I plan to handle the project:
The basic idea is a master document containing $EVERYTHING. The "layers" will be markup that sits above the normal typesetting. Layers will be named and each name be tied to some default typesetting. Defaults can be overridden downstream with the exception of visibility.
Layers can be rendered invisible by tweaking the defaults. This should be possible in real time with GUI widgets or (hopefully) menu icons.
1. Create a Latex Style to encapsulate separate layers in their own markup. I'm using HTML's heading markups as a mental model for this.
2. Create parameters in the style to create unique names and a default attribute set for the enclosed text.
3. Create elements in the Lyx UI to allow usage of the functionality in lyx.
Right now, I'm not even considering part 3. If anybody's had experience creating custom styles, can you help with the following:
1. Is there a "visible" attribute to a standard Latex style element? (I'll probably know this in a few hours, but why not ask?)
2. Can a single style contain multiple variants (for instance, different typesetting available for a "paragraph" element)?
3. Going to need a way to "naturally" nest any additional fomatting INSIDE the layer markup. Is there a way or do I need to code this?
4. Is there a preferred language for coding LATEX/LYX modules? I'll probably work in tcl unless there's a preferred language.
Thanks for the read, I will be checking and (hopefully) updating this thread as the work proceeds.
-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Re: Creating a controllable text "Layer" in a master documen
That is where the LyX experts hang out. For LaTeX experts, this forum is the place.
Creating a controllable text "Layer" in a master document
Took a quick look at the lyx note function. Too specific. It would take a lot of work to retask it.
Thought of fleshing out the "Part" element of a class sheet to allow toggling. This won't work because the Part structure is essentially linear and inline. I couldn't have, say "Part 1" arbitrarily popping up in any other Part. NotSoGood.
Then I found some reference to the comment package in tex http://www.ctan.org/tex-archive/macros/ ... ib/comment. This looks very promising. It even allows user defined environments (Layers, in potentia).
I'll be away for a while (like I said, I DO have a day job), but my direction now has been narrowed, at least at the LATEX level:
1. explore the limits of the comment package.
2. hopefully, change from a fully synthetic creation, to writing a wrapper so the comment package does the heavy lifting.
3. at present, the UI for lyx is still looking just as tough. Let's lick the process first, then worry about making it friendly to use.
Creating a controllable text "Layer" in a master document
But I also want control of the font. The fontspec pakg appears to be a good choice but I don't see it readily available in my OS (debian linux). I'm going to try manually installing it from CTAN and we'll have to see how that goes (very often when a standard distro drops a package it's because there are conflicts with other standard OS stuff. Hopefully this will not be the case here...)
After that, we'll design a simple command to control the layering. Right now, I'm thinking:
Code: Select all
\layer{$NAME,$COLOUR,$FONT, $VIS}
Code: Select all
\begin{$NAME}...\end{name}
after $THAT, we'll start thinking about fitting it into lyx...