3

I want to create a figure with a magnified subfigure. I know this can be done with tikz (link) however I want to do it without tikz. Can this be done?

Example: enter image description here

My early attempt:

\documentclass{article}

\usepackage{subfig,graphicx}

\begin{document}

\begin{figure}
    \subfloat[]{\includegraphics[width=0.6\textwidth]{example-image-a}}
    \hspace*{0.5em}
    \subfloat[]{\includegraphics[trim=5cm 0cm 5cm 5cm, clip=true, width=0.2\textwidth]{example-image-a}}
\end{figure}

\end{document}
7
  • 5
    without TikZ you would be doing exactly the same boxing/unboxing or clipping as TikZ does only without TikZ.
    – percusse
    Feb 23, 2016 at 12:43
  • @percusse Can you provide an example?
    – Mowing Bar
    Feb 23, 2016 at 14:31
  • 1
    You have the the example in the link no?
    – percusse
    Feb 23, 2016 at 15:03
  • What tag can be put? {no-tikz-pgf}? ;-) Note: I removed the {tikz-pgf} tag... Feb 23, 2016 at 16:05
  • 1
    I'm somewhat curious as to why you don't want to use TikZ. Is this a puzzle (i.e. you have a good idea how to do it in TikZ)? Is it because you want to submit your source in some circumstance where TikZ is not allowed? Do you want to avoid learning TikZ? Would some other package like pstricks be acceptable? If you can't use TikZ for compatibility reasons, you could use the standalone package to create an image that already contains the magnification. Also, the example in the linked question would be easy with \includegraphics and basic TeX commands. The dashed diagonal lines are harder.
    – wrtlprnft
    Mar 24, 2016 at 17:19

1 Answer 1

2

If you don't apply height or width, you can use scale combined with trim and clip.

\documentclass{article}

\usepackage{subfig,graphicx}

\begin{document}

\begin{figure}
    \subfloat[]{\includegraphics[width=0.6\textwidth]{example-image-a}}
    \hspace*{0.5em}
    \subfloat[]{\includegraphics[scale=3,trim=6cm 5cm 6cm 5cm, clip=true,]{example-image-a}}
\end{figure}

\end{document}

enter image description here

1
  • You could use pict2e to draw the lines and rectangles, then overlay all three images. Feb 23, 2016 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .