What does output.check do in a .bst file?












3














I've seen the function output.check used in .bst files a number of times; I'm sure I knew what it did at some point but I've now forgotten, and I can't easily find documentation that explains it (which presumably exists, but is buried in a bunch of resources which use it but don't say much about it.



In my (merlin-generated) .bst file, it reads



FUNCTION {output.check}
{ 't :=
duplicate$ empty$
{ pop$ "empty " t * " in " * cite$ * warning$ }
'output.nonnull
if$
}


but most of that is unclear to me. What does this function do?










share|improve this question



























    3














    I've seen the function output.check used in .bst files a number of times; I'm sure I knew what it did at some point but I've now forgotten, and I can't easily find documentation that explains it (which presumably exists, but is buried in a bunch of resources which use it but don't say much about it.



    In my (merlin-generated) .bst file, it reads



    FUNCTION {output.check}
    { 't :=
    duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
    if$
    }


    but most of that is unclear to me. What does this function do?










    share|improve this question

























      3












      3








      3







      I've seen the function output.check used in .bst files a number of times; I'm sure I knew what it did at some point but I've now forgotten, and I can't easily find documentation that explains it (which presumably exists, but is buried in a bunch of resources which use it but don't say much about it.



      In my (merlin-generated) .bst file, it reads



      FUNCTION {output.check}
      { 't :=
      duplicate$ empty$
      { pop$ "empty " t * " in " * cite$ * warning$ }
      'output.nonnull
      if$
      }


      but most of that is unclear to me. What does this function do?










      share|improve this question













      I've seen the function output.check used in .bst files a number of times; I'm sure I knew what it did at some point but I've now forgotten, and I can't easily find documentation that explains it (which presumably exists, but is buried in a bunch of resources which use it but don't say much about it.



      In my (merlin-generated) .bst file, it reads



      FUNCTION {output.check}
      { 't :=
      duplicate$ empty$
      { pop$ "empty " t * " in " * cite$ * warning$ }
      'output.nonnull
      if$
      }


      but most of that is unclear to me. What does this function do?







      bibtex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 11 '18 at 19:15









      E.P.

      8182722




      8182722






















          1 Answer
          1






          active

          oldest

          votes


















          4














          Short version:



          It checks if a required field is empty and issues a warning if so. To know which field you need to look at where the function is called. For instance, looking at the article function in plain.bst:



          format.authors "author" output.check


          This will check the author field and will print empty author in <entry> to the blg file.



          Long version:



          For instance, in the example above, the format.authors function is:



          FUNCTION {format.authors}
          { author empty$
          { "" }
          { author format.names }
          if$
          }


          It will leave either "<Author-names>" or "" on the stack, depending if the author field was given. So, by now, our stack has as a (possibly empty) string. Now we insert a string "author" on the stack and call output.check.



          output.check will do 't :=, which will put the topmost item of the stack (the literal string "author") in the variable 't. Now we only have the (possibly empty) "<Author-names>" string on the stack.



          Then we have duplicate$, which will make a copy of that, and then we have empty$, which will leave a logical 1 or 0 if that string of author names is empty.



          The two conditional branches are inserted on the stack and consumed when the if$ is called. The if$ will check if the empty$ returned 1 or 0 and will put the first or second branches on the stack accordingly.



          If the 1 branch is taken, it means that the author field was not given, then we'll have pop$ "empty " t * " in " * cite$ * warning$ which will discard (now certainly) empty "<Author-names>" string and issue the warning. After that the execution continues normally.



          If the 0 branch is taken, then 'output.nonnull if called to print a (now certainly) not empty string.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464380%2fwhat-does-output-check-do-in-a-bst-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            Short version:



            It checks if a required field is empty and issues a warning if so. To know which field you need to look at where the function is called. For instance, looking at the article function in plain.bst:



            format.authors "author" output.check


            This will check the author field and will print empty author in <entry> to the blg file.



            Long version:



            For instance, in the example above, the format.authors function is:



            FUNCTION {format.authors}
            { author empty$
            { "" }
            { author format.names }
            if$
            }


            It will leave either "<Author-names>" or "" on the stack, depending if the author field was given. So, by now, our stack has as a (possibly empty) string. Now we insert a string "author" on the stack and call output.check.



            output.check will do 't :=, which will put the topmost item of the stack (the literal string "author") in the variable 't. Now we only have the (possibly empty) "<Author-names>" string on the stack.



            Then we have duplicate$, which will make a copy of that, and then we have empty$, which will leave a logical 1 or 0 if that string of author names is empty.



            The two conditional branches are inserted on the stack and consumed when the if$ is called. The if$ will check if the empty$ returned 1 or 0 and will put the first or second branches on the stack accordingly.



            If the 1 branch is taken, it means that the author field was not given, then we'll have pop$ "empty " t * " in " * cite$ * warning$ which will discard (now certainly) empty "<Author-names>" string and issue the warning. After that the execution continues normally.



            If the 0 branch is taken, then 'output.nonnull if called to print a (now certainly) not empty string.






            share|improve this answer


























              4














              Short version:



              It checks if a required field is empty and issues a warning if so. To know which field you need to look at where the function is called. For instance, looking at the article function in plain.bst:



              format.authors "author" output.check


              This will check the author field and will print empty author in <entry> to the blg file.



              Long version:



              For instance, in the example above, the format.authors function is:



              FUNCTION {format.authors}
              { author empty$
              { "" }
              { author format.names }
              if$
              }


              It will leave either "<Author-names>" or "" on the stack, depending if the author field was given. So, by now, our stack has as a (possibly empty) string. Now we insert a string "author" on the stack and call output.check.



              output.check will do 't :=, which will put the topmost item of the stack (the literal string "author") in the variable 't. Now we only have the (possibly empty) "<Author-names>" string on the stack.



              Then we have duplicate$, which will make a copy of that, and then we have empty$, which will leave a logical 1 or 0 if that string of author names is empty.



              The two conditional branches are inserted on the stack and consumed when the if$ is called. The if$ will check if the empty$ returned 1 or 0 and will put the first or second branches on the stack accordingly.



              If the 1 branch is taken, it means that the author field was not given, then we'll have pop$ "empty " t * " in " * cite$ * warning$ which will discard (now certainly) empty "<Author-names>" string and issue the warning. After that the execution continues normally.



              If the 0 branch is taken, then 'output.nonnull if called to print a (now certainly) not empty string.






              share|improve this answer
























                4












                4








                4






                Short version:



                It checks if a required field is empty and issues a warning if so. To know which field you need to look at where the function is called. For instance, looking at the article function in plain.bst:



                format.authors "author" output.check


                This will check the author field and will print empty author in <entry> to the blg file.



                Long version:



                For instance, in the example above, the format.authors function is:



                FUNCTION {format.authors}
                { author empty$
                { "" }
                { author format.names }
                if$
                }


                It will leave either "<Author-names>" or "" on the stack, depending if the author field was given. So, by now, our stack has as a (possibly empty) string. Now we insert a string "author" on the stack and call output.check.



                output.check will do 't :=, which will put the topmost item of the stack (the literal string "author") in the variable 't. Now we only have the (possibly empty) "<Author-names>" string on the stack.



                Then we have duplicate$, which will make a copy of that, and then we have empty$, which will leave a logical 1 or 0 if that string of author names is empty.



                The two conditional branches are inserted on the stack and consumed when the if$ is called. The if$ will check if the empty$ returned 1 or 0 and will put the first or second branches on the stack accordingly.



                If the 1 branch is taken, it means that the author field was not given, then we'll have pop$ "empty " t * " in " * cite$ * warning$ which will discard (now certainly) empty "<Author-names>" string and issue the warning. After that the execution continues normally.



                If the 0 branch is taken, then 'output.nonnull if called to print a (now certainly) not empty string.






                share|improve this answer












                Short version:



                It checks if a required field is empty and issues a warning if so. To know which field you need to look at where the function is called. For instance, looking at the article function in plain.bst:



                format.authors "author" output.check


                This will check the author field and will print empty author in <entry> to the blg file.



                Long version:



                For instance, in the example above, the format.authors function is:



                FUNCTION {format.authors}
                { author empty$
                { "" }
                { author format.names }
                if$
                }


                It will leave either "<Author-names>" or "" on the stack, depending if the author field was given. So, by now, our stack has as a (possibly empty) string. Now we insert a string "author" on the stack and call output.check.



                output.check will do 't :=, which will put the topmost item of the stack (the literal string "author") in the variable 't. Now we only have the (possibly empty) "<Author-names>" string on the stack.



                Then we have duplicate$, which will make a copy of that, and then we have empty$, which will leave a logical 1 or 0 if that string of author names is empty.



                The two conditional branches are inserted on the stack and consumed when the if$ is called. The if$ will check if the empty$ returned 1 or 0 and will put the first or second branches on the stack accordingly.



                If the 1 branch is taken, it means that the author field was not given, then we'll have pop$ "empty " t * " in " * cite$ * warning$ which will discard (now certainly) empty "<Author-names>" string and issue the warning. After that the execution continues normally.



                If the 0 branch is taken, then 'output.nonnull if called to print a (now certainly) not empty string.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 11 '18 at 19:56









                Phelype Oleinik

                21.4k54381




                21.4k54381






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f464380%2fwhat-does-output-check-do-in-a-bst-file%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?