Sam Liddicott wrote:
Jean-Marc Lasgouttes wrote:
"Sam Liddicott" <s...@liddicott.com> writes:
If I use a layout with "Passthrough 1" then the Lyx "E" emphasis
toolbar
button will still insert \emph{} but other "CharStyle:" insets won't
work.
Is this a bug, or is there some way I can specify an inset so that it
also inserts Latex macros into an environment defined with
Passthrough 1
It is a bug. Note that the semantics of passthru paragraphs is not well
defined right now. I hope that I will be able to improve this in 1.7/2.0
Please keep me involved in the discussions.
I'm mostly re-written notangle in awk (to fix a few bugs) and so that
it recognizes Latex macros
I'm using the attached .layout file, which generates Latex like this;
\begin{CodeScrap}
\item [{new_chunk() }]
function new_chunk(chunk_name)
{
active_chunk = chunk_name;
chunks[chunk_name, "part", ++chunk[chunk_name, "part"] ] =
chunk_name SUBSEP "chunklet" SUBSEP ++chunks[chunk_name,
"chunklet"];
}
\end{CodeScrap}
Where the \item declares a chunk name.
I also want a \usechunk{chunk-name} which will be shown in Lyx with a
static label "use chunk", but I don't know if that can be done as an
inset...
I also want to be able to pass additional optional arguments to the \item.
So although it is "passthrough" it has the same problems as verbatim
does which is that it still looks for some Latex, in this case \item and
\end{CodeScrap}, however I'm not too worried. I'll invent a \literal{}
if I have to (which would have to be expressed in a CodeScrap as
\literal{{\literal}} no doubt).
(I'm also open to other notations if you have any suggestions).
Sam
#\DeclareLyXModule{Noweb Literate Lyx}
#DescriptionBegin
#Adds \usepackage{noweb} to your document, along with the Scrap style.
#Also fixes the CharStyle:Code to work with noweb, redefining nowebs
#\code command to \nwcode (if you need it).
#DescriptionEnd
Format 11
OutputType literate
AddToPreamble
\usepackage{noweb}
% noweb breaks code command for logical markup
\newcommand{\nwcode}{\code}
\renewcommand{\code}[1]{\texttt{#1}}
EndPreamble
Style Scrap
Category List
Margin First_Dynamic
LatexType Item_environment
LatexName CodeScrap
#NextNoIndent 1
NewLine 0
LeftMargin MMM
LabelSep MMM
ParSep 0.4
TopSep 0.4
BottomSep 0.4
ItemSep 0.4
Align Block
AlignPossible Block,Left
FreeSpacing 1
PassThru 1
LabelType Manual
LabelFont
Color magenta
EndFont
TextFont
Color latex
Family Typewriter
EndFont
End
InsetLayout CharStyle:Chunkref
LyxType charstyle
LabelString chunkref
LabelType static
LatexType command
LatexName chunkref
Font
Series bold
Color black
EndFont
Preamble
\newcommand{\chunkref}[1]{\texttt{#1}}
EndPreamble
End