Custom layout inset without arguments

Richard Kimberly Heck rikiheck at lyx.org
Sat Apr 18 18:36:05 UTC 2020


On 4/18/20 9:49 AM, Gaston Gloesener wrote:
>
> Hello,
>
>  
>
> NOTE: if you are not interested in my history of TeX/LaTex and Lyx
> just jump to the question below :-D
>
>  
>
> I am very new to Lyx but a very “old” Tex/LaTeX user, while I was not
> using it for long time right now. I started using TeX/LaTeX back in
> the 1990’s where I used it for writing several project documents and
> even wrote a quite complex package for building figures of binary data
> structures.
>
>  
>
> So I did have some very deep TeX knowledge at that time, while I have
> to admit that now I have to lookup everything again like a noob 😊 But
> due to the former use the bits come up and fit together quite easily
> again. When it comes to LaTeX my knowledge is also much smaller than
> at that time but still better then plain TeX “internals”.
>
>  
>
> This said, I decided to start a rather quite huge project
> documentation using LaTeX again for reasons of the target audience of
> the project. While I was used to write all my documents in plain LaTeX
> in ascii mode I decided to give a modern frontend a try this time.
> After some research and reading my choice did obviously fall on LyX.
> This was yesterday late evening 😃 and I decided to start with MikTex
> after also some research on both options. I was not expecting LyX to
> trigger as many MikTex  package downloads which voided one advantage
> of MikTex and also hung at some point. So I went back and went with
> TexLive this time. Installation took a long time (as expected) but
> worked this time including LyX which I reinstalled just for not having
> to search on how to switch TeX instance and making sure it’s a clean
> installation as well.
>
>  
>
> _Question_
>
>  
>
> First I want to mention that I did RFM (LyX user and customization
> manuals relevant sections) and used google with no success
>
>  
>
> I was looking for a way to use macros for entity names which may
> change throughout the lifecycle of the documents (like the project
> name). I know how to do it using a TeX macro but I wanted it to be a
> LyX integrated solution. The solution was found via google  to be an
> InsetLayout in the local layout settings. I did quickly understand the
> main mechanics and attributes so that I got it to work and looked up
> the details in the LyX customization manual.
>
>  
>
>  
>
> InsetLayout "Flex:projectNameInset"
>
>   LabelString “My Project Name"
>
>   LatexType Command
>
>   LaTexName projectName
>
>   LyxType "custom"
>
>   Decoration Classic
>
>   Preamble
>
>     \newcommand*{\projectName}{ My Project Name }
>
>   EndPreamble
>
> End
>
>  
>
> The problem with this InsetLayout is that LyX always displays a red
> parameter input box after the insert of the inset and this is quite
> annoying in this use case as such insets will be quite common in the
> document. Is there any method for removing this as this macro does not
> require any arguments. I tried to set LatexType to None with no
> success and did not identify any other potential solution. Also google
> did not show me any potential solutions for this.
>
>  
>
> After some research and looking up in files provided with LyX I seem
> to understand that basically insets are always expected to have some
> type of conments and the use I make of it here is more a work-a-round
> than a solution. At least I was unable to locate an inset where no
> content was excpected.
>
>  
>
> So the question remains:
>
>  
>
>   * Is there a way to prevent LyX from asking for some content (red box)
>   * If not, is there another solutioin than the one used here to
>     achieve the same goals and avoid that input box ?
>   * would it be possible to add an attribute to InsetLayout to disable
>     the contents box in the doc text in a future version ? (like
>     NoContent)
>
This is bug #4066: https://www.lyx.org/trac/ticket/4066. There's at
least some intention to try to figure it out before 2.4.0. For now, the
workaround you mention is the only one available.

Riki



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200418/7f6b2b28/attachment-0001.html>


More information about the lyx-users mailing list