Error: missing \begin{document} in LaTeX [closed] - latex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I have error in my LaTeX document, when run my file, have a error
! LaTeX Error: Missing \begin{document}.
and this tag \begin{document} exists in my code
\documentclass[12pt‎, ‎a4paper]{article}‎
\usepackage{graphicx} % inserting images
\usepackage[top=3cm,right=3cm,bottom=2.5cm,left=2.5cm]{geometry}
\usepackage[colorlinks,linkcolor=blue,citecolor=red]{hyperref}
\usepackage{multirow}
\usepackage{subfig}
\usepackage{algorithm}
\usepackage{algorithmic}
%\usepackage[utf8]{inputenc}
%\usepackage{color, pdfcolmk}
%\usepackage{sweave}
% setting the margins of page
\usepackage{xepersian}
\usepackage{setspace}
\settextfont[Scale=1.2]{XB Zar}
\setlatintextfont[Scale=1.1]{XB Zar}
\setdigitfont{XB Zar}
\setcounter{secnumdepth}{3}
\SepMark{-}
\DefaultMathsDigits
%-----------------------list-------------------------------------
\renewcommand{\listfigurename}{فهرست شکل ها}
\renewcommand{\listtablename}{فهرست جدول‌ها}
\renewcommand{\refname}{\rl{{مرجع‌ها}\hfill}}
%---------------------end list-------------------------------------
%\usepackage{geometry}\geometry{left=35mm,right=35mm, top=30mm,bottom=30mm}
\begin{document}
\pagenumbering{gobble}
\clearpage
\thispagestyle{empty}

When I copy the code you have shown here into Notepad++ with UTF-8 input encoding, I get the following result for the first line:
\documentclass[12pt?, ?a4paper]{article}?
From that I assume that you have non-UTF-8 characters which aren't recognized by LaTeX and thus it throws an error. Try to replace that line by
\documentclass[12pt, a4paper]{article}
As #nowox remarked in a comment, the \end{document} is missing. Make sure that you have that in your file.

Related

Latex: Formatting the table of code listings [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I'm trying to include a table of code listings in my Latex document. This is the command I am using:
\lstlistoflistings
The problem I am facing is, that the title of the code is overlaying with the numbering:
I would like to have it like this (except for "Code" in place of "Tabelle "), but I can't find a solution for it:
Based on the code kindly provided by #Dr. Manuel Kuehner, you can make this quick hack to prefix the lol with the word "Code":
% Based on https://tex.stackexchange.com/questions/97474
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{listings}
% https://tex.stackexchange.com/questions/34400
% https://tex.stackexchange.com/questions/538069
\renewcommand\lstlistingname{Quellcode (in German)}
\renewcommand{\lstlistlistingname}{Quellcodeverzeichnis (in German)}
\makeatletter
\def\l#lstlisting#1#2{\#dottedtocline{1}{0em}{1.5em}{Code #1}{#2}}
\makeatother
\begin{document}
\tableofcontents
\lstlistoflistings
\section{Section}
Some text.
\begin{lstlisting}[caption={A listing}]
Code
Code
Code
\end{lstlisting}
Some text.
\end{document}
Here is a start :).
% Based on https://tex.stackexchange.com/questions/97474
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{listings}
% https://tex.stackexchange.com/questions/34400
% https://tex.stackexchange.com/questions/538069
\renewcommand\lstlistingname{Quellcode (in German)}
\renewcommand{\lstlistlistingname}{Quellcodeverzeichnis (in German)}
\begin{document}
\tableofcontents
\lstlistoflistings
\section{Section}
Some text.
\begin{lstlisting}[caption={A listing}]
Code
Code
Code
\end{lstlisting}
Some text.
\end{document}

