Graphics, Figures & Tables ⇒ Getting Extra \fi error for using subcaption package
-
gmbokoma_94
- Posts: 4
- Joined: Tue Oct 28, 2025 9:30 am
Getting Extra \fi error for using subcaption package
Kindly, assist with !Extra \fi error for subcaption package. The package is working perfectly for other projects but not working for this specific one. This error is rising from having \subcaptionbox inside the figure enviroment.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10387
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Getting Extra \fi error for using subcaption package
welcome to the forum!
There may be an error in your code. Perhaps post your code here as a small, reduced copy (complete with relevant preamble like \documentclass, etc.). That code should bring the error when we test it.
Once we can test the code and see the error, we can fix it most of the time. Without code, a hint is rarely possible.
Stefan
- Stefan Kottwitz
- Site Admin
- Posts: 10387
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Getting Extra \fi error for using subcaption package
Code: Select all
\documentclass{article}
\usepackage{subcaption,lipsum}
\begin{document}
\section*{Demo of subcaption with subcaptionbox}
\lipsum[1]
\begin{figure}[htbp!]
\centering
\subcaptionbox{First dummy image}[.45\linewidth]{%
\fbox{\rule{0pt}{3cm}\rule{5cm}{0pt}}%
}\hfill
\subcaptionbox{Second dummy image (longer caption
to show wrapping)}[.45\linewidth]{%
\fbox{\rule{0pt}{3cm}\rule{5cm}{0pt}}%
}
\caption{Two subfigures created with subcaptionbox}
\label{fig:main-fig}
\end{figure}
\lipsum[2]
\end{document}-
gmbokoma_94
- Posts: 4
- Joined: Tue Oct 28, 2025 9:30 am
Re: Getting Extra \fi error for using subcaption package
Thank you so much.
Kindly, see attached the attached file. I literally just cut the parts that is giving problem.
- Attachments
-
- Test.zip
- (885.83 KiB) Downloaded 1815 times
- Stefan Kottwitz
- Site Admin
- Posts: 10387
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Getting Extra \fi error for using subcaption package
Code: Select all
\caption{ Numerical, exact solution and absolute error at $T = 5$, with $\Delta t = 0.1$, $\Delta x = 0.12 $ for %Eq.~(\ref{eq-27}).}Eq.~(\ref{eq-27}).} is commented out by that percent sign, so the closing brace is missing. Remove that % symbol.Also, I think better move
Code: Select all
\usepackage{BSPMsample}Stefan
-
gmbokoma_94
- Posts: 4
- Joined: Tue Oct 28, 2025 9:30 am
Re: Getting Extra \fi error for using subcaption package
The \usepackage{BSPMsample} is a special package for journal submission that I am trying to submit my article too. I can not by pass it. Maybe their package does not support \subcaptionbox, otherwise everything else is good.
- Stefan Kottwitz
- Site Admin
- Posts: 10387
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Getting Extra \fi error for using subcaption package
Stefan
-
gmbokoma_94
- Posts: 4
- Joined: Tue Oct 28, 2025 9:30 am
Re: Getting Extra \fi error for using subcaption package
Thank you very much. I have tried re-positioning \usepackage{BSPMsample} but I am still getting the same error. I will probably try to avoid subcaption at all cost. Or is there anyway I can do it?
- Stefan Kottwitz
- Site Admin
- Posts: 10387
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Getting Extra \fi error for using subcaption package
Stefan