Re: Customizing the TableOfContents

2009-01-13 Thread Balaji
Richard,

Thanks a lot. I got this to work finally. I had initially tried something
like that before writing this question, but quite naively. I simply said
\def\tableofcontents{\indici} and that gave me a stack overflow. This is
because indici calls \tableofcontents internally. I now redefined it by
copying the code for indici and placing it in the definition of
tableofcontents. This time, I replaced the \tableofcontents with \oldtoc. So
now my definition looks like:
\def\tableofcontents{
   
\iffrontmatter\else\frontmattertrue\fi
\oldtoc

}

When you replied to my email, I decided there has to be some way to do this
only using this redefinition trick. I was stupid not to think of this
earlier, but thanks a lot for your reply that guarantees that modifying
Insets won't work for me. The more I thought it was possible to customize
Insets, the more I was trying it. I had spent 16 hours modifying Insets and
it didn't work. It took me just 2 mins to fix this though. I think I just
needed someone to tell me that the solution is not in that route.

Thanks,
Balaji


On Tue, Jan 13, 2009 at 9:18 AM, rgheck  wrote:

> Balaji wrote:
>
>> Hi,
>>
>> I have a LaTeX class called toptesi that has a special latex command
>> \indici
>> that produces the table of contents, list of figures and list of tables
>> etc., in a specific format. I want to use this using the Inset features of
>> LyX. Now I know that you can insert LaTeX commands in LyX, but this is
>> more
>> for my mother than for me, and so she cannot understand this. I want to
>> create a layout file that will modify the CommandInset for the TOC to
>> generate a different code.
>>
>>
>>
> This cannot be done without modifying the code. It was a natural idea to
> try it with InsetLayout, but that only works with collapsable insets, like
> ERT, footnotes, etc.
>
>  The present CommandInset for TOC generates the following:
>> \begin_inset CommandInset toc
>> LatexCommand tableofcontents
>>
>> \end_inset
>>
>> Instead of producing this, I want LyX to generate the following code:
>>
>> \begin_inset CommandInset toc
>> LatexCommand indici
>>
>> \end_inset
>>
>>
>>
> No, this isn't what you want to do. What you want is to change the LaTeX
> export, not the LyX code. So where LyX generates:
>   \tableofcontents{}
> you want what? Answer that and your solution will be to put this in the
> preamble (which you can do in a layout file):
>   \let\oldtoc=\tableofcontents
>   \def\tableofcontents{NEW CODE}
> This trick is used in the beamer layouts.
>
> Richard
>
>


Re: Customizing the TableOfContents

2009-01-13 Thread rgheck

Balaji wrote:

Hi,

I have a LaTeX class called toptesi that has a special latex command \indici
that produces the table of contents, list of figures and list of tables
etc., in a specific format. I want to use this using the Inset features of
LyX. Now I know that you can insert LaTeX commands in LyX, but this is more
for my mother than for me, and so she cannot understand this. I want to
create a layout file that will modify the CommandInset for the TOC to
generate a different code.

  
This cannot be done without modifying the code. It was a natural idea to 
try it with InsetLayout, but that only works with collapsable insets, 
like ERT, footnotes, etc.



The present CommandInset for TOC generates the following:
\begin_inset CommandInset toc
LatexCommand tableofcontents

\end_inset

Instead of producing this, I want LyX to generate the following code:

\begin_inset CommandInset toc
LatexCommand indici

\end_inset

  
No, this isn't what you want to do. What you want is to change the LaTeX 
export, not the LyX code. So where LyX generates:

   \tableofcontents{}
you want what? Answer that and your solution will be to put this in the 
preamble (which you can do in a layout file):

   \let\oldtoc=\tableofcontents
   \def\tableofcontents{NEW CODE}
This trick is used in the beamer layouts.

Richard



Customizing the TableOfContents

2009-01-12 Thread Balaji
Hi,

I have a LaTeX class called toptesi that has a special latex command \indici
that produces the table of contents, list of figures and list of tables
etc., in a specific format. I want to use this using the Inset features of
LyX. Now I know that you can insert LaTeX commands in LyX, but this is more
for my mother than for me, and so she cannot understand this. I want to
create a layout file that will modify the CommandInset for the TOC to
generate a different code.

The present CommandInset for TOC generates the following:
\begin_inset CommandInset toc
LatexCommand tableofcontents

\end_inset

Instead of producing this, I want LyX to generate the following code:

\begin_inset CommandInset toc
LatexCommand indici

\end_inset

I have been trying to do this for a long while with LyX 1.6.1 which follows
LyX layout format version 11, but failed miserably. Here is what I tried:

InsetLayout "CommandInset toc"
 LatexCommand   indici
End

I have tried several combinations and none of them seem to work. I think
there should be a way to customize CommandInset layouts just as it is
possible to customize Floats. Can anyone help me with this? The document on
Customizing LyX does not mention anything about CommandInsets.

Please help if you know how to do this. I don't even find an example layout
file in the LyX package that does something similar.

Balaji