Long s in pdfLaTex - latex

I am trying to mock an antique writing style in LaTex (standard Overleaf with pdfLaTex) and I need to include the old "long s" letter (https://en.wikipedia.org/wiki/Long_s). Using the ſ symbol produces the LaTeX Error: Unicode character ſ (U+017F) error.
Here's a minimal example with my actual header, thank you for any suggestion:
\documentclass[a4paper,11pt,twoside,titlepage]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage[sorting=none]{biblatex}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{enumitem}
\usepackage{epigraph}
\usepackage{subfiles}
\begin{document}
Here is a ſimple example
\end{document}

The easiest way to use unicode characters in latex is to switch to an unicode aware engine such as lualatex or xelatex. In overleaf, you can switch to them in the sidebar of your project.
If you use one of these engines, you should remove the fontenc package.
% !TeX TS-program = lualatex
\documentclass[a4paper,11pt,twoside,titlepage]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage[sorting=none]{biblatex}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage{csquotes}
%\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{enumitem}
\usepackage{epigraph}
\usepackage{subfiles}
\begin{document}
Here is a ſimple example
\end{document}

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}.

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.

Output code with english characters instead of non-english in lstlisting latex?

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}

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!

Resources