## When I specify an image width of 50% and convert to LaTeX, pandoc sets the height to textheight and the aspect ratio isn't preserved. How can I prevent this?
For example, if you convert an image with `{width="50%"}`, the LaTeX produced
will be `\includegraphics[width=0.5\textwidth,height=\textheight]`.
This output presupposes the following code in pandoc's default latex
template:
```
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
If you don't have this in your custom template, you should
add it. If we didn't set the `height` explicitly in this way,
the image would not be resized correctly unless it was
being resized to smaller than its original size.
## Pandoc sometimes uses too much memory. How can I limit the memory used by pandoc?
`pandoc +RTS -M30m -RTS` will limit heap memory to 30MB.
When converting a document requires more than this, an out of
memory error will be issued.
## When using `--include-in-header` with PDF or LaTeX output, how do I reference tex declarations coming after `$header-includes$` in the default template?
For various reasons, the `$header-includes$` are not at the very
end of the LaTeX preamble. This poses a problem when the code
you are inserting depends on declarations in the preamble coming
after the `$header-includes$` location. For example, you might
want to reference the `\author` and `\title` metadata values
(set at the very bottom of the preamble) and present them in
margins. In that case you can wrap your code in `etoolbox`'s
`\AtEndPreamble`. The technique is demonstrated in [this