I cant get the references correct for my document. Caption and label are in the correct order [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
So i cant get the references correct in my latex document. I've read about caption and label being in the correct order and i already have that. below are is a working document.tex with the error.
I'm still using a local file, because i dont know how to fix that. But it is just a random png image on my machine and that is working
\documentclass[a4paper, twocolumn]{report}
\usepackage[dutch]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{ebgaramond}
% Bibliography
\usepackage[style=apa]{biblatex}
\usepackage{csquotes}
\addbibresource{bibliography.bib}
% Translation for references to objects
\makeatletter
\def\HyLang#dutch{%
\def\equationautorefname{Vergelijking}%
\def\footnoteautorefname{voetnoot}%
\def\itemautorefname{item}%
\def\figureautorefname{Figuur}%
\def\tableautorefname{Tabel}%
\def\partautorefname{Deel}%
\def\appendixautorefname{Bijlage}%
\def\chapterautorefname{hoofdstuk}%
\def\sectionautorefname{sectie}%
\def\subsectionautorefname{subsectie}%
\def\subsubsectionautorefname{subsubsectie}%
\def\paragraphautorefname{paragraaf}%
\def\subparagraphautorefname{subparagraaf}%
\def\FancyVerbLineautorefname{lijn}%
\def\theoremautorefname{Stelling}%
\def\pageautorefname{pagina}%
}
\g#addto#macro\extrasdutch\HyLang#dutch
\makeatother
\addto\captionsdutch{%
\renewcommand{\appendixname}%
{Bijlage}%
}
\usepackage[hidelinks]{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{wallpaper}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\pgfplotsset{compat=1.15}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
% Table format
\pgfplotstableset{
every head row/.style={
before row=\toprule,after row=\midrule},
every last row/.style={
after row=\bottomrule},
col sep = comma,
string type,
}
% Colors
\definecolor{title-color}{HTML}{4230b8}
% Title formats with custom coloring
\titleformat{\chapter}
{\normalfont\bfseries\Huge\color{title-color}}{\thechapter.}{10pt}{}
\titleformat*{\section}{\normalfont\Large\bfseries\color{title-color}}
\titleformat*{\subsection}{\normalfont\large\bfseries\color{title-color}}
\titleformat*{\subsubsection}{\normalfont\normalsize\bfseries\color{title-color}}
% No page number on TOC page
\addtocontents{toc}{\protect\thispagestyle{empty}}
\begin{document}
\chapter{Planning}
\label{chap:schedule}
First ref to figure \autoref{fig:schedule}
\begin{figure}[h]
\centering
\caption{Planning}
\includegraphics[width=\textwidth]{img/schedule.png}
\label{fig:schedule}
\end{figure}
\end{document}
Output:
First ref to figure Figuur 1.1
Figuur 1.1: Planning
It should be figure 1 instead of figure 1.1
You can use the chngcntr package to use \counterwithout{figure}{chapter}
\documentclass[a4paper, twocolumn]{report}
\usepackage[dutch]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{ebgaramond}
% Bibliography
\usepackage[style=apa]{biblatex}
\usepackage{csquotes}
\addbibresource{bibliography.bib}
% Translation for references to objects
\makeatletter
\def\HyLang#dutch{%
\def\equationautorefname{Vergelijking}%
\def\footnoteautorefname{voetnoot}%
\def\itemautorefname{item}%
\def\figureautorefname{Figuur}%
\def\tableautorefname{Tabel}%
\def\partautorefname{Deel}%
\def\appendixautorefname{Bijlage}%
\def\chapterautorefname{hoofdstuk}%
\def\sectionautorefname{sectie}%
\def\subsectionautorefname{subsectie}%
\def\subsubsectionautorefname{subsubsectie}%
\def\paragraphautorefname{paragraaf}%
\def\subparagraphautorefname{subparagraaf}%
\def\FancyVerbLineautorefname{lijn}%
\def\theoremautorefname{Stelling}%
\def\pageautorefname{pagina}%
}
\g#addto#macro\extrasdutch\HyLang#dutch
\makeatother
\addto\captionsdutch{%
\renewcommand{\appendixname}%
{Bijlage}%
}
\usepackage[hidelinks]{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{wallpaper}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\pgfplotsset{compat=1.15}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
% Table format
\pgfplotstableset{
every head row/.style={
before row=\toprule,after row=\midrule},
every last row/.style={
after row=\bottomrule},
col sep = comma,
string type,
}
% Colors
\definecolor{title-color}{HTML}{4230b8}
% Title formats with custom coloring
\titleformat{\chapter}
{\normalfont\bfseries\Huge\color{title-color}}{\thechapter.}{10pt}{}
\titleformat*{\section}{\normalfont\Large\bfseries\color{title-color}}
\titleformat*{\subsection}{\normalfont\large\bfseries\color{title-color}}
\titleformat*{\subsubsection}{\normalfont\normalsize\bfseries\color{title-color}}
% No page number on TOC page
\addtocontents{toc}{\protect\thispagestyle{empty}}
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\begin{document}
\chapter{Planning}
\label{chap:schedule}
First ref to figure \autoref{fig:schedule}
\begin{figure}[h]
\centering
\caption{Planning}
\includegraphics[width=\textwidth]{example-image}
\label{fig:schedule}
\end{figure}
\end{document}

latex caption language (2) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
Referring to this question (Change LaTeX caption language), I got the same problem and it does not get solved by the use of the correct language package.
Here is a MWE:
\documentclass[a4paper,twoside]{article}
\usepackage[a4paper,top=2cm,bottom=2cm,inner=6cm,outer=2cm]{geometry}
\geometry{twoside}
\usepackage{lmodern}%font
\usepackage[francais]{babel}%language corrector and punctuation rules
\usepackage[utf8]{inputenc}%encoding
\usepackage[T1]{fontenc}
\usepackage[font=small]{caption}%titres des figures
\usepackage{color}
\usepackage{array}
\usepackage{colortbl}
\usepackage[pdftex]{graphicx}
\begin{document}
\begin{table}[h!]
\caption{Calendrier approximatif du processus législatif.}
\begin{tabular}{>{\raggedleft}p{0.65\textwidth}
p{0.1\textwidth}
}
Analyse du problème, fixation des objectifs et définition des moyens d'action possibles & 1 an\\
\end{tabular}
\end{table}
\end{document}
What do I do wrong? Thank you!
The standard tag for a table defined in frenchb.ldf is the word “Table”.
If you want it to become “Tableau”, for instance, you have to tell babel to.
\documentclass[a4paper,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}%encoding
\usepackage[francais]{babel}%language corrector and punctuation rules
\usepackage[a4paper,top=2cm,bottom=2cm,inner=6cm,outer=2cm]{geometry}
\geometry{twoside}
\usepackage{lmodern}%font
\usepackage[font=small]{caption}%titres des figures
\usepackage{color}
\usepackage{array}
\usepackage{colortbl}
\usepackage{graphicx}
\addto\captionsfrench{\renewcommand\frenchtablename{{\FBfigtabshape Tableau}}}
\begin{document}
\begin{table}[h!]
\caption{Calendrier approximatif du processus législatif.}
\begin{tabular}{>{\raggedleft}p{0.65\textwidth}
p{0.1\textwidth}
}
Analyse du problème, fixation des objectifs et définition des moyens d'action possibles & 1 an\\
\end{tabular}
\end{table}
\end{document}
I have also changed the package loading order to a better one. Note that you don't need to pass the pdftex option to graphicx (unless you have a very old TeX distribution).

Frustration with fancyhdr [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have the following tex document:
\documentclass[a4paper,11pt,oneside]{book}
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{lipsum}
\usepackage[left=2cm,top=3cm,right=1.5cm,bottom=2cm]{geometry}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection}{}}
\usepackage[Lenny]{fncychap}
\usepackage{thumbpdf}
\usepackage[colorlinks]{hyperref}
\setlength\marginparwidth{1cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LO,L]{Book template}
\fancyhead[RO,R]{\rightmark}
\fancyfoot[CO,C] {\thepage}
\begin{document}
\chapter{Chapter Intro}
\lipsum
\chapter{Chapter with subsections}
\section{section foo}
\lipsum
\subsection{subsection bar}
\lipsum
\end{document}
A sample can be viewed at http://www.mediafire.com/?0m5mnka32kj
On the top right:
How to make it show the chapter title if there is no section, as on page 2?
How to make it show the section title and nothing but the section title (no numbers, no subsections, subsubsections, etc) if there is an active section, as it's the case on page 4?
Thanks
You are almost there!
The following two marks should do the trick:
\renewcommand{\chaptermark}[1]{\markright{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
Be sure to move them to to a position after \pagestyle{fancy}. Also be sure to remove the custom \subsectionmark, unless you want to use some subsection information in the headers.

How can I start pagenumbers, where the first section occurs in LaTex? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This question is related to the post about having abstract at the titlepage.
I want to reset the page numbering at the given section.
You can also reset page number counter:
\setcounter{page}{1}
However, with this technique you get wrong page numbers in Acrobat in the top left page numbers field:
\maketitle: 1
\tableofcontents: 2
\setcounter{page}{1}
\section{Introduction}: 1
...
I use
\pagenumbering{roman}
for everything in the frontmatter and then switch over to
\pagenumbering{arabic}
for the actual content. With pdftex, the page numbers come out right in the PDF file.
To suppress the page number on the first page, add \thispagestyle{empty} after the \maketitle command.
The second page of the document will then be numbered "2". If you want this page to be numbered "1", you can add \pagenumbering{arabic} after the \clearpage command, and this will reset the page number.
Here's a complete minimal example:
\documentclass[notitlepage]{article}
\title{My Report}
\author{My Name}
\begin{document}
\maketitle
\thispagestyle{empty}
\begin{abstract}
\ldots
\end{abstract}
\clearpage
\pagenumbering{arabic}
\section{First Section}
\ldots
\end{document}

Resources