[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-devel
Subject:    Re: GUI indicator for a command environment
From:       "Paul A. Rubin" <parubin73 () gmail ! com>
Date:       2018-10-20 21:48:24
Message-ID: 013bf217-5d43-9bb0-fb3b-111026824b4c () gmail ! com
[Download RAW message or body]

On 10/19/18 8:48 PM, Richard Kimberly Heck wrote:
> On 10/19/18 3:46 PM, Paul A. Rubin wrote:
> > On 10/18/18 9:53 PM, Richard Kimberly Heck wrote:
> > > On 10/18/18 2:01 PM, Paul A. Rubin wrote:
> > > > On 10/17/18 7:09 PM, Richard Kimberly Heck wrote:
> > > > > On 10/17/18 2:35 PM, Paul A. Rubin wrote:
> > > > > > On 10/17/18 11:24 AM, Richard Kimberly Heck wrote:
> > > > > > > On 10/17/18 9:30 AM, Paul A. Rubin wrote:
> > > > > > > > On 10/16/18 10:24 PM, Andrew Parsloe wrote:
> > > > > > > > > On 17/10/2018 4:47 a.m., Paul A. Rubin wrote:
> > > > > > > > > > Dear devs,
> > > > > > > > > > 
> > > > > > > > > > I'm struggling to cobble together a module supporting the 
> > > > > > > > > > pseudocode features of the algorithmicx package. As a 
> > > > > > > > > > disclaimer, I'm trying to avoid flex insets and stick to 
> > > > > > > > > > environments as much as possible, because there's less 
> > > > > > > > > > mousery switching an environment than insert an inset.
> > > > > > > > > > 
> > > > > > > > > > Right now, I'm tripping over the for block, which it 
> > > > > > > > > > implements by two LaTeX commands: \For{<conditions>} and 
> > > > > > > > > > \EndFor. I can treat those as command styles and get the 
> > > > > > > > > > correct output, but the GUI is confusing to the user because 
> > > > > > > > > > nothing displays in the line ending the loop (it looks like a 
> > > > > > > > > > blank line to the user) and the condition appears in the 
> > > > > > > > > > starting line with no visible prefix (so it looks like any 
> > > > > > > > > > random statement in the algorithm, unless you notice what the 
> > > > > > > > > > environment select box is displaying.
> > > > > > > > > > 
> > > > > > > > > > So what I'm looking for right now is a way to display a 
> > > > > > > > > > tag/prefix/symbol at the start of a command style that 
> > > > > > > > > > appears in the GUI but /not/ in the compiled output. The 
> > > > > > > > > > "handle" for an inset would be fine, as would something like 
> > > > > > > > > > a bullet that was GUI-only. Can this be done with the current 
> > > > > > > > > > layout/module system?
> > > > > > > > > > 
> > > > > > > > > > TIA,
> > > > > > > > > > Paul
> > > > > > > > > Is this what you are wanting (from Customization manual 
> > > > > > > > > 5.3.7)? (I experimented with this a couple of years ago, so my 
> > > > > > > > > memory of the exact effect is somewhat hazy.)
> > > > > > > > > 
> > > > > > > > > Andrew
> > > > > > > > > 
> > > > > > > > > > LabelType|
> > > > > > > > > [|/No_Label/, Manual, Static, Above,
> > > > > > > > > Centered, Sensitive, Enumerate,
> > > > > > > > > Itemize, Bibliography|]
> > > > > > > > > 
> > > > > > > > > > Static|
> > > > > > > > > means the label is simply what is declared as
> > > > > > > > > > LabelString|. This will be displayed "inline", at the
> > > > > > > > > beginning of the paragraph. If the |LatexType| is
> > > > > > > > > > Environment|, then it will be displayed only in the
> > > > > > > > > first paragraph of any sequence of paragraphs with the
> > > > > > > > > same |Style|.
> > > > > > > > > > Above|  and |Centered|
> > > > > > > > > are special cases of |Static|. The label will be
> > > > > > > > > printed above the paragraph either at the beginning of
> > > > > > > > > the line or centered.
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> \
> > > > > > > > >   Virus-free. www.avast.com 
> > > > > > > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> \
> > > > > > > > >  
> > > > > > > > > 
> > > > > > > > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> > > > > > > > Thanks for the reply, but no, that doesn't work. With a command 
> > > > > > > > type style (and combined with a LabelString argument) it does 
> > > > > > > > not seem to do anything in either the GUI or the output. I 
> > > > > > > > tried it with an environment, and I believe the label string 
> > > > > > > > showed up in the output but not the GUI. (I would have to 
> > > > > > > > double-check that.)
> > > > > > > 
> > > > > > > Try this in Local Layout (to test):
> > > > > > > 
> > > > > > > Format 66
> > > > > > > 
> > > > > > > Style ForLoop
> > > > > > > 
> > > > > > > LatexType Command
> > > > > > > 
> > > > > > > LabelType Static
> > > > > > > 
> > > > > > > LabelString "ForLoop: "
> > > > > > > 
> > > > > > > EndLabelType Static
> > > > > > > 
> > > > > > > Margin Static
> > > > > > > 
> > > > > > > LeftMargin "ForLoop: "
> > > > > > > 
> > > > > > > LabelFont
> > > > > > > 
> > > > > > > Color red
> > > > > > > 
> > > > > > > Series bold
> > > > > > > 
> > > > > > > EndFont
> > > > > > > 
> > > > > > > EndLabelString " EndForLoop"
> > > > > > > 
> > > > > > > LatexName forloop
> > > > > > > 
> > > > > > > End
> > > > > > > 
> > > > > > > The margin always throws me off. If it's wrong, the label is off 
> > > > > > > screen to the left.
> > > > > > > 
> > > > > > > You could also try "LabelType Above" and remove the margin stuff.
> > > > > > > 
> > > > > > > Riki
> > > > > > > 
> > > > > > Thanks Riki! That at least gets me headed in the right direction. 
> > > > > > I don't know why I wasn't getting the label string to display 
> > > > > > before -- maybe because I failed to specify the Margin, 
> > > > > > LeftMargin or LabelFont? (I did specify LabelType and 
> > > > > > LabelString, with no luck.)
> > > > > > 
> > > > > > The margin business is going to be interesting. Your code has the 
> > > > > > correct left margin when select the ForLoop style from the 
> > > > > > environment list, but when I nest it (inside an algorithmicx 
> > > > > > environment) the label moves to the left (I would have expected 
> > > > > > right) and blows the left margin. I expect that an exhaustive try 
> > > > > > of all choices will eventually find one that works.
> > > > > 
> > > > > It would not surprise me if there were a bug here about margin 
> > > > > handling. Can you send an MWE? Put any new layout code into Local 
> > > > > Layout.
> > > > > 
> > > > > Riki
> > > > > 
> > > > > 
> > > > I think the attached MWE shows what I was talking about. (At least, 
> > > > it does for me.) To avoid requiring any special packages, I'm using 
> > > > the quote environment as a surrogate for the algorithmic 
> > > > environment and a dummy LaTeX function as a surrogate for the 
> > > > actual for block code.
> > > 
> > > Can you create a bug report for this? I do not know this part of the 
> > > code at all well.
> > > 
> > > Riki
> > > 
> > > 
> > I could update the MWE to include what I discovered about other 
> > margin choices, but to be honest I'm not sure how much if any of this 
> > is a bug and how much is an ID10T error. :-)
> 
> It does not look right to me at all.
> 
> Riki
> 
> 
Okay, I've opened ticket 11347 for the label positioning part. I have 
another issue, for which I'll probably open a separate ticket.

Thanks,
Paul


[Attachment #3 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/19/18 8:48 PM, Richard Kimberly
      Heck wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:f3b10c65-74f2-6b30-b952-46d1facd5671@lyx.org">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">On 10/19/18 3:46 PM, Paul A. Rubin
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:f7293b41-0466-9d00-dfa2-3e1a3e460480@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <div class="moz-cite-prefix">On 10/18/18 9:53 PM, Richard
          Kimberly Heck wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:48a5578e-f25b-a98c-d19c-54015421be4b@lyx.org">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <div class="moz-cite-prefix">On 10/18/18 2:01 PM, Paul A.
            Rubin wrote:<br>
          </div>
          <blockquote type="cite"
            cite="mid:3bf29e3f-56c6-0a3e-f0da-ffd0ec934d74@gmail.com">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8">
            <div class="moz-cite-prefix">On 10/17/18 7:09 PM, Richard
              Kimberly Heck wrote:<br>
            </div>
            <blockquote type="cite"
              cite="mid:5abc5c56-1f2f-b5fd-b314-0a085272cb92@lyx.org">
              <meta http-equiv="Content-Type" content="text/html;
                charset=UTF-8">
              <div class="moz-cite-prefix">On 10/17/18 2:35 PM, Paul A.
                Rubin wrote:<br>
              </div>
              <blockquote type="cite"
                cite="mid:7b609a82-965c-6b9e-43ae-6bcfebc16ffd@gmail.com">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=UTF-8">
                <div class="moz-cite-prefix">On 10/17/18 11:24 AM,
                  Richard Kimberly Heck wrote:<br>
                </div>
                <blockquote type="cite"
                  cite="mid:cb191de8-f472-5b04-0445-916408cf4806@lyx.org">
                  <meta http-equiv="Content-Type" content="text/html;
                    charset=UTF-8">
                  <div class="moz-cite-prefix">On 10/17/18 9:30 AM, Paul
                    A. Rubin wrote:<br>
                  </div>
                  <blockquote type="cite"
                    cite="mid:49a07f70-d9d8-fc29-2429-9911e15dea7b@gmail.com">
                    <meta http-equiv="Content-Type" content="text/html;
                      charset=UTF-8">
                    <div class="moz-cite-prefix">On 10/16/18 10:24 PM,
                      Andrew Parsloe wrote:<br>
                    </div>
                    <blockquote type="cite"
                      cite="mid:ef8de6ac-f7d0-25c0-bc9e-5aa020bb8ecc@gmail.com">
                      <meta http-equiv="Content-Type"
                        content="text/html; charset=UTF-8">
                      On 17/10/2018 4:47 a.m., Paul A. Rubin wrote:<br>
                      <blockquote type="cite"
                        cite="mid:afcda1fb-b58c-1d1d-9165-4b4526a1f4ef@gmail.com">
                        <meta http-equiv="content-type"
                          content="text/html; charset=UTF-8">
                        Dear devs,<br>
                        <br>
                        I'm struggling to cobble together a module
                        supporting the pseudocode features of the
                        algorithmicx package. As a disclaimer, I'm
                        trying to avoid flex insets and stick to
                        environments as much as possible, because
                        there's less mousery switching an environment
                        than insert an inset.<br>
                        <br>
                        Right now, I'm tripping over the for block,
                        which it implements by two LaTeX commands:
                        \For{&lt;conditions&gt;} and \EndFor. I can
                        treat those as command styles and get the
                        correct output, but the GUI is confusing to the
                        user because nothing displays in the line ending
                        the loop (it looks like a blank line to the
                        user) and the condition appears in the starting
                        line with no visible prefix (so it looks like
                        any random statement in the algorithm, unless
                        you notice what the environment select box is
                        displaying.<br>
                        <br>
                        So what I'm looking for right now is a way to
                        display a tag/prefix/symbol at the start of a
                        command style that appears in the GUI but <i>not</i>
                        in the compiled output. The "handle" for an
                        inset would be fine, as would something like a
                        bullet that was GUI-only. Can this be done with
                        the current layout/module system?<br>
                        <br>
                        TIA,<br>
                        Paul<br>
                      </blockquote>
                      Is this what you are wanting (from Customization
                      manual 5.3.7)? (I experimented with this a couple
                      of years ago, so my memory of the exact effect is
                      somewhat hazy.)<br>
                      <br>
                      Andrew<br>
                      <style type="text/css"> /* Layout-provided Styles */
dl.description dt { font-weight: bold; }
div.plain_layout {
text-align: left;

}
code.flex_code {
font-family: monospace;
}


</style>
                      <dl class="description" id="magicparlabel-38928">
                        <dt class="description_label"><code
                            class="flex_code">LabelType</code></dt>
                        <dd class="description_item"> [<code
                            class="flex_code"><em>No_Label</em>, Manual,
                            Static, Above, <br>
                            Centered, Sensitive, Enumerate, <br>
                            Itemize, Bibliography</code>]
                          <dl class="description"
                            id="magicparlabel-38931">
                            <dt class="description_label"><code
                                class="flex_code">Static</code></dt>
                            <dd class="description_item"> means the
                              label is simply what is declared as <code
                                class="flex_code">LabelString</code>.
                              This will be displayed “inline”, at the
                              beginning of the paragraph. If the <code
                                class="flex_code">LatexType</code> is <code
                                class="flex_code">Environment</code>,
                              then it will be displayed only in the
                              first paragraph of any sequence of
                              paragraphs with the same <code
                                class="flex_code">Style</code>.</dd>
                            <dt class="description_label"><code
                                class="flex_code">Above</code> and <code
                                class="flex_code">Centered</code></dt>
                            <dd class="description_item"> are special
                              cases of <code class="flex_code">Static</code>.
                              The label will be printed above the
                              paragraph either at the beginning of the
                              line or centered.</dd>
                          </dl>
                        </dd>
                      </dl>
                      <br>
                      <br>
                      <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
                        <table style="border-top: 1px solid #D3D4DE;">
                          <tbody>
                            <tr>
                              <td style="width: 55px; padding-top:
                                13px;"><a
href="https://www.avast.com/sig-email?utm_medium=email&amp;utm_source=link&amp;utm_campaign=sig-email&amp;utm_content=emailclient"
                
                                  target="_blank" moz-do-not-send="true"><img
src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif"
  alt="" style="width: 46px;&#xA;
                                    height:&#xA; 29px;"
                                    moz-do-not-send="true" width="46"
                                    height="29"></a></td>
                              <td style="width: 470px;&#xA;&#xA;
                                padding-top:&#xA;&#xA;&#xA;
                                12px;&#xA;&#xA;&#xA;
                                color:&#xA;&#xA;&#xA;
                                #41424e;&#xA;&#xA;&#xA; font-size:&#xA;
                                13px;&#xA;&#xA;&#xA;&#xA;
                                font-family:&#xA;&#xA;
                                Arial,&#xA;&#xA;&#xA;
                                Helvetica,&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;
                                sans-serif;&#xA; line-height: 18px;">Virus-free.
                                <a
href="https://www.avast.com/sig-email?utm_medium=email&amp;utm_source=link&amp;utm_campaign=sig-email&amp;utm_content=emailclient"
  target="_blank" style="color:
                                  #4453ea;" moz-do-not-send="true">www.avast.com</a>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                        <a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"
                          width="1" height="1" moz-do-not-send="true"> </a></div>
                    </blockquote>
                    Thanks for the reply, but no, that doesn't work.
                    With a command type style (and combined with a
                    LabelString argument) it does not seem to do
                    anything in either the GUI or the output. I tried it
                    with an environment, and I believe the label string
                    showed up in the output but not the GUI. (I would
                    have to double-check that.)<br>
                  </blockquote>
                  <p>
</p>
                  <p>Try this in Local Layout (to test):
</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">Format 66</p>
                  <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;"> </p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">Style \
                ForLoop</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LatexType \
                Command</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LabelType \
                Static</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LabelString \
                "ForLoop:  "</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">EndLabelType \
                Static</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">Margin \
                Static</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LeftMargin \
                "ForLoop:   "</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LabelFont</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">	Color \
                red</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">	Series \
                bold</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px;">EndFont</p>  <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
                -qt-block-indent:0; text-indent:0px;">EndLabelString "  \
                EndForLoop"</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">LatexName \
                forloop</p>
                  <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
                margin-right:0px; -qt-block-indent:0; text-indent:0px;">End</p>
                  <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px;"> </p>
                  <p><style type="text/css">
p, li { white-space: pre-wrap; }
</style></p>
                  <p>The margin always throws me off. If it's wrong, the label is off \
                screen to the left.</p>
                  <p>You could also try "LabelType Above" and remove the margin \
stuff.</p>  <p>Riki</p>
                  <p>
</p>
                </blockquote>
                Thanks Riki! That at least gets me headed in the right
                direction. I don't know why I wasn't getting the label
                string to display before -- maybe because I failed to
                specify the Margin, LeftMargin or LabelFont? (I did
                specify LabelType and LabelString, with no luck.)<br>
                <br>
                The margin business is going to be interesting. Your
                code has the correct left margin when select the ForLoop
                style from the environment list, but when I nest it
                (inside an algorithmicx environment) the label moves to
                the left (I would have expected right) and blows the
                left margin. I expect that an exhaustive try of all
                choices will eventually find one that works.<br>
              </blockquote>
              <p>It would not surprise me if there were a bug here about margin \
handling. Can you send an MWE? Put any new layout code into Local Layout.</p>  \
<p>Riki</p>  <br>
            </blockquote>
            I think the attached MWE shows what I was talking about. (At
            least, it does for me.) To avoid requiring any special
            packages, I'm using the quote environment as a surrogate for
            the algorithmic environment and a dummy LaTeX function as a
            surrogate for the actual for block code.<br>
          </blockquote>
          <p>Can you create a bug report for this? I do not know this part of the \
code at all well.</p>  <p>Riki</p>
          <br>
        </blockquote>
        I could update the MWE to include what I discovered about other
        margin choices, but to be honest I'm not sure how much if any of
        this is a bug and how much is an ID10T error. :-)<br>
      </blockquote>
      <p>
</p>
      <p>It does not look right to me at all.</p>
      <p>Riki</p>
      <br>
    </blockquote>
    Okay, I've opened ticket 11347 for the label positioning part. I
    have another issue, for which I'll probably open a separate ticket.<br>
    <br>
    Thanks,<br>
    Paul<br>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic