LaTeX forum ⇒ Graphics, Figures & TablesFigures Side by Side extended into Margin

Information and discussion about graphics, figures & tables in LaTeX documents.
abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Figures Side by Side extended into Margin

Postby abclatex » Fri Dec 07, 2012 6:54 pm

Hi guys,

I have some problems of figures side by side.

  1. How to place figures like the "image1"? If someone could tell me how to manage them like "image2" (one figure occupies the body and has the same width as that of the body, while another occupies the margin and has the same width to that of the margin.), it could be perfect.

  2. How to place the figure caption directly under the figure? You can say the caption 2 of image 1 or 3 is at the wrong place.

Image 1
image 1.JPG
image 1.JPG (24.09 KiB) Viewed 2192 times


Image 2 (the ideal mode)
image 2.JPG
image 2.JPG (23.57 KiB) Viewed 2192 times


Image 3 (corresponding to the code)
image 3.JPG
image 3.JPG (30.9 KiB) Viewed 2192 times


Code:
  1. \documentclass[10pt,a4paper]{book}
  2.  
  3. % page layout
  4. \usepackage[%
  5. left=2cm,
  6. right=7cm,
  7. top=2cm,
  8. bottom=2cm,
  9. textheight=25cm,
  10. textwidth=11cm,
  11. marginparsep=1cm,
  12. marginparwidth=5cm
  13. ]{geometry}
  14.  
  15. % Language settings
  16. \usepackage[german,french]{babel}
  17.  
  18. % font and other typographic settings:
  19. \usepackage{fontspec}
  20. \setmainfont[Ligatures=TeX]{Calibri-Light}
  21. \usepackage{ragged2e}
  22. \usepackage{ctex}
  23. \usepackage{array,color}
  24.  
  25. % figures and the like:
  26. \usepackage{graphicx}
  27. \graphicspath{{fig/}}
  28. \usepackage{caption}
  29. \captionsetup[figure]{name={Figure.}}
  30. \captionsetup{font={scriptsize,singlespacing},justification=RaggedRight,skip=2pt}
  31. \usepackage{ifoddpage}
  32. %or: \usepackage[strict]{changepage}
  33. \usepackage{blindtext}
  34.  
  35. \begin{document}
  36. \begin{figure}[t]
  37. %\setcapwidth{0.6\textwidth}
  38. \checkoddpage
  39. \edef\side{\ifoddpage l\else r\fi}%
  40. \makebox[\textwidth][\side]{%
  41. \begin{minipage}[t]{0.59\textwidth}
  42. \includegraphics[width=14cm]{1.1.jpg}
  43. \caption{Caption 1}
  44. \end{minipage}%
  45. \hspace{1cm}%
  46. \begin{minipage}[t]{0.59\textwidth}
  47. \raggedleft
  48. \includegraphics[width=3cm]{1.2.jpg}
  49. \caption{Caption 2}
  50. \label{fig:free-lunch}
  51. \end{minipage}%
  52. }%
  53. \end{figure}
  54.  
  55. Today, four necktie knots are in widespread use. They are the four-in-hand knot, the half-Windsor knot, the Windsor knot and the Pratt knot. The first three are classic necktie knots that have been used for a long time. The Pratt knot is a more recent necktie knot that was introduced to the public in 1989.
  56.  
  57. Below shows a comparison table of the four necktie knots, together with the bow tie. It helps you find the answer to the first question that may come up in your mind -- Which necktie knots do I need? Click the links on the left to see the instructions on tying a certain knot.
  58.  
  59. \end{document}


Thanks a lot!

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Fri Dec 07, 2012 7:55 pm

Is this a one-time occasion where you need a text figure and a margin figure side by side or will you figures always come in pairs? Should the figures be able to float like standard figures or should they be fixed?

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Postby abclatex » Fri Dec 07, 2012 8:13 pm

cgnieder wrote:Is this a one-time occasion where you need a text figure and a margin figure side by side or will you figures always come in pairs? Should the figures be able to float like standard figures or should they be fixed?

Regards


Thanks for your reply, Cgnieder.

It' not one-time stuff. I need to place two or three figures side by side many times but not in every case. It's better to adopt float figures, I guess, since the paper has not done yet.

If I move the page layout codes, the overlapping would disppear. However I have to keep these layout codes.
  1. \usepackage[%
  2. left=2cm,
  3. right=7cm,
  4. top=2cm,
  5. bottom=2cm,
  6. textheight=25cm,
  7. textwidth=11cm,
  8. marginparsep=1cm,
  9. marginparwidth=5cm
  10. ]{geometry}

abclatex
Posts: 17
Joined: Wed Nov 28, 2012 10:09 pm

Postby abclatex » Wed Dec 12, 2012 12:35 am

Still unsolved...

aa3025
Posts: 1
Joined: Fri Aug 09, 2019 7:25 pm

Postby aa3025 » Fri Aug 09, 2019 7:44 pm

