Unwanted blank page before title in Latex - 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}

Related

Removing spaces between chapter LoF in table of contents

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}

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

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

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.

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