Why does the result of FPeval disappear after a `&`

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am trying to use the fp package, and the results are deeply confusing to me:



documentclass[a4paper]article
usepackagefp
begindocument
begintabularr
FPevaltesting2 + 2
a & testing
endtabular
enddocument


This will not compile:



This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./mvce.tex
LaTeX2e <2018-04-01> patch level 5
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/fp/fp.sty
`Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
(/usr/share/texmf-dist/tex/latex/fp/defpattern.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-basic.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-addons.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-snap.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-exp.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-trigo.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-pas.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-random.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-eqn.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-upn.sty)
(/usr/share/texmf-dist/tex/latex/fp/fp-eval.sty))
No file mvce.aux.
( FP-EVAL ( FP-UPN ( FP-ADD ) ) )
! Undefined control sequence.
l.6 a & testing


However, removing the & will give the intended result. Why does that happen, and what can I do about it? Should I use a different package for arithmetic?



This is just a simplified example. I actually want to use the result multiple times across a & and \ boundary, which is why I can't just move the FPeval where the result is used.










share|improve this question

























    up vote
    3
    down vote

    favorite












    I am trying to use the fp package, and the results are deeply confusing to me:



    documentclass[a4paper]article
    usepackagefp
    begindocument
    begintabularr
    FPevaltesting2 + 2
    a & testing
    endtabular
    enddocument


    This will not compile:



    This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) (preloaded format=pdflatex)
    restricted write18 enabled.
    entering extended mode
    (./mvce.tex
    LaTeX2e <2018-04-01> patch level 5
    (/usr/share/texmf-dist/tex/latex/base/article.cls
    Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
    (/usr/share/texmf-dist/tex/latex/base/size10.clo))
    (/usr/share/texmf-dist/tex/latex/fp/fp.sty
    `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
    (/usr/share/texmf-dist/tex/latex/fp/defpattern.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-basic.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-addons.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-snap.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-exp.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-trigo.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-pas.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-random.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-eqn.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-upn.sty)
    (/usr/share/texmf-dist/tex/latex/fp/fp-eval.sty))
    No file mvce.aux.
    ( FP-EVAL ( FP-UPN ( FP-ADD ) ) )
    ! Undefined control sequence.
    l.6 a & testing


    However, removing the & will give the intended result. Why does that happen, and what can I do about it? Should I use a different package for arithmetic?



    This is just a simplified example. I actually want to use the result multiple times across a & and \ boundary, which is why I can't just move the FPeval where the result is used.










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am trying to use the fp package, and the results are deeply confusing to me:



      documentclass[a4paper]article
      usepackagefp
      begindocument
      begintabularr
      FPevaltesting2 + 2
      a & testing
      endtabular
      enddocument


      This will not compile:



      This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) (preloaded format=pdflatex)
      restricted write18 enabled.
      entering extended mode
      (./mvce.tex
      LaTeX2e <2018-04-01> patch level 5
      (/usr/share/texmf-dist/tex/latex/base/article.cls
      Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
      (/usr/share/texmf-dist/tex/latex/base/size10.clo))
      (/usr/share/texmf-dist/tex/latex/fp/fp.sty
      `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
      (/usr/share/texmf-dist/tex/latex/fp/defpattern.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-basic.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-addons.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-snap.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-exp.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-trigo.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-pas.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-random.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-eqn.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-upn.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-eval.sty))
      No file mvce.aux.
      ( FP-EVAL ( FP-UPN ( FP-ADD ) ) )
      ! Undefined control sequence.
      l.6 a & testing


      However, removing the & will give the intended result. Why does that happen, and what can I do about it? Should I use a different package for arithmetic?



      This is just a simplified example. I actually want to use the result multiple times across a & and \ boundary, which is why I can't just move the FPeval where the result is used.










      share|improve this question













      I am trying to use the fp package, and the results are deeply confusing to me:



      documentclass[a4paper]article
      usepackagefp
      begindocument
      begintabularr
      FPevaltesting2 + 2
      a & testing
      endtabular
      enddocument


      This will not compile:



      This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux) (preloaded format=pdflatex)
      restricted write18 enabled.
      entering extended mode
      (./mvce.tex
      LaTeX2e <2018-04-01> patch level 5
      (/usr/share/texmf-dist/tex/latex/base/article.cls
      Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
      (/usr/share/texmf-dist/tex/latex/base/size10.clo))
      (/usr/share/texmf-dist/tex/latex/fp/fp.sty
      `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich
      (/usr/share/texmf-dist/tex/latex/fp/defpattern.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-basic.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-addons.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-snap.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-exp.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-trigo.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-pas.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-random.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-eqn.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-upn.sty)
      (/usr/share/texmf-dist/tex/latex/fp/fp-eval.sty))
      No file mvce.aux.
      ( FP-EVAL ( FP-UPN ( FP-ADD ) ) )
      ! Undefined control sequence.
      l.6 a & testing


      However, removing the & will give the intended result. Why does that happen, and what can I do about it? Should I use a different package for arithmetic?



      This is just a simplified example. I actually want to use the result multiple times across a & and \ boundary, which is why I can't just move the FPeval where the result is used.







      tables fp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      NieDzejkob

      1162




      1162




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote













          testing is a local variable, lost in the local scope (corresponding to each cell of the tabular). You need to set it global to use it in a different cell, or outside the tabular.



          documentclass[a4paper]article
          usepackagefp
          begindocument
          begintabularr
          FPevaltesting2 + 2globallettestingtesting
          a & testing
          endtabular

          Look, I am even available outside the tabular: testing
          enddocument


          enter image description here






          share|improve this answer






















          • Isn't it more the cells than the tabular env? Each cell in a table is a local group.
            – daleif
            16 mins ago










          • I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
            – NieDzejkob
            15 mins ago






          • 1




            @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
            – Steven B. Segletes
            6 mins ago










          • @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
            – Steven B. Segletes
            2 mins ago










          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f455569%2fwhy-does-the-result-of-fpeval-disappear-after-a%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote













          testing is a local variable, lost in the local scope (corresponding to each cell of the tabular). You need to set it global to use it in a different cell, or outside the tabular.



          documentclass[a4paper]article
          usepackagefp
          begindocument
          begintabularr
          FPevaltesting2 + 2globallettestingtesting
          a & testing
          endtabular

          Look, I am even available outside the tabular: testing
          enddocument


          enter image description here






          share|improve this answer






















          • Isn't it more the cells than the tabular env? Each cell in a table is a local group.
            – daleif
            16 mins ago










          • I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
            – NieDzejkob
            15 mins ago






          • 1




            @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
            – Steven B. Segletes
            6 mins ago










          • @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
            – Steven B. Segletes
            2 mins ago














          up vote
          5
          down vote













          testing is a local variable, lost in the local scope (corresponding to each cell of the tabular). You need to set it global to use it in a different cell, or outside the tabular.



          documentclass[a4paper]article
          usepackagefp
          begindocument
          begintabularr
          FPevaltesting2 + 2globallettestingtesting
          a & testing
          endtabular

          Look, I am even available outside the tabular: testing
          enddocument


          enter image description here






          share|improve this answer






















          • Isn't it more the cells than the tabular env? Each cell in a table is a local group.
            – daleif
            16 mins ago










          • I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
            – NieDzejkob
            15 mins ago






          • 1




            @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
            – Steven B. Segletes
            6 mins ago










          • @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
            – Steven B. Segletes
            2 mins ago












          up vote
          5
          down vote










          up vote
          5
          down vote









          testing is a local variable, lost in the local scope (corresponding to each cell of the tabular). You need to set it global to use it in a different cell, or outside the tabular.



          documentclass[a4paper]article
          usepackagefp
          begindocument
          begintabularr
          FPevaltesting2 + 2globallettestingtesting
          a & testing
          endtabular

          Look, I am even available outside the tabular: testing
          enddocument


          enter image description here






          share|improve this answer














          testing is a local variable, lost in the local scope (corresponding to each cell of the tabular). You need to set it global to use it in a different cell, or outside the tabular.



          documentclass[a4paper]article
          usepackagefp
          begindocument
          begintabularr
          FPevaltesting2 + 2globallettestingtesting
          a & testing
          endtabular

          Look, I am even available outside the tabular: testing
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 5 mins ago

























          answered 1 hour ago









          Steven B. Segletes

          148k9187392




          148k9187392











          • Isn't it more the cells than the tabular env? Each cell in a table is a local group.
            – daleif
            16 mins ago










          • I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
            – NieDzejkob
            15 mins ago






          • 1




            @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
            – Steven B. Segletes
            6 mins ago










          • @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
            – Steven B. Segletes
            2 mins ago
















          • Isn't it more the cells than the tabular env? Each cell in a table is a local group.
            – daleif
            16 mins ago










          • I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
            – NieDzejkob
            15 mins ago






          • 1




            @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
            – Steven B. Segletes
            6 mins ago










          • @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
            – Steven B. Segletes
            2 mins ago















          Isn't it more the cells than the tabular env? Each cell in a table is a local group.
          – daleif
          16 mins ago




          Isn't it more the cells than the tabular env? Each cell in a table is a local group.
          – daleif
          16 mins ago












          I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
          – NieDzejkob
          15 mins ago




          I believe that's what I need, thanks. Are there any other scopes than global? For example, is it possible to make the variable's scope be the interior of a newcommand definition? Could I wrap this construction into a macro, to avoid typing it out every time? Something like myevalglobaltesting2 + 2
          – NieDzejkob
          15 mins ago




          1




          1




          @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
          – Steven B. Segletes
          6 mins ago




          @daleif That is what I meant, but I see how it can be confused...I will edit to clarify.
          – Steven B. Segletes
          6 mins ago












          @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
          – Steven B. Segletes
          2 mins ago




          @NieDzejkob There are only local and global scopes. With extra work, you could save a global variable, change it as you wish, and then reset it back to the earlier value, but why spend the effort? That said, you could certainly define a gFPeval that accomplishes both the FPeval and the globalization.
          – Steven B. Segletes
          2 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f455569%2fwhy-does-the-result-of-fpeval-disappear-after-a%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery