1

The following code in the master document preamble (book class) is used to scale graphics that are larger than the line width down to the line width, but leaving smaller ones alone. Currently I am using the standard graphics package, as I have not explicitly added another one.

setkeys{Gin}{width=\ifdim\Gin@nat@width>\linewidth
   \linewidth
\else
   Gin@nat@width
\fi}

This works fine with most cases, but not in a table with graphics in some cells. These are scaled manually to get the size right in the pdf output, but the automatic scaling then makes them too small.

This table is in a child document of type input. I would like to disable the auto-scale either by inline code markup just for a few lines, or for the whole child document.

1
  • I looked at that, and I think that is what gave me the idea to change the width instead of the scale factor in my answer below. I ended up that way as it seems easier and faster to make the change in the LyX user interface rather than 'going under the hood' for each instance. – Zono Jun 12 '19 at 22:17
0

I originally scaled the graphics in the table using the 'Scale graphics' field. This was overridden by the 'setkeys{Gin}' code. When I changed that field back to 'automatically', and manually set the width instead, I was able to scale everything in the table as desired.

A more general solution would be to add an additional 'if' to the beginning of the code, to only do the setkeys part if the scaling was not manually set:

if scale not manually set (pseudocode),
then setkeys{Gin}{width=\ifdim\Gin@nat@width>\linewidth
   \linewidth
\else
   Gin@nat@width
\fi}

I could not find anything on how to do this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.