Citation in figure caption showing up as text in list of tables - latex

When using \cite in a caption for a figure, the citation shows up as the citation number in the caption (as it should) but as text in the list of figures. I never ran into this problem before so I'm not sure what's going on.
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{subcaption}
\usepackage{natbib}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{float}
\usepackage{comment}
\usepackage[table,xcdraw]{xcolor}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{graphicx,changepage}
\usepackage{setspace}
\usepackage{chngcntr}
\usepackage{verbatim}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage[thinlines]{easytable}
\usepackage{tabularx}
\usepackage{tocloft}
\usepackage[normalem]{ulem}
\begin{document}
\makeatletter
\renewcommand{\l#table}{\#dottedtocline{1}{1.5em}{2.5em}}
\makeatother
\listoftables
\begin{figure}[H]
\centering
\includegraphics [width=0.7\textwidth] {Images/cnc-processing-center-centateq-p-110_01.jpg}
\caption{Homag Centateq P-110 \cite{HOMAG}}
\label{fig:cnc_mill}
\end{figure}
\end{document}

i tried compiling your code on overleaf, to do that, i added some lines on your code as is show following:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{subcaption}
\usepackage{natbib}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{float}
\usepackage{comment}
\usepackage[table,xcdraw]{xcolor}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{graphicx,changepage}
\usepackage{setspace}
\usepackage{chngcntr}
\usepackage{verbatim}
\usepackage{listings}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage[thinlines]{easytable}
\usepackage{tabularx}
\usepackage{tocloft}
\usepackage[normalem]{ulem}
\begin{document}
\makeatletter
\renewcommand{\l#table}{\#dottedtocline{1}{1.5em}{2.5em}}
\makeatother
\listoftables
\listoffigures %added to provide a list of figures
\begin{figure}[H]
\centering
\includegraphics [width=0.7\textwidth] {test.pdf}
\caption{Homag Centateq P-110 \cite{HOMAG}}
\label{fig:cnc_mill}
\end{figure}
\begin{thebibliography}{9} % Added the thebibliography enviromment to use Homag as exemple.
\bibitem{HOMAG}
Homag.
\end{thebibliography}
\end{document}
As is shown on the figure above, the list of figures is like you want. I suspect that you have troubles with your LaTex compiler, try do a upgrade on your compiler or use another, like overleaf.

Related

Sudden overlapping of Appendinces

While working today, after hours of tweaking and fixing with the latex markup and making things prettier in the work, I all of the suddenly, after a refresh saw this:
All used packages:
\usepackage{caption}
\usepackage{blindtext}
\usepackage{pifont,mdframed}
\usepackage{enumitem}
\usepackage{amssymb}
\usepackage[titles]{tocloft}
\usepackage{hyperref} % Hyperlinks
\usepackage[nameinlink,noabbrev,capitalise]{cleveref} % Better in-doc refs
\usepackage[title,toc,titletoc,page]{appendix}
\usepackage{multirow}
\usepackage[margin=2cm]{geometry}
\usepackage{graphicx}
\usepackage{float} % Better figure and table placements
\usepackage{tabularx}
\usepackage{amsmath} % For using \text in equations
\usepackage{csquotes} % For blockquote
\usepackage[labelfont=it, labelsep=period]{caption}
\usepackage{subcaption}
\usepackage{color}
\usepackage{xcolor,colortbl}
\usepackage[final]{pdfpages} % used to include pdf to appendicies
\usepackage{lipsum}
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage{lettrine}
\usepackage{longtable}
\usepackage{ragged2e}
Declaration and usage:
\makeatletter
\newrobustcmd{\fixappendix}{%
\patchcmd{\l#subsection}{2.3em}{5.6em}{}{}%
}
\makeatother
\cleardoublepage
\newpage
\appendix
\addtocontents{toc}{\fixappendix}
\renewcommand{\thesubsection}{\appendixname~\arabic{subsection}}
Was caused by: \usepackage[titles]{tocloft}.

How to prevent LaTeX (TexStudio) for overwriting the text beyond the bottom margin? (see the picture)

I have a file where all the properties and needed packages are inside, the texfile looks like the following:
Does it have something to do with the margin properties? (First package in the code?
How can I prevent TexStudio to stop where the bottom end line of every page is?
Thanks a lot in advance..
\usepackage[left=3cm,right=2.5cm,top=3cm,bottom=2.5cm,head=33pt,foot=18pt]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsfonts}
\usepackage{amssymb}
% \usepackage{graphicx}% http://ctan.org/pkg/graphicx
% \usepackage{array} % http://ctan.org/pkg/array
\usepackage[normalem]{ulem}
\usepackage[pdfborder={0 0 0}]{hyperref}
\pagenumbering{Roman}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%Literatursystem
\usepackage[numbers,square]{natbib}
\bibliographystyle{unsrtdin}
%Grafik-Einstellungen
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\usepackage{microtype}
%===========================================================================================
%===========================================================================================
%===========================================================================================
%==========Verwendete Packages und weitere Einstellungen
\usepackage{subcaption}
\usepackage{blindtext}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage[labelfont=bf]{caption}
\usepackage[singlelinecheck=false]{caption}
\captionsetup{justification=centering}
\usepackage{nameref}
\usepackage{amssymb}
\usepackage{pdflscape}
\usepackage{wrapfig}
\usepackage{ulem}
\usepackage{url}
\usepackage{tikz}
\usepackage[fleqn]{amsmath}
\setitemize{leftmargin=*,noitemsep}
\setenumerate{leftmargin=*,noitemsep}
\usepackage{etoolbox}
\usepackage{booktabs}
\usepackage[printonlyused]{acronym}
\renewcommand*{\aclabelfont}[1]{{\textit{#1}\hfill}}
\usepackage[section]{placeins}
\usepackage{textcomp}
\usepackage{listings}
\RequirePackage{scrlfile}
\ReplacePackage{scrpage2}{scrlayer-scrpage}
%\usepackage{acro}
\usepackage[singlelinecheck=false]{caption}
%===========================================================================================
%===========================================================================================
%===========================================================================================
%==========Spezielle Einstellungen
\usepackage[headsepline,footsepline]{scrpage2}
\pagestyle{scrheadings}
\automark[section]{chapter}
\renewcommand{\chaptermark}[1]{\markright{#1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand*\MakeUppercase[1]{#1}
\ihead{}
\chead{}
\ohead{\rightmark}
\ifoot{}
\cfoot[\thepage]{\thepage}
\ofoot{}
%-------------------------------------------------------------------------
%contents
\DeclareNewTOC[%
type=formel,
name={Formel},%
hang=5em,%
listname={Formelverzeichnis}
]{for}
\newcommand*{\formelentry}[1]{%
\addcontentsline{for}{formel}{\protect\numberline{\theequation} #1}}%
\makeatletter
\renewcommand*\l#figure{\#dottedtocline{1}{0em}{2.5em}}
\makeatother
\makeatletter
\renewcommand*\l#table{\#dottedtocline{1}{0em}{2.5em}}
\makeatother
\makeatletter
\renewcommand*\l#formel{\#dottedtocline{1}{0em}{2.5em}}
\makeatother
\usepackage{bigstrut}
\setlength\bigstrutjot{3pt}
\renewcommand*{\chapterheadstartvskip}{\vspace*{.1\baselineskip}}
\usepackage{notoccite}
\usepackage{listings}
\usepackage{color}
\usepackage{courier}
\lstdefinestyle{customc}{
breaklines=true,
language=C,
showstringspaces=false,
keywordstyle=\bfseries\color{blue},
commentstyle={\color{green!40!black}},
identifierstyle=\color{black},
}
\lstset{escapechar=#,style=customc}
% macro to select a scaled-down version of Bera Mono (for instance)
\makeatletter
\newcommand\BeraMonottfamily{%
\def\fvm#Scale{0.6}% scales the font down
\fontfamily{fvm}\selectfont% selects the Bera Mono font
}
\makeatother
\lstset{
basicstyle=\BeraMonottfamily,lineskip={-6pt},
}
Text ist overwritten even after the page number 1

Unwanted blank page before title in Latex

there is an Unwanted blank page before title in Latex, and I don't understand why there are string "_result_result" in this blank page, I am pretty sure I didn't add them
Here is my code.
**I am editing in overleaf and using LuaLaTex **
\documentclass[letterpaper,twocolumn,12pt]{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,chains}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfigure}
\usepackage{fontspec}
\usepackage{underscore}
\usepackage{ragged2e}
\usepackage{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{indentfirst}
\setlength{\parindent}{2em}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{subfigure}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{subcaption}
\geometry{centering,textwidth=0.887589cm,columnsep=.81cm,left=1.6cm,right=1.6cm,top=1.91cm,bottom=2.54cm}
\pagenumbering{gobble}
\usepackage{verbatim}
\newtheorem{definition}{Definition}
\usepackage{titlesec}
\usepackage[]{caption2}
\renewcommand{\figurename}{Fig.}
\renewcommand{\captionlabeldelim}{.~}
\renewcommand{\thesubfigure}{Figure.\arabic{figure}(\alph{subfigure})}
\makeatletter \renewcommand{\#thesubfigure}{\thesubfigure\space}
\renewcommand{\p#subfigure}{} \makeatother
\titleformat*{\section}{\normalsize\centering\textbf}
\titleformat*{\subsection}{\indent\small\centering\textbf}{\hspace{1cm}}
\renewcommand\thesection{\Roman{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}
\newcommand{\tnewroman}{\fontspec{Times New Roman}}
\providecommand{\keywords}[1]
{
\footnotesize
\textbf{Key words --} #1
}
\providecommand{\abstrct}[1]
{
\footnotesize
\textbf{Abstract --} #1
}
\newcommand{\tabincell}[2]{\begin{tabular}{#{}#1#{}}#2\end{tabular}}
\setlength{\parskip}{0.5\baselineskip}
%set font style
\setmainfont{Times New Roman}
%set title and author
\title{\vspace{-1cm}My title}
%begin the document
\begin{document}
\maketitle
the unwanted blank page
Please don't ignore the errors and warnings in the .log file. they exactly tell you which of your package are incompatible and which commands are missing.
To summarise the changes:
lots of incompatible packages
syntax errors in \titleformat. In particular you must not write \titleformat{}{}
writing \textbf some text is wrong. It is a macro so you either need \textbf{some text} or \bfseries some text
you should clean up your preamble, many of the packages are redundant, make no sense or are loaded multiple times.
% !TeX TS-program = xelatex
\documentclass[letterpaper,twocolumn,12pt]{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,chains}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfigure}
\usepackage{fontspec}
\usepackage{underscore}
\usepackage{ragged2e}
\usepackage{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{indentfirst}
\setlength{\parindent}{2em}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{subfigure}
\usepackage[font=footnotesize,labelfont=bf]{caption}
%\usepackage{subcaption}
\geometry{centering,textwidth=0.887589cm,columnsep=.81cm,left=1.6cm,right=1.6cm,top=1.91cm,bottom=2.54cm}
\pagenumbering{gobble}
\usepackage{verbatim}
\newtheorem{definition}{Definition}
\usepackage{titlesec}
%\usepackage[]{caption2}
\renewcommand{\figurename}{Fig.}
%\renewcommand{\captionlabeldelim}{.~}
\renewcommand{\thesubfigure}{Figure.\arabic{figure}(\alph{subfigure})}
\makeatletter \renewcommand{\#thesubfigure}{\thesubfigure\space}
\renewcommand{\p#subfigure}{} \makeatother
\titleformat*{\section}{\normalsize\centering\bfseries}
\titleformat*{\subsection}{\indent\small\centering\bfseries\hspace{1cm}}
\renewcommand\thesection{\Roman{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}
\newcommand{\tnewroman}{\fontspec{Times New Roman}}
\providecommand{\keywords}[1]
{
\footnotesize
\textbf{Key words --} #1
}
\providecommand{\abstrct}[1]
{
\footnotesize
\textbf{Abstract --} #1
}
\newcommand{\tabincell}[2]{\begin{tabular}{#{}#1#{}}#2\end{tabular}}
\setlength{\parskip}{0.5\baselineskip}
%set font style
\setmainfont{Times New Roman}
%set title and author
\title{\vspace{-1cm}My title}
\author{names}
%begin the document
\begin{document}
\maketitle
\justifying
%%
\begin{thebibliography}{00}
\bibitem{1}My bib
\end{thebibliography}
\end{document}

How to eliminate brackets from caption for subfigures in latex?

The problem I have is that when I compile the image caption is displayed with brackets "[fig caption]".......................................................................................................................................
\documentclass{elsarticle}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{booktabs} % For professional looking tables
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{framed}
\usepackage{longtable}
\usepackage{lscape}
%\usepackage[ruled,vlined]{algorithm2e}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
%\usepackage[ruled,vlined]{algorithm2e}
\usepackage{slashbox}
\usepackage{caption}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{float}
%\usepackage{subcaption}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{lineno,hyperref}
\usepackage{cleveref}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\modulolinenumbers[5]
\journal{Journal of \LaTeX\ Templates}
\usepackage{blindtext}
\usepackage{amssymb}
\usepackage{amsthm}
\begin{figure}
\subfigure[]{ \includegraphics[width=0.24\textwidth]{graph1}
}
\subfigure[]{\includegraphics[width=0.24\textwidth]{graph2}%
}
\subfigure[]{\includegraphics[width=0.24\textwidth]{graph3}}%
\caption{Three simple graphs}
\label{fig:three graphs}
\end{figure}
This issue has been addressed at Tex Stack Exchange, see here.
The proposed solution is to use the subcaption package, instead of subfig.
I had the same issue and found a solution here: https://answerbun.com/tex-latex/latex-how-to-remove-round-brackets-in-the-caption-of-subfigures-using-subfloat/
I used the following package:
\usepackage[caption=false]{subfig}
And the following structure:
\begin{figure}[H]
\captionsetup[subfloat]{labelformat=simple} %% Do not forget this command!
\centering
\subfloat[]{\includegraphics[width=0.49\textwidth]{fig1}}\hfill
\subfloat[]{\includegraphics[width=0.49\textwidth]{fig2}}\hfill \\
\subfloat[]{\includegraphics[width=0.49\textwidth]{fig3}}
\caption{General caption.} \label{fig:1}
\end{figure}
It worked for me!

removing of paragraph indent with \setlength{\parindent}{0pt} and \usepackage{parskip} does not work

I try to get rid of all automatic indentions in my document. Unfortunately, neither \setlength{\parindent}{0pt} nor \usepackage{parskip} do their job.
These are all packages I use:
\documentclass[12pt]{extarticle} % A4 paper and 11pt font size
\usepackage{longtable}
\usepackage[top=2.0cm, bottom=2.0cm, left=2.0cm, right=5.0cm]{geometry}
\usepackage{footnote}
\usepackage{caption}
\usepackage{float}
\usepackage{amssymb}
\usepackage{subfigure}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{caption}
\usepackage{tabularx}
\usepackage{appendix}
\usepackage{natbib}
\usepackage{acronym}
\usepackage{setspace}
\usepackage{url}
\usepackage{parskip}
\usepackage{transparent}
\usepackage{eso-pic}
\usepackage{times}
\usepackage[english]{babel}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage[tiny]{titlesec}
\usepackage{parskip}
Thanks for your help!
Cheers
This should do it:
\setlength{\parindent}{0em}
As per this article: https://www.overleaf.com/learn/latex/Articles/How_to_change_paragraph_spacing_in_LaTeX#The_fundamentals:_parameter_commands_and_examples, you should add the command \setlength{\parindent}{0pt} not in the preamble, but after \begin{document}.

Resources