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}.
Related
I'm trying to remove the space in LoF between different chapters. i have tried different solutions(patching it as well) but it is not working. I have attached the codes below for your reference. Any help or pointers to resolve it would be highly appreciated.
Edit: Link to a minimal working project file depicting the error.
Working Example
\documentclass[twoside, 12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
%package for higlighting text
\usepackage{color,soul}
%packages for multicol glossary, bibliography and list
\usepackage[section,numberedsection=autolabel, acronym]{glossaries}
\usepackage{setspace}
\usepackage{enumitem}
\usepackage[style=ieee]{biblatex}
\usepackage{glossary-mcols}
\usepackage{multicol}
%package for comments
\usepackage{verbatim}
%%Random text
\usepackage{lipsum}
%packages for fancy headers
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{tikz}
%package for subfigures
\usepackage{subfigure}
\makeglossaries
% Use package below to change margins and graphics
\usepackage{graphicx}
\usepackage[a4paper,top=25mm,bottom=25mm,left=25mm,right=25mm]{geometry}
% text color package
\usepackage{xcolor}
% use to customize chapter headings of toc lof lot
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\usepackage{sectsty}
\chapternumberfont{\Large}
\chaptertitlefont{\Large}
\usepackage{hyperref}
%for table
\usepackage{booktabs}
%maths Package
\usepackage{amsmath}
%minted package
\usepackage[]{minted}
\usepackage{fancyvrb}
%for greek words
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{lmodern}
\usemintedstyle{vs}
\setminted{bgcolor=myGray,
breaklines,
mathescape,
linenos,
numbersep=5pt,
frame=single,
numbersep=5pt,
xleftmargin=0pt,
breaksymbolleft=\raisebox{0.8ex}{
\small\reflectbox{\carriagereturn}},
breaksymbolindentleft=0pt,
breaksymbolsepleft=0pt,
breaksymbolindentright=0pt,
breaksymbolsepright=0pt
}
%for code listing
\usepackage{xcolor}
\usepackage{listings}
\definecolor{myGray}{RGB}{245, 239, 239}
\definecolor{maroon}{RGB}{128,0,0}
\definecolor{forestGreen}{RGB}{1,68,33}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{myGray},
commentstyle=\color{forestGreen},
keywordstyle=\color{blue},
numberstyle=\tiny\color{gray},
stringstyle=\color{maroon},
basicstyle=\ttfamily\small,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
frame=single
}
\lstset{style=mystyle}
%Patch to remove the space in LoF, LoT, LoC per chapter basis
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\#chapter}{\addtocontents{lof}{\protect\addvspace{10\p#}}}{}{}{}% LoF
\patchcmd{\#chapter}{\addtocontents{lot}{\protect\addvspace{10\p#}}}{}{}{}% LoT
\makeatother
%for custom caption
\usepackage{caption}
% document begins here
\begin{document}
%Footer and header fancy - chapter x. ChapterName format
\fancyhead{}
\fancyhead[RO,LE]{\leftmark}
\fancyfoot{}
\fancyfoot[CE,CO]{\thepage}
\newpage
\phantomsection
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\newpage
\listoftables
\phantomsection
\addcontentsline{toc}{chapter}{\listtablename}
\newpage
\listoffigures
\phantomsection
\addcontentsline{toc}{chapter}{\listfigurename}
\newpage
\renewcommand{\lstlistingname}{Code}
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}
\lstlistoflistings
\phantomsection
\addcontentsline{toc}{chapter}{\lstlistlistingname}
%CHAPTERS BEGIN
\pagenumbering{arabic}
\newpage
\input{Chapters/Intro}
\input{Chapters/Results}
\newpage
%%APPENDIX BEGINS
\fancyhead{}
\fancyfoot{}
\end{document}
Please find below the code for respective
The below figures are part of sample Intro file.
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle}
\label{fig:swCycle}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle2}
\label{fig:swCycle2}
\end{figure}
Results File
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{<someImage>}
\caption{Software Development Lifecycle3}
\label{fig:swCycle3}
\end{figure}
You could remove the spaces between the list entries of different chapters if you make the patches before you load hyperref:
\documentclass[twoside, 12pt]{report}
% use to customize chapter headings of toc lof lot
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Large\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\#chapter}{\addtocontents{lof}{\protect\addvspace{10\p#}}}{}{}{}
\patchcmd{\#chapter}{\addtocontents{lot}{\protect\addvspace{10\p#}}}{}{}{}
\makeatother
% load hyperref after these patches
\usepackage{hyperref}
\begin{document}
\listoffigures
\chapter{test}
\begin{figure}[htbp]
\caption{heading}
\end{figure}
\chapter{test}
\begin{figure}[htbp]
\caption{heading}
\end{figure}
\end{document}
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
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.
i wanna insert an ansys apdl code code text in my thesis.
I have tried the \begin{lstlisting} for my code (english) since i have tha package.
My thesis template is put to have greek as default language so when i compile the lstlisting in latex i get this output
latex output (greek characters).
I have tried use \eng{} inside or outside of the \begin{lstlisting} but i get greek characters either way.
this the code :
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
Anyone has any idea how can i get an ouput of this code with english characters instead of greek?
a minimal example is like that :
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
You can use \selectlanguage{english} to temporarily switch to English:
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{document}
Greek
{
\selectlanguage{english}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
}
Greek
\end{document}
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!