2

I have been working in a document where I need to load the layout package in the preamble and then my document also includes several figures with sub figures in each. The sub figures are identified by (a), (b), etc tags that I put with \put(x,y){(i)} command. So far so good, but I just realized that whenever I don't load layout package the position of the tag changes. Why is this and is there a way to fix this without manually change the coordinates options of each \put(x,y)(i)?

here mere examples of what happens:

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{layout}
\begin{document}
\author{}
\layout
Inserting a Figure with subplots

\begin{figure}[htbp]
    \begin{center}
        \includegraphics[width=0.5\textwidth]{figa.pdf}\put(-30,160){(a)}
        \includegraphics[width=0.5\textwidth]{figb.pdf}\put(-30,160){(b)}
        \caption{Caption.}
        \label{default}
    \end{center}
\end{figure}

\end{document}

and its result enter image description here

and with no layout package

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\usepackage{lmodern}
\usepackage{graphicx}    
\begin{document}
\author{}

Inserting a Figure with subplots

\begin{figure}[htbp]
    \begin{center}
        \includegraphics[width=0.5\textwidth]{figa.pdf}\put(-30,160){(a)}
        \includegraphics[width=0.5\textwidth]{figb.pdf}\put(-30,160){(b)}
        \caption{Caption.}
        \label{default}
    \end{center}
\end{figure}

\end{document}

enter image description here

  • May I ask why this question is tagged tikz-pgf and why you are loading tikz and various packages? With tikz you can certainly put the labels where you want them. Is that what you're going for? – user121799 Nov 7 '18 at 2:20
1

You seem to be loading tikz anyway. If you compile

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning}
%\usepackage{layout}
\begin{document}
\author{}
%\layout
Inserting a Figure with subplots

\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\node[label=above
right:(a)](a){\includegraphics[width=0.45\textwidth]{example-image-a.pdf}};
\node[right=3mm of a,label=above
right:(b)](b){\includegraphics[width=0.45\textwidth]{example-image-b.pdf}};
\end{tikzpicture}
\caption{Caption.}
\label{default}
\end{figure}

\end{document}

you will get

enter image description here

regardless of whether or not you activate layout.

  • I was trying to avoid a complex tikz syntax since \put is more elegant, but end up using your idea + a macros to avoid write it every time a new figure is used. – Jared Lo Nov 8 '18 at 21:58

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.