So I have the following document:
\include{preamble}
\title{test title}
\begin{document}
\maketitle
\begin{equation*}
\begin{aligned}
\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\dots}}}}}
\end{aligned}
\end{equation*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
the contents of my preamble.tex file is:
%%%%% Document Setup %%%%%%%%
\documentclass[10pt,onecolumn]{revtex4} % Font size (10,11 or 12pt) and column number (one or two).
\usepackage{times} % Times New Roman font type
\usepackage[a4paper, left=1.85cm, right=1.85cm,top=1.85cm, bottom=1.85cm]{geometry} % Defines paper size and margin length
\usepackage[font=small, labelfont=bf]{caption} % Defines caption font size as 9pt and caption title bolded
\usepackage{graphics,graphicx,epsfig,ulem} % Makes sure all graphics works
\usepackage{amsmath} % Adds mathematical features for equations
\usepackage{etoolbox} % Customise date to preferred format
\usepackage{subcaption}
\usepackage{caption}
\makeatletter
\patchcmd{\frontmatter#RRAP#format}{(}{}{}{}
\patchcmd{\frontmatter#RRAP#format}{)}{}{}{}
\renewcommand\Dated#name{}
\makeatother
\usepackage{fancyhdr}
\def\bibsection{\section*{References}} % Position reference section correctly
\usepackage{import}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{xcolor}
\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
For some reason the title just will not be included on the pdf when I compile the code, I am sure I have \title{} and \maketitle in the correct positions. Any help as to why this is would be much appreciated.
Move the title after \begin{document}:
\documentclass{revtex4}
\begin{document}
\title{test title}
\maketitle
\end{document}
(don't do this with other documentclasses. Most of the time it is better to have the \title in the preamble, e.g. to get sensible pdf meta data if combined with hyperref)
Related
Although i have tried many code of a footnote in a caption of a figure , it doesn't work , really , where is the problem here
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\makenomenclature
\usepackage[nottoc]{tocbibind}
\pagenumbering{Roman}
\usepackage{lipsum}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{4}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth{images/frog.jpg}
\caption[frog]{frog \footnotemark }
\label{fig:pic1}
\end{figure}
\footnotetext{frog}
\end{document}
Two problems:
you can't have the \makenomenclature macro in your code with a package which defines it, e.g. nomencl
the ] after the optional argument of your graphic is missing
With the split between \footnotetext and \footnotemark there is always the risk that the floating figure and the footnote will end up on different pages. You can lessen the risk by using [htbp] as floating specifier for your figure, this way you at least allowed the figure to be placed where the footnote is.
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
%\makenomenclature
\usepackage[nottoc]{tocbibind}
\pagenumbering{Roman}
\usepackage{lipsum}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{4}
\begin{document}
\begin{figure}[htpb]
\centering
\includegraphics[width=0.8\textwidth]{example-image-duck}
\caption[frog]{frog \footnotemark }
\label{fig:pic1}
\end{figure}
\footnotetext{frog}
\end{document}
I've a big problem with LaTeX, because I can't delete margin before new chapter
I've tried everything but I am rather new and I didn't manage. My code:
\documentclass[polish,12pt,oneside]{mwbk}
\usepackage[a4paper,includeheadfoot,inner=3.0cm,outer=2.5cm,top=3cm,bottom=3cm]{geometry}
\linespread{1.416}
\usepackage{lipsum}
\clubpenalty=10000
\widowpenalty=10000
\usepackage{fancyhdr}
\pagestyle{plain}
\setlength{\headsep}{2em}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}
\usepackage{polski}
\usepackage[pagebackref=false]{hyperref}
\bibliographystyle{plplain}
\usepackage{dirtree}
\usepackage{varwidth}
\usepackage[labelsep=period]{caption}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepackage{subcaption}
\usepackage{float}
\usepackage{wasysym}
% THE CODE I'VE TRIED
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
% --- Patch \chapter
\patchcmd{\#makechapterhead}{50\p#}{\chapheadtopskip}{}{}% Space from top of page to CHAPTER X
\patchcmd{\#makechapterhead}{20\p#}{\chapheadsep}{}{}% Space between CHAPTER X and CHAPTER TITLE
\patchcmd{\#makechapterhead}{40\p#}{\chapheadbelowskip}{}{}% Space between CHAPTER TITLE and text
% --- Patch \chapter*
\patchcmd{\#makeschapterhead}{50\p#}{\chapheadtopskip}{}{}% Space from top of page to CHAPTER TITLE
\patchcmd{\#makeschapterhead}{40\p#}{\chapheadbelowskip}{}{}% SPace between CHAPTER TITLE and text
\makeatother
% Set new lengths
\newlength{\chapheadtopskip}\setlength{\chapheadtopskip}{5pt}
\newlength{\chapheadsep}\setlength{\chapheadsep}{5pt}
\newlength{\chapheadbelowskip}\setlength{\chapheadbelowskip}{5pt}
% END THE CODE I'VE TRIED
\begin{document}
\selectlanguage{polish}
\addtocounter{page}{1}
\setcounter{tocdepth}{1}
\tableofcontents
\setlength{\parskip}{0.5ex}
\chapter{Hardware}
\label{ch:hardware}
\section{Components}
\label{sec:components}
\lipsum[3-7]
\cleardoublepage
\phantomsection
\listoffigures
\end{document}
Methods with titlesec package give me bunch of errors. I'm using overleaf.
changing
\documentclass[polish,12pt,oneside]{mwbk}
to
\documentclass[polish,12pt,oneside]{book}
helps, but destroy another styling (like enum list etc.)
The class you use, defines the chapter format with
\SetSectionFormatting[breakbefore,wholewidth]{chapter}
{0\p#}
{\FormatRigidChapterHeading{6.4\baselineskip}{12\p#}%
{\large\#chapapp\space}{\LARGE}}
{1.6\baselineskip}
If you play around with the value for 6.4, you can adjust the space above the chapter heading.
\documentclass[polish,12pt,oneside]{mwbk}
\usepackage[a4paper,includeheadfoot,inner=3.0cm,outer=2.5cm,top=3cm,bottom=3cm]{geometry}
\linespread{1.416}
\usepackage{lipsum}
\clubpenalty=10000
\widowpenalty=10000
\usepackage{fancyhdr}
\pagestyle{plain}
\setlength{\headsep}{2em}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}
\usepackage{polski}
\usepackage[pagebackref=false]{hyperref}
\bibliographystyle{plplain}
\usepackage{dirtree}
\usepackage{varwidth}
\usepackage[labelsep=period]{caption}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepackage{subcaption}
\usepackage{float}
\usepackage{wasysym}
% THE CODE I'VE TRIED
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
% --- Patch \chapter
\patchcmd{\#makechapterhead}{50\p#}{\chapheadtopskip}{}{}% Space from top of page to CHAPTER X
\patchcmd{\#makechapterhead}{20\p#}{\chapheadsep}{}{}% Space between CHAPTER X and CHAPTER TITLE
\patchcmd{\#makechapterhead}{40\p#}{\chapheadbelowskip}{}{}% Space between CHAPTER TITLE and text
% --- Patch \chapter*
\patchcmd{\#makeschapterhead}{0\p#}{\chapheadtopskip}{}{}% Space from top of page to CHAPTER TITLE
\patchcmd{\#makeschapterhead}{40\p#}{\chapheadbelowskip}{}{}% SPace between CHAPTER TITLE and text
\makeatother
% Set new lengths
\newlength{\chapheadtopskip}\setlength{\chapheadtopskip}{5pt}
\newlength{\chapheadsep}\setlength{\chapheadsep}{5pt}
\newlength{\chapheadbelowskip}\setlength{\chapheadbelowskip}{5pt}
% END THE CODE I'VE TRIED
\makeatletter
\SetSectionFormatting[breakbefore,wholewidth]{chapter}
{0\p#}
{\FormatRigidChapterHeading{0\baselineskip}{12\p#}%
{\large\#chapapp\space}{\LARGE}}
{1.6\baselineskip}
\makeatother
\begin{document}
\selectlanguage{polish}
\addtocounter{page}{1}
\setcounter{tocdepth}{1}
\tableofcontents
\setlength{\parskip}{0.5ex}
\chapter{Hardware}
\label{ch:hardware}
\section{Components}
\label{sec:components}
\lipsum[3-7]
\cleardoublepage
\phantomsection
\listoffigures
\end{document}
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}
I would like to have a table of content with numbering identical to the ones in text. So, in text each section/subsection/subsubsection is numerated as '1.' or '1.1.' or '1.1.1.'. However my table of content is not updating it, so it shows '1' or '1.1'.
I was following answer to this topic: https://superuser.com/questions/811779/how-to-add-a-dot-for-section-subsection-numbering-in-tex
So I am using 'secdot' package. I have tried using
\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}
but I keep getting '\the chapter undefined', 'No counter chapter defined' or 'Missing number, treated as zero' errors.
I would appreciate any tips on what's wrong.
EDIT:
\documentclass[11pt, a4paper, twoside]{article}
\usepackage{listings, lstautogobble}
\usepackage{ragged2e}
\usepackage{times}
\usepackage{secdot}
\sectiondot{subsection}
\usepackage{listings}
\usepackage[toc,page]{appendix}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\geometry{a4paper,
left=30mm,
top=25mm,
bottom=25mm,
right=20mm
}
\sectiondot{subsection}
\makenomenclature
\setlength{\parindent}{0.5 cm}
\renewcommand{\baselinestretch}{1.15}
\pagenumbering{roman}
\begin{document}
\setboolean{#twoside}{false}
\begin{figure}[H]
\begin{center}
\includegraphics[width=14cm,height=15cm,keepaspectratio]{./thesis- frontpagedesign}
\end{center}
\end{figure}
\begin{center}
\tableofcontents
\end{center}
\begin{center}
\listoffigures
\end{center}
\section{Introduction}
%sometext
\makeatletter
\def\#seccntformat#1{%
\expandafter\ifx\csname c##1\endcsname\c#section\else
\csname the#1\endcsname\quad
\fi}
\makeatother
\end{document}
Your current setup is confusing. For example,
\makeatletter
\def\#seccntformat#1{%
\expandafter\ifx\csname c##1\endcsname\c#section\else
\csname the#1\endcsname\quad
\fi}
\makeatother
removes the setting of any \section number. And mixing this with the use of secdot seems problematic.
The easiest way to achieve dots after sectional unit numbers within your text as well as the ToC is to adjust the representation of the respective counters:
\documentclass{article}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}
\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}
\begin{document}
\tableofcontents
\section{Introduction}
\end{document}
This solution is sufficient, but will also affect \references. For example \ref{sec:introduction} would return 1. which may look odd in the middle of a sentence: ... from section~\ref{sec:introduction} we can see ....
If you don't want periods ending your \references, you can use
\usepackage{secdot}% Adds . after sectional unit numbers
\usepackage{etoolbox}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\numberline}{\hfil}{.\hfil}{}{}
You're already familiar with what secdot does. The patch to \numberline is thanks to etoolbox which changes the default definition
\def\numberline#1{\hb#xt#\#tempdima{#1\hfil}}
into
\def\numberline#1{\hb#xt#\#tempdima{#1.\hfil}}
effectively inserting an ending-period as part of the number that is printed within the ToC. Note that this will also affect how figures/tables are displayed within the LoF/LoT. However, one can change that using scoping:
\begingroup
% The following patch will only affect entries in the ToC
\patchcmd{\numberline}{\hfil}{.\hfil}{}{}
\tableofcontents
\endgroup
\listoffigures
\listoftables
I am writing my thesis in Latex, document class: report. I have got front matter containing of abstract, acknowledgement and so on.
I want to add header only to my main matter which starts with my first chapter:Introduction. I want the header to be the chapter number without the word "chapter" and the chapter title next to it. I also want the page number to appear in the centre on the bottom of the page in all pages of the main matter.
I don't want any header or line in any page of my front matter.
Can you please guide me? Thanks
Here it is the sample code that I am applying.
\documentclass[a4paper,12pt,titlepage]{report}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{color}
\usepackage{colordvi}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{theorem}
\usepackage{lineno}
\usepackage{multirow}
\usepackage [toc,page]{appendix}
\usepackage{framed}
\usepackage{setspace}
\doublespacing
\usepackage[left=1.5in,top=2in,right=1in,bottom=2in]{geometry}
\begin{document}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
\renewcommand{\thepage}{\roman{page}}
% here it comes my front matter for example:
\clearpage
\addcontentsline{toc}{chapter}{Abstract}
\chapter*{Abstract}
ABSTRACT CONTENTS
%then:
\clearpage
\cleardoublepage
\pagenumbering{arabic}
% here it starts my main matter:
\chapter{Introduction} %first chapter
\chapter{First Esssay in XXX} %second chapter
\end{document}
You have a number of options to set headers in a document. The most frequently-used package is fancyhdr.
First of all, you need to remove the word Chapter from the regular chapter mark. For this, add
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps#fancy{%
\patchcmd{\chaptermark}% <cmd>
{\#chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
to your preamble. The above strips out \#chapapp\ (note the space) from \chaptermark as part of the call to \pagestyle{fancy}. That's required as fancyhdr may update \chaptermark upon calling \pagestyle{fancy}.
Second, you need to set the headers/footers. Here's a setting that yields what you're after:
\usepackage{fancyhdr}
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}% Chapter mark
\fancyfoot[C]{\thepage}% Footer contains the page number
\renewcommand{\headrulewidth}{.4pt}% Header rule width
The above sets the header as \leftmark, which contains the \chaptermark setting (since \chaptermark actually issues \markboth{<leftmark>}{<rightmark>} with an empty <rightmark>).
\documentclass{report}
\usepackage{fancyhdr,lipsum}
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps#fancy{%
\patchcmd{\chaptermark}% <cmd>
{\#chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\begin{document}
%\frontmatter
\pagenumbering{roman}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
% here it comes my front matter for example:
\cleardoublepage
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{Abstract}%
\chapter*{Abstract} \lipsum[1]
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction} \lipsum[1-50] % first chapter
\chapter{Methodology} \lipsum[1-50] % second chapter
\chapter{Conclusion} \lipsum[1-50] % last chapter
\end{document}
Note that \chapters are set by default using the plain style. If you wish this to be different, you'll have to redefine the plain page style.
You can achieve the same output using a different header/footer package like titleps.