“adjustbox” with Export option seems to break page selection (in “pdfpages”)












4














I'd like to include some pages from a separate PDF with the right half trimmed off, but I don't know in advance the exact size of the pages. I tried a solution, using pdfpages to include from the PDF and adjustbox with the Export option to replace includegraphics and let me use the width macro.



However, as soon as adjustbox is included, includepdf becomes unable to include anything other than the first page! Here is a minimal example (with my 'real intention' included as a comment):



documentclass{article}

% Fails with Export option, works without!
% The export option solves the minimal example but breaks line marked ***
usepackage[Export]{adjustbox}
usepackage{pdfpages}

begin{document}

includepdf[pages=1]{lipsum.pdf}
includepdf[pages=2]{lipsum.pdf}

%% The commented line is more like what I want to do, but things fail
%% even without the trim/clip!
% includepdf[fitpaper,pages=1,trim={0 0 {.5width} 0},clip]{lipsum.pdf} % ***

end{document}


The example ought to just include pages 1 and 2 of `lipsum.pdf', but instead it just includes page 1 twice!



Replacing Export with export fixes the minimal example but breaks the line ***, apparently because width is then not defined in the arguments to includegraphics.



I can think of several workarounds for this (pdftk burst the original pdf beforehand, etc.) but does anyone know what's going on here, and whether one of the packages can be patched?










share|improve this question





























    4














    I'd like to include some pages from a separate PDF with the right half trimmed off, but I don't know in advance the exact size of the pages. I tried a solution, using pdfpages to include from the PDF and adjustbox with the Export option to replace includegraphics and let me use the width macro.



    However, as soon as adjustbox is included, includepdf becomes unable to include anything other than the first page! Here is a minimal example (with my 'real intention' included as a comment):



    documentclass{article}

    % Fails with Export option, works without!
    % The export option solves the minimal example but breaks line marked ***
    usepackage[Export]{adjustbox}
    usepackage{pdfpages}

    begin{document}

    includepdf[pages=1]{lipsum.pdf}
    includepdf[pages=2]{lipsum.pdf}

    %% The commented line is more like what I want to do, but things fail
    %% even without the trim/clip!
    % includepdf[fitpaper,pages=1,trim={0 0 {.5width} 0},clip]{lipsum.pdf} % ***

    end{document}


    The example ought to just include pages 1 and 2 of `lipsum.pdf', but instead it just includes page 1 twice!



    Replacing Export with export fixes the minimal example but breaks the line ***, apparently because width is then not defined in the arguments to includegraphics.



    I can think of several workarounds for this (pdftk burst the original pdf beforehand, etc.) but does anyone know what's going on here, and whether one of the packages can be patched?










    share|improve this question



























      4












      4








      4







      I'd like to include some pages from a separate PDF with the right half trimmed off, but I don't know in advance the exact size of the pages. I tried a solution, using pdfpages to include from the PDF and adjustbox with the Export option to replace includegraphics and let me use the width macro.



      However, as soon as adjustbox is included, includepdf becomes unable to include anything other than the first page! Here is a minimal example (with my 'real intention' included as a comment):



      documentclass{article}

      % Fails with Export option, works without!
      % The export option solves the minimal example but breaks line marked ***
      usepackage[Export]{adjustbox}
      usepackage{pdfpages}

      begin{document}

      includepdf[pages=1]{lipsum.pdf}
      includepdf[pages=2]{lipsum.pdf}

      %% The commented line is more like what I want to do, but things fail
      %% even without the trim/clip!
      % includepdf[fitpaper,pages=1,trim={0 0 {.5width} 0},clip]{lipsum.pdf} % ***

      end{document}


      The example ought to just include pages 1 and 2 of `lipsum.pdf', but instead it just includes page 1 twice!



      Replacing Export with export fixes the minimal example but breaks the line ***, apparently because width is then not defined in the arguments to includegraphics.



      I can think of several workarounds for this (pdftk burst the original pdf beforehand, etc.) but does anyone know what's going on here, and whether one of the packages can be patched?










      share|improve this question















      I'd like to include some pages from a separate PDF with the right half trimmed off, but I don't know in advance the exact size of the pages. I tried a solution, using pdfpages to include from the PDF and adjustbox with the Export option to replace includegraphics and let me use the width macro.



      However, as soon as adjustbox is included, includepdf becomes unable to include anything other than the first page! Here is a minimal example (with my 'real intention' included as a comment):



      documentclass{article}

      % Fails with Export option, works without!
      % The export option solves the minimal example but breaks line marked ***
      usepackage[Export]{adjustbox}
      usepackage{pdfpages}

      begin{document}

      includepdf[pages=1]{lipsum.pdf}
      includepdf[pages=2]{lipsum.pdf}

      %% The commented line is more like what I want to do, but things fail
      %% even without the trim/clip!
      % includepdf[fitpaper,pages=1,trim={0 0 {.5width} 0},clip]{lipsum.pdf} % ***

      end{document}


      The example ought to just include pages 1 and 2 of `lipsum.pdf', but instead it just includes page 1 twice!



      Replacing Export with export fixes the minimal example but breaks the line ***, apparently because width is then not defined in the arguments to includegraphics.



      I can think of several workarounds for this (pdftk burst the original pdf beforehand, etc.) but does anyone know what's going on here, and whether one of the packages can be patched?







      graphics pdfpages adjustbox page






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 34 mins ago









      Martin Scharrer

      198k45632814




      198k45632814










      asked Aug 8 '14 at 19:39









      Alex Watson

      234




      234






















          2 Answers
          2






          active

          oldest

          votes


















          2














          Note the use of the undocumented feature of includegraphics.



          documentclass{article}
          usepackage{pdfpages}
          newlength{tempwidth}
          begin{document}
          settowidth{tempwidth}{includegraphics[page=1]{lipsum.pdf}}
          includepdf[fitpaper,pages=1,trim={0 0 {.5tempwidth} 0},clip]{lipsum.pdf} % ***
          end{document}


          full page






          share|improve this answer





















          • This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
            – Alex Watson
            Aug 27 '14 at 20:52



















          0














          The page key was unfortunately not supported by adjustbox till v1.1 from 2018/04/08. If you update to this version or a later one your code should start working.



          Also trim={0 0 {.5width} 0},clip can be shorten to Clip={0 0 {.5width} 0} (note the uppercase 'C') if adjustbox is used with export or Export option.






          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%2f195521%2fadjustbox-with-export-option-seems-to-break-page-selection-in-pdfpages%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Note the use of the undocumented feature of includegraphics.



            documentclass{article}
            usepackage{pdfpages}
            newlength{tempwidth}
            begin{document}
            settowidth{tempwidth}{includegraphics[page=1]{lipsum.pdf}}
            includepdf[fitpaper,pages=1,trim={0 0 {.5tempwidth} 0},clip]{lipsum.pdf} % ***
            end{document}


            full page






            share|improve this answer





















            • This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
              – Alex Watson
              Aug 27 '14 at 20:52
















            2














            Note the use of the undocumented feature of includegraphics.



            documentclass{article}
            usepackage{pdfpages}
            newlength{tempwidth}
            begin{document}
            settowidth{tempwidth}{includegraphics[page=1]{lipsum.pdf}}
            includepdf[fitpaper,pages=1,trim={0 0 {.5tempwidth} 0},clip]{lipsum.pdf} % ***
            end{document}


            full page






            share|improve this answer





















            • This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
              – Alex Watson
              Aug 27 '14 at 20:52














            2












            2








            2






            Note the use of the undocumented feature of includegraphics.



            documentclass{article}
            usepackage{pdfpages}
            newlength{tempwidth}
            begin{document}
            settowidth{tempwidth}{includegraphics[page=1]{lipsum.pdf}}
            includepdf[fitpaper,pages=1,trim={0 0 {.5tempwidth} 0},clip]{lipsum.pdf} % ***
            end{document}


            full page






            share|improve this answer












            Note the use of the undocumented feature of includegraphics.



            documentclass{article}
            usepackage{pdfpages}
            newlength{tempwidth}
            begin{document}
            settowidth{tempwidth}{includegraphics[page=1]{lipsum.pdf}}
            includepdf[fitpaper,pages=1,trim={0 0 {.5tempwidth} 0},clip]{lipsum.pdf} % ***
            end{document}


            full page







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 10 '14 at 17:00









            John Kormylo

            43.5k12567




            43.5k12567












            • This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
              – Alex Watson
              Aug 27 '14 at 20:52


















            • This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
              – Alex Watson
              Aug 27 '14 at 20:52
















            This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
            – Alex Watson
            Aug 27 '14 at 20:52




            This is a great solution to my actual problem, thank you! I still don't understand what happens to the pages option - presumably adjustbox fails to pass it down to the base includegraphics? But the package uses a lot of key code that I don't understand.
            – Alex Watson
            Aug 27 '14 at 20:52











            0














            The page key was unfortunately not supported by adjustbox till v1.1 from 2018/04/08. If you update to this version or a later one your code should start working.



            Also trim={0 0 {.5width} 0},clip can be shorten to Clip={0 0 {.5width} 0} (note the uppercase 'C') if adjustbox is used with export or Export option.






            share|improve this answer


























              0














              The page key was unfortunately not supported by adjustbox till v1.1 from 2018/04/08. If you update to this version or a later one your code should start working.



              Also trim={0 0 {.5width} 0},clip can be shorten to Clip={0 0 {.5width} 0} (note the uppercase 'C') if adjustbox is used with export or Export option.






              share|improve this answer
























                0












                0








                0






                The page key was unfortunately not supported by adjustbox till v1.1 from 2018/04/08. If you update to this version or a later one your code should start working.



                Also trim={0 0 {.5width} 0},clip can be shorten to Clip={0 0 {.5width} 0} (note the uppercase 'C') if adjustbox is used with export or Export option.






                share|improve this answer












                The page key was unfortunately not supported by adjustbox till v1.1 from 2018/04/08. If you update to this version or a later one your code should start working.



                Also trim={0 0 {.5width} 0},clip can be shorten to Clip={0 0 {.5width} 0} (note the uppercase 'C') if adjustbox is used with export or Export option.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 31 mins ago









                Martin Scharrer

                198k45632814




                198k45632814






























                    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%2f195521%2fadjustbox-with-export-option-seems-to-break-page-selection-in-pdfpages%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

                    サソリ

                    広島県道265号伴広島線

                    Setup Asymptote in Texstudio