New Answer
Instead of redefining \includegraphics one could use etoolbox and \patchcmd. This might be a cleaner solution.
\documentclass[]{article}
\usepackage[]{graphicx}
\usepackage[export]{adjustbox}
\usepackage{etoolbox}
\expandafter\patchcmd\csname Gin@ii\endcsname
{\setkeys {Gin}{#1}}
{%
\setkeys {Gin}
{max width=\textwidth,max height=.5\textwidth,keepaspectratio,#1}%
}
{}{}
\begin{document}
\includegraphics{./chapterinsection.pdf}
\end{document}
Original Answer
An ugly solution, redefining \includegraphics to include those two keys by default:
\documentclass[]{article}
\usepackage[]{graphicx}
\usepackage[export]{adjustbox}
\usepackage{letltxmacro}
\LetLtxMacro\includegraphicsBAK\includegraphics
\usepackage{xparse}
\newcommand\MyStarProcessor[1]
{%
\IfBooleanTF{#1}
{\def\ProcessedArgument{*}}
{\def\ProcessedArgument{}}%
}
\RenewDocumentCommand \includegraphics { >{\MyStarProcessor}s O{} o m }
{%
\IfNoValueTF{#3}
{%
\includegraphicsBAK#1
[%
max width=\textwidth,
max height=.5\textheight,
keepaspectratio,
#2
]
{#4}%
}
{%
\includegraphicsBAK#1[#2][#3]{#4}%
}
}
\begin{document}
\includegraphics{./chapterinsection.pdf}
\end{document}
Ginkeys consider onlygraphicxoptions, for examplewidth=...orheight=...etc. – Zarko Jul 09 '18 at 15:52export, the\adjbox@famis set toGin, so the keys provided byadjustboxare in theGinkey family (else you'd get an error because those keys wouldn't be defined). – Skillmon Jul 09 '18 at 16:09Ginconsideradjustboxoption. i'm glad to hear, that i'm wrong. – Zarko Jul 09 '18 at 16:19adjustboxoptions outside of\includegraphicsdoesn't seem to work. – Skillmon Jul 10 '18 at 09:54\newcommand\myimage[2][]{\includegraphics[max width=\textwidth,max height=0.5\textheight,keepaspectratio,#1]{#2}}and then use\myimage{imagefilename}or\myimage[extra options]{imagefilename}instead in your document. – Martin Scharrer Dec 27 '18 at 10:32