I am using LaTex (pdflatex) to write my thesis. I am using a two-sides book documentclass.
I want to create a layout with a big outermargin where to write the captions of figures, tables and equations.
I found that the sidecap package works perfectly for figures and tables with these settings:
usepackage[margincaption,outercaption,ragged,wide]{sidecap}
sidecaptionvpos{figure}{t}
sidecaptionvpos{table}{t}
% Custom commands for captions
captionsetup[SCfigure]{
format=plain,
font=footnotesize,
labelfont=bf,
}
captionsetup[SCtable]{
format=plain,
font=footnotesize,
labelfont=bf,
}
At the same time I used the eqfloat declaration to be able to write the caption for equations:
usepackage{aliascnt}
newaliascnt{eqfloat}{equation}
newfloat{eqfloat}{h}{eqflts}
floatname{eqfloat}{Equation}
newcommand*{ORGeqfloat}{}
letORGeqfloateqfloat
defeqfloat{%
letORIGINALcaptioncaption
defcaption{%
addtocounter{equation}{-1}%
ORIGINALcaption
}%
ORGeqfloat
}
captionsetup[eqfloat]{
format=plain, % Plain format
font=footnotesize, % Footnotesize font size
labelfont=bf, % Bold label (title)
}
This is the appearance of the pdf now, I would like to also have the equation’s caption on the side
Here an example code to test it:
documentclass[a4paper, twoside]{book}
usepackage{titlesec} % Customize section titles
usepackage[T1]{fontenc} % Ensure correct font encoding
usepackage[english]{babel} % English rules handling
usepackage[utf8]{inputenc} % UTF-8 input encoding
usepackage{graphicx} % include figures
usepackage{tabularx} % Creates adjustable-width columns tables
usepackage{lipsum} % Lorem ipsum text for testing
usepackage{booktabs} % New rules for table formatting
usepackage{caption} % Customizes captions for figures and tables
usepackage{float}
usepackage{aliascnt}
% Set up page layout with wider outer
usepackage{geometry}
geometry{
inner=2.5cm,
outer=5cm,
top=3cm,
bottom=3cm,
marginparsep=0.5cm,
marginparwidth=4cm,
}
usepackage[margincaption,outercaption,ragged,wide]{sidecap}
sidecaptionvpos{figure}{b}
sidecaptionvpos{table}{b}
% Custom commands for captions
captionsetup[SCfigure]{
format=plain,
font=footnotesize,
labelfont=bf,
}
captionsetup[SCtable]{
format=plain,
font=footnotesize,
labelfont=bf,
}
newaliascnt{eqfloat}{equation}
newfloat{eqfloat}{h}{eqflts}
floatname{eqfloat}{Equation}
newcommand*{ORGeqfloat}{}
letORGeqfloateqfloat
defeqfloat{%
letORIGINALcaptioncaption
defcaption{%
addtocounter{equation}{-1}%
ORIGINALcaption
}%
ORGeqfloat
}
captionsetup[eqfloat]{
format=plain, % Plain format
font=footnotesize, % Footnotesize font size
labelfont=bf, % Bold label (title)
}
begin{document}
lipsum[1]
begin{SCtable}[h]
centering
begin{tabular}{ll}
toprule
Name & Age \
midrule
Alice & 25 \
Bob & 30 \
bottomrule
end{tabular}
caption{A sample table}
end{SCtable}
lipsum[2]
begin{eqfloat}
caption{The famous equation by Einstein}
begin{equation}
E = mc^2
end{equation}
end{eqfloat}
lipsum[4]
begin{SCfigure}[h]
includegraphics[width=5cm]{example-image}
caption{Caption for your figure}
end{SCfigure}
lipsum[3]
end{document}
I tried to redeclare the caption for the eqfloat in the text by using the marginnote package, but something fails.
I also tried to use the minipage package, but I have not clear how to properly use it with the eqfloat environment.
Anyone can help me?
I need any solution that do not require to specifically change everything when i want to comment an equation, since there will be many!
Thanks in advance!
Nicholas Tovazzi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.