% if after 7 years someone is still interested in a possible solution using marginnote package:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[11pt,a4paper]{article}
  2. \usepackage{graphicx,marginnote,ragged2e}
  3. \usepackage[%
  4. left=2cm,
  5. right=7cm,
  6. top=2cm,
  7. bottom=2cm,
  8. textheight=25cm,
  9. textwidth=11cm,
  10. marginparsep=1cm,
  11. marginparwidth=5cm
  12. ]{geometry}
  13. \usepackage{blindtext}
  14. \begin{document}\normalsize
  15. \vfill
  16. \includegraphics[width=0.99\linewidth]{figs/A2_exp}
  17. \begin{center}
  18. Fig.111
  19. \end{center}
  20. \marginnote{
  21. \vspace{-60mm} % this require some tweaking to adjust vertical position is the same
  22. \includegraphics[width=0.99\linewidth]{figs/A2_exp}
  23. \begin{center}
  24. Fig.222
  25. \end{center}
  26. }
  27. \justify
  28. \blindtext
  29. \end{document}

figure_in_margins.png
figure_in_margins.png (100.62 KiB) Viewed 373 times

User avatar
Ijon Tichy
Posts: 143
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Sat Aug 10, 2019 7:31 am

Nice, but marginnote is unmaintained. And manual figure numbers are not optimal.

One more suggestion using the KOMA-Script feature package scrextend to provide addmargin* and \ifthispagewasodd also for the standard class book. Users of a KOMA-Script class do not need to load the package.
Code: [Select all] [Expand/Collapse] [Download] (komascript-example.tex)
  1. \documentclass[10pt,a4paper]{book}
  2. % If you'd use \documentclass[10pt]{scrbook} you would not need \usepackage{scrextend} later
  3.  
  4. % page layout
  5. \usepackage[%
  6. left=2cm,
  7. right=7cm,
  8. top=2cm,
  9. bottom=2cm,
  10. %textheight=25cm, results from page size and left/right
  11. %textwidth=11cm, results from page size and top/bottom
  12. marginparsep=1cm,
  13. marginparwidth=5cm
  14. ]{geometry}
  15.  
  16. % Language settings
  17. \usepackage[ngerman,french]{babel}
  18.  
  19. % font and other typographic settings:
  20. \usepackage{fontspec}
  21. %\setmainfont[Ligatures=TeX]{Calibri-Light}% unknown font
  22. \usepackage{ragged2e}
  23. \usepackage{ctex}
  24. \usepackage{array,color}
  25.  
  26. % figures and the like:
  27. \usepackage{graphicx}
  28. \graphicspath{{fig/}}
  29. \usepackage{caption}
  30. \captionsetup[figure]{name={Figure.}}
  31. \captionsetup{font={scriptsize,singlespacing},justification=RaggedRight,skip=2pt}
  32. \usepackage{scrextend}
  33. %or: \usepackage[strict]{changepage}
  34. \usepackage{mwe}
  35.  
  36. \begin{document}
  37. % If the figures should be numbered from left to right:
  38. \begin{figure}
  39. \begin{addmargin*}[0pt]{-\dimexpr \marginparwidth+\marginparsep\relax}
  40. \ifthispagewasodd
  41. \begin{minipage}[t]{\textwidth}
  42. \includegraphics[width=\textwidth]{example-image-a}
  43. \caption{Caption 1}
  44. \end{minipage}%
  45. \hspace{\marginparsep}%
  46. \begin{minipage}[t]{\marginparwidth}
  47. \includegraphics[width=\marginparwidth]{example-image-b}
  48. \caption{Caption 2}
  49. \label{fig:free-lunch}
  50. \end{minipage}%
  51. \else
  52. \begin{minipage}[t]{\marginparwidth}
  53. \includegraphics[width=\marginparwidth]{example-image-b}
  54. \caption{Caption 2}
  55. \label{fig:free-lunch}
  56. \end{minipage}%
  57. \hspace{\marginparsep}%
  58. \begin{minipage}[t]{\textwidth}
  59. \includegraphics[width=\textwidth]{example-image-a}
  60. \caption{Caption 1}
  61. \end{minipage}%
  62. \fi
  63. \end{addmargin*}
  64. \end{figure}
  65.  
  66. \Blindtext[3]
  67.  
  68. % If the figure in the margin should always have the higher number:
  69. \begin{figure}
  70. \begin{addmargin*}[0pt]{-\dimexpr \marginparwidth+\marginparsep\relax}
  71. \ifthispagewasodd\else\hspace*{\dimexpr\marginparwidth+\marginparsep\relax}\fi
  72. \begin{minipage}[t]{\textwidth}
  73. \includegraphics[width=\textwidth]{example-image-a}
  74. \caption{Caption 1}
  75. \end{minipage}%
  76. \ifthispagewasodd\hspace{\marginparsep}\else\hspace*{-\linewidth}\fi
  77. \begin{minipage}[t]{\marginparwidth}
  78. \includegraphics[width=\marginparwidth]{example-image-b}
  79. \caption{Caption 2}
  80. \label{fig:free-lunch-b}
  81. \end{minipage}%
  82. \end{addmargin*}
  83. \end{figure}
  84.  
  85. \end{document}


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 7 guests