adjustbox and includegraphics page selection
I want to use yhe adjustbox
package to include graphics in beamer
presentations. I prefer it over graphicx
because it has max size
option which only scales the figure when its size is larger than a certain size.
But I've found a problem when I need to select a page from a multipage figure (usually made with documentclass[tikz]{standalone}
). When using includegraphics
it's possible to use page=x
(defined in pdftex.def
) option to select which page to be included but this option is not available in adjustbox
. Therefore the best command I could do to include certain page from a multipage pdf file with fixed maximum size in beamer is:
newcommand{mygraphic}[2]{%
parcentering
adjustbox{max size={textwidth}{.9textheight}}%
{includegraphics[#1]{#2}}par}
where #1
is an optional parameter used to fix page selection when needed and #2
is the mandatory filename.
My questions are:
- Is it possible to avoid using
includegraphics
insideadjustbox
if I want to usepage=x
option? - Is it possible to fix
max size
with a generaladjustboxset
command? (I think it isn't withexport
class option but I'm not sure)
graphics adjustbox page
add a comment |
I want to use yhe adjustbox
package to include graphics in beamer
presentations. I prefer it over graphicx
because it has max size
option which only scales the figure when its size is larger than a certain size.
But I've found a problem when I need to select a page from a multipage figure (usually made with documentclass[tikz]{standalone}
). When using includegraphics
it's possible to use page=x
(defined in pdftex.def
) option to select which page to be included but this option is not available in adjustbox
. Therefore the best command I could do to include certain page from a multipage pdf file with fixed maximum size in beamer is:
newcommand{mygraphic}[2]{%
parcentering
adjustbox{max size={textwidth}{.9textheight}}%
{includegraphics[#1]{#2}}par}
where #1
is an optional parameter used to fix page selection when needed and #2
is the mandatory filename.
My questions are:
- Is it possible to avoid using
includegraphics
insideadjustbox
if I want to usepage=x
option? - Is it possible to fix
max size
with a generaladjustboxset
command? (I think it isn't withexport
class option but I'm not sure)
graphics adjustbox page
Ignasi, @UlrikeFischer:adjustbox
v1.1 2018/04/08 now passes thepage
key (and others) correctly. For images useadjustimage{key=value,...}{imagefilename}
.
– Martin Scharrer♦
Apr 9 at 7:14
add a comment |
I want to use yhe adjustbox
package to include graphics in beamer
presentations. I prefer it over graphicx
because it has max size
option which only scales the figure when its size is larger than a certain size.
But I've found a problem when I need to select a page from a multipage figure (usually made with documentclass[tikz]{standalone}
). When using includegraphics
it's possible to use page=x
(defined in pdftex.def
) option to select which page to be included but this option is not available in adjustbox
. Therefore the best command I could do to include certain page from a multipage pdf file with fixed maximum size in beamer is:
newcommand{mygraphic}[2]{%
parcentering
adjustbox{max size={textwidth}{.9textheight}}%
{includegraphics[#1]{#2}}par}
where #1
is an optional parameter used to fix page selection when needed and #2
is the mandatory filename.
My questions are:
- Is it possible to avoid using
includegraphics
insideadjustbox
if I want to usepage=x
option? - Is it possible to fix
max size
with a generaladjustboxset
command? (I think it isn't withexport
class option but I'm not sure)
graphics adjustbox page
I want to use yhe adjustbox
package to include graphics in beamer
presentations. I prefer it over graphicx
because it has max size
option which only scales the figure when its size is larger than a certain size.
But I've found a problem when I need to select a page from a multipage figure (usually made with documentclass[tikz]{standalone}
). When using includegraphics
it's possible to use page=x
(defined in pdftex.def
) option to select which page to be included but this option is not available in adjustbox
. Therefore the best command I could do to include certain page from a multipage pdf file with fixed maximum size in beamer is:
newcommand{mygraphic}[2]{%
parcentering
adjustbox{max size={textwidth}{.9textheight}}%
{includegraphics[#1]{#2}}par}
where #1
is an optional parameter used to fix page selection when needed and #2
is the mandatory filename.
My questions are:
- Is it possible to avoid using
includegraphics
insideadjustbox
if I want to usepage=x
option? - Is it possible to fix
max size
with a generaladjustboxset
command? (I think it isn't withexport
class option but I'm not sure)
graphics adjustbox page
graphics adjustbox page
edited 9 mins ago
Martin Scharrer♦
198k45632814
198k45632814
asked Apr 23 '14 at 9:53
Ignasi
91.5k4165303
91.5k4165303
Ignasi, @UlrikeFischer:adjustbox
v1.1 2018/04/08 now passes thepage
key (and others) correctly. For images useadjustimage{key=value,...}{imagefilename}
.
– Martin Scharrer♦
Apr 9 at 7:14
add a comment |
Ignasi, @UlrikeFischer:adjustbox
v1.1 2018/04/08 now passes thepage
key (and others) correctly. For images useadjustimage{key=value,...}{imagefilename}
.
– Martin Scharrer♦
Apr 9 at 7:14
Ignasi, @UlrikeFischer:
adjustbox
v1.1 2018/04/08 now passes the page
key (and others) correctly. For images use adjustimage{key=value,...}{imagefilename}
.– Martin Scharrer♦
Apr 9 at 7:14
Ignasi, @UlrikeFischer:
adjustbox
v1.1 2018/04/08 now passes the page
key (and others) correctly. For images use adjustimage{key=value,...}{imagefilename}
.– Martin Scharrer♦
Apr 9 at 7:14
add a comment |
3 Answers
3
active
oldest
votes
This works for me:
documentclass{article}
usepackage{graphicx}
usepackage[export]{adjustbox}
begin{document}
centering % just to avoid overfull box
includegraphics[page=2,max size={textwidth}{0.9textheight}]{l3fp}
end{document}
Thanks! Once you know the solution it's easier to find it in documentation, I've readexport
class option several times but with your example I've finally understood it.
– Ignasi
Apr 23 '14 at 14:35
add a comment |
After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox
(part 2 of your question) and sometimes also use page=…
(part 1).1 So I did this—note the use of capitalized Export
:
documentclass{article}
makeatletter
% Load graphicx first and save its original includegraphics
usepackage{graphicx}
letorig@includegraphicsincludegraphics
% Using the capitalized 'Export' option replaces includegraphics with
% adjincludegraphics
usepackage[Export]{adjustbox}
% Set some global adjustbox keys
adjustboxset{trim=0.5in 0in}
% Define a new three-argument command:
% includegraphicspage{adjbox args}{graphicx args}{filename}
newcommand{includegraphicspage}[3]{%
adjustbox{#1}{orig@includegraphics[#2]{#3}par}}
makeatother
This allows me to do all of the following and have my adjustboxset
options apply in every case:
begin{document}
% This is actually adjincludegraphics; 'page' won't work
includegraphics{singlepage.pdf}
% Pass an argument for graphicx
includegraphicspage{page=3}{multipage.pdf}
% Also pass arguments for adjustbox
includegraphicspage[width=textwidth]{page=3}{multipage.pdf}
end{document}
1 Why? Mainly because I already had a long document with many includegraphics
. It was easier to modify the few appearances of multi-page images.
add a comment |
The adjustbox
v1.1 from 2018/04/08 now correctly supports the page
key. Instead of using the export
option you can just use the macro adjustimage{<options>}{<filename>}
. Instead of using centering
just use the center
key at the end.
usepackage{adjustbox}[2018/04/08]
newcommand{mygraphic}[2]{%
parnoindent
adjustimage{#1,max size={textwidth}{.9textheight},center}{#2}%
par
}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f172996%2fadjustbox-and-includegraphics-page-selection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
This works for me:
documentclass{article}
usepackage{graphicx}
usepackage[export]{adjustbox}
begin{document}
centering % just to avoid overfull box
includegraphics[page=2,max size={textwidth}{0.9textheight}]{l3fp}
end{document}
Thanks! Once you know the solution it's easier to find it in documentation, I've readexport
class option several times but with your example I've finally understood it.
– Ignasi
Apr 23 '14 at 14:35
add a comment |
This works for me:
documentclass{article}
usepackage{graphicx}
usepackage[export]{adjustbox}
begin{document}
centering % just to avoid overfull box
includegraphics[page=2,max size={textwidth}{0.9textheight}]{l3fp}
end{document}
Thanks! Once you know the solution it's easier to find it in documentation, I've readexport
class option several times but with your example I've finally understood it.
– Ignasi
Apr 23 '14 at 14:35
add a comment |
This works for me:
documentclass{article}
usepackage{graphicx}
usepackage[export]{adjustbox}
begin{document}
centering % just to avoid overfull box
includegraphics[page=2,max size={textwidth}{0.9textheight}]{l3fp}
end{document}
This works for me:
documentclass{article}
usepackage{graphicx}
usepackage[export]{adjustbox}
begin{document}
centering % just to avoid overfull box
includegraphics[page=2,max size={textwidth}{0.9textheight}]{l3fp}
end{document}
answered Apr 23 '14 at 14:17
egreg
708k8618813163
708k8618813163
Thanks! Once you know the solution it's easier to find it in documentation, I've readexport
class option several times but with your example I've finally understood it.
– Ignasi
Apr 23 '14 at 14:35
add a comment |
Thanks! Once you know the solution it's easier to find it in documentation, I've readexport
class option several times but with your example I've finally understood it.
– Ignasi
Apr 23 '14 at 14:35
Thanks! Once you know the solution it's easier to find it in documentation, I've read
export
class option several times but with your example I've finally understood it.– Ignasi
Apr 23 '14 at 14:35
Thanks! Once you know the solution it's easier to find it in documentation, I've read
export
class option several times but with your example I've finally understood it.– Ignasi
Apr 23 '14 at 14:35
add a comment |
After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox
(part 2 of your question) and sometimes also use page=…
(part 1).1 So I did this—note the use of capitalized Export
:
documentclass{article}
makeatletter
% Load graphicx first and save its original includegraphics
usepackage{graphicx}
letorig@includegraphicsincludegraphics
% Using the capitalized 'Export' option replaces includegraphics with
% adjincludegraphics
usepackage[Export]{adjustbox}
% Set some global adjustbox keys
adjustboxset{trim=0.5in 0in}
% Define a new three-argument command:
% includegraphicspage{adjbox args}{graphicx args}{filename}
newcommand{includegraphicspage}[3]{%
adjustbox{#1}{orig@includegraphics[#2]{#3}par}}
makeatother
This allows me to do all of the following and have my adjustboxset
options apply in every case:
begin{document}
% This is actually adjincludegraphics; 'page' won't work
includegraphics{singlepage.pdf}
% Pass an argument for graphicx
includegraphicspage{page=3}{multipage.pdf}
% Also pass arguments for adjustbox
includegraphicspage[width=textwidth]{page=3}{multipage.pdf}
end{document}
1 Why? Mainly because I already had a long document with many includegraphics
. It was easier to modify the few appearances of multi-page images.
add a comment |
After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox
(part 2 of your question) and sometimes also use page=…
(part 1).1 So I did this—note the use of capitalized Export
:
documentclass{article}
makeatletter
% Load graphicx first and save its original includegraphics
usepackage{graphicx}
letorig@includegraphicsincludegraphics
% Using the capitalized 'Export' option replaces includegraphics with
% adjincludegraphics
usepackage[Export]{adjustbox}
% Set some global adjustbox keys
adjustboxset{trim=0.5in 0in}
% Define a new three-argument command:
% includegraphicspage{adjbox args}{graphicx args}{filename}
newcommand{includegraphicspage}[3]{%
adjustbox{#1}{orig@includegraphics[#2]{#3}par}}
makeatother
This allows me to do all of the following and have my adjustboxset
options apply in every case:
begin{document}
% This is actually adjincludegraphics; 'page' won't work
includegraphics{singlepage.pdf}
% Pass an argument for graphicx
includegraphicspage{page=3}{multipage.pdf}
% Also pass arguments for adjustbox
includegraphicspage[width=textwidth]{page=3}{multipage.pdf}
end{document}
1 Why? Mainly because I already had a long document with many includegraphics
. It was easier to modify the few appearances of multi-page images.
add a comment |
After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox
(part 2 of your question) and sometimes also use page=…
(part 1).1 So I did this—note the use of capitalized Export
:
documentclass{article}
makeatletter
% Load graphicx first and save its original includegraphics
usepackage{graphicx}
letorig@includegraphicsincludegraphics
% Using the capitalized 'Export' option replaces includegraphics with
% adjincludegraphics
usepackage[Export]{adjustbox}
% Set some global adjustbox keys
adjustboxset{trim=0.5in 0in}
% Define a new three-argument command:
% includegraphicspage{adjbox args}{graphicx args}{filename}
newcommand{includegraphicspage}[3]{%
adjustbox{#1}{orig@includegraphics[#2]{#3}par}}
makeatother
This allows me to do all of the following and have my adjustboxset
options apply in every case:
begin{document}
% This is actually adjincludegraphics; 'page' won't work
includegraphics{singlepage.pdf}
% Pass an argument for graphicx
includegraphicspage{page=3}{multipage.pdf}
% Also pass arguments for adjustbox
includegraphicspage[width=textwidth]{page=3}{multipage.pdf}
end{document}
1 Why? Mainly because I already had a long document with many includegraphics
. It was easier to modify the few appearances of multi-page images.
After bouncing back between this and this other question, I decided I wanted to both set global keys for adjustbox
(part 2 of your question) and sometimes also use page=…
(part 1).1 So I did this—note the use of capitalized Export
:
documentclass{article}
makeatletter
% Load graphicx first and save its original includegraphics
usepackage{graphicx}
letorig@includegraphicsincludegraphics
% Using the capitalized 'Export' option replaces includegraphics with
% adjincludegraphics
usepackage[Export]{adjustbox}
% Set some global adjustbox keys
adjustboxset{trim=0.5in 0in}
% Define a new three-argument command:
% includegraphicspage{adjbox args}{graphicx args}{filename}
newcommand{includegraphicspage}[3]{%
adjustbox{#1}{orig@includegraphics[#2]{#3}par}}
makeatother
This allows me to do all of the following and have my adjustboxset
options apply in every case:
begin{document}
% This is actually adjincludegraphics; 'page' won't work
includegraphics{singlepage.pdf}
% Pass an argument for graphicx
includegraphicspage{page=3}{multipage.pdf}
% Also pass arguments for adjustbox
includegraphicspage[width=textwidth]{page=3}{multipage.pdf}
end{document}
1 Why? Mainly because I already had a long document with many includegraphics
. It was easier to modify the few appearances of multi-page images.
edited Apr 5 at 3:55
Stefan Pinnow
19.4k83175
19.4k83175
answered Apr 5 at 0:07
khaeru
12
12
add a comment |
add a comment |
The adjustbox
v1.1 from 2018/04/08 now correctly supports the page
key. Instead of using the export
option you can just use the macro adjustimage{<options>}{<filename>}
. Instead of using centering
just use the center
key at the end.
usepackage{adjustbox}[2018/04/08]
newcommand{mygraphic}[2]{%
parnoindent
adjustimage{#1,max size={textwidth}{.9textheight},center}{#2}%
par
}
add a comment |
The adjustbox
v1.1 from 2018/04/08 now correctly supports the page
key. Instead of using the export
option you can just use the macro adjustimage{<options>}{<filename>}
. Instead of using centering
just use the center
key at the end.
usepackage{adjustbox}[2018/04/08]
newcommand{mygraphic}[2]{%
parnoindent
adjustimage{#1,max size={textwidth}{.9textheight},center}{#2}%
par
}
add a comment |
The adjustbox
v1.1 from 2018/04/08 now correctly supports the page
key. Instead of using the export
option you can just use the macro adjustimage{<options>}{<filename>}
. Instead of using centering
just use the center
key at the end.
usepackage{adjustbox}[2018/04/08]
newcommand{mygraphic}[2]{%
parnoindent
adjustimage{#1,max size={textwidth}{.9textheight},center}{#2}%
par
}
The adjustbox
v1.1 from 2018/04/08 now correctly supports the page
key. Instead of using the export
option you can just use the macro adjustimage{<options>}{<filename>}
. Instead of using centering
just use the center
key at the end.
usepackage{adjustbox}[2018/04/08]
newcommand{mygraphic}[2]{%
parnoindent
adjustimage{#1,max size={textwidth}{.9textheight},center}{#2}%
par
}
answered 10 mins ago
Martin Scharrer♦
198k45632814
198k45632814
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f172996%2fadjustbox-and-includegraphics-page-selection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Ignasi, @UlrikeFischer:
adjustbox
v1.1 2018/04/08 now passes thepage
key (and others) correctly. For images useadjustimage{key=value,...}{imagefilename}
.– Martin Scharrer♦
Apr 9 at 7:14