1

Here's my code -

\documentclass[12pt]{book}
\usepackage{mhchem}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm, bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}

\begin{document}
\marginpar{
\begin{figure}[H]
    \includegraphics[scale=0.65]{MainMatter/Organic chemistry/10.1: Fundamentals of Organic chemistry/Diagrams/Primary secondary tertiary halogenoalkanes 2.png}
    \caption{Primary, secondary, and tertiary halogenoalkanes}
    \label{Primary secondary tertiary halogenoalkanes}
\end{figure}}
Primary, secondary, and tertiary halogenoalkanes
Primary halogenoalkanes have one carbon atom attached to the $\ce{C}$ with the halogen atom. Secondary halogenoalkanes have two carbon atoms attached to the $\ce{C}$ with the halogen atom. Tertiary halogenoalkanes have two carbon atoms attached to the $\ce{C}$ with the halogen atom. Examples have been shown in figure \ref{Primary secondary tertiary halogenoalkanes} 
    \end{document}

I'm trying to fix this caption so it does not spill outside the margin notes box - enter image description here

Any ideas?

2
  • Are you sure that you want such contents in the margin par?
    – Sigur
    Commented Sep 19, 2022 at 18:47
  • Even an [H] figure still uses \textwidth or \columnwidth, not \marginparwidth or \hsize. Commented Sep 20, 2022 at 2:29

1 Answer 1

1
\documentclass[12pt]{book}
\usepackage{mhchem}
\usepackage{amsmath,amssymb}
\usepackage{physics}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm, bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}

\begin{document}
    \marginpar{%
            \includegraphics[width=0.7\linewidth]{tiger}
            \captionof{figure}{Primary, secondary, and tertiary halogenoalkanes}
            \label{Primary secondary tertiary halogenoalkanes}}
    Primary, secondary, and tertiary halogenoalkanes
    Primary halogenoalkanes have one carbon atom attached to the $\ce{C}$ with the halogen atom. Secondary halogenoalkanes have two carbon atoms attached to the $\ce{C}$ with the halogen atom. Tertiary halogenoalkanes have two carbon atoms attached to the $\ce{C}$ with the halogen atom. Examples have been shown in figure \ref{Primary secondary tertiary halogenoalkanes} 
\end{document}

enter image description here

You must log in to answer this question.

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