I'm working on my masters thesis and so I have a bunch of tikz files that I want to include in the thesis. This I do by using adjustbox to limit the size to \textwidth
as such
\adjustbox{max width=\textwidth,bgcolor=blue}{\input{test.tikz}}
.
Now my problem is that I have created external files containing common draw commands in order to creating multiple UML like diagrams and memory diagrams easier… this however, for some reason, adds padding to the including picture! Why, and what can I do to avoid it?
Example:
The test file "test.ext" used in the example only contains 100×5 '%'s so nothing really should be included in the final image?
Code:
\adjustbox{max width=\textwidth,bgcolor=blue}{
\input{test.ext} <-- this causes the problem
\begin{tikzpicture}[]
\draw[fill=blue!20] (0,0) rectangle (3,1);
\end{tikzpicture}
}
Result:
.
Best Answer
The linebreak after
\input
gives the extra space, which can be removed by adding a%
at the end of that line. Similarly, you can add%
after\adjustbox{
and\end{tikzpicture}
to remove the remaining space.As commented by Martin, the
adjustbox
environment ignores spaces at its beginning and end, so the following will give the same result as the second\adjustbox
in the above example.For reference, a few questions related to end-of-line
%
s: