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}
Related
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}
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.
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.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I want to make cheat sheets for my personal use. I want to use this opportunity to get a good hand on LaTeX too. (I am already comfortable making simple documents math related in LaTeX.)
Now I want to try making cheat sheets in LaTeX. But I don't know how to do it. In cheat sheets, usually the page is split into multiple rectangular sections and each one has a few commands or notes inside it. Each rectangular section has a border etc.
How can it be done in LaTeX? Are any packages available to do this? Do you think TikZ will be a good idea for this?
Because some professors allowed us to use cheat sheets written on a computer for exams, I decided to create a template some time ago to save enough space as possible but keep readibility. The template uses the code of the answer here.
Update: The complete source code can now be found here.
The base file looks like this:
\documentclass[10pt,landscape,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,arrows,fit,calc,graphs,graphs.standard}
\usepackage[nosf]{kpfonts}
\usepackage[t1]{sourcesanspro}
%\usepackage[lf]{MyriadPro}
%\usepackage[lf,minionint]{MinionPro}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage[top=0mm,bottom=1mm,left=0mm,right=1mm]{geometry}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{microtype}
\let\bar\overline
\definecolor{myblue}{cmyk}{1,.72,0,.38}
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}
\colorlet{circle edge}{myblue}
\colorlet{circle area}{myblue!5}
\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\everymath\expandafter{\the\everymath \color{myblue}}
\everydisplay\expandafter{\the\everydisplay \color{myblue}}
\renewcommand{\baselinestretch}{.8}
\pagestyle{empty}
\global\mdfdefinestyle{header}{%
linecolor=gray,linewidth=1pt,%
leftmargin=0mm,rightmargin=0mm,skipbelow=0mm,skipabove=0mm,
}
\newcommand{\header}{
\begin{mdframed}[style=header]
\footnotesize
\sffamily
Cheat sheet\\
by~Your~Name,~page~\thepage~of~2
\end{mdframed}
}
\makeatletter
\renewcommand{\section}{\#startsection{section}{1}{0mm}%
{.2ex}%
{.2ex}%x
{\color{myblue}\sffamily\small\bfseries}}
\renewcommand{\subsection}{\#startsection{subsection}{1}{0mm}%
{.2ex}%
{.2ex}%x
{\sffamily\bfseries}}
\def\multi#column#out{%
\ifnum\outputpenalty <-\#M
\speci#ls \else
\ifvoid\colbreak#box\else
\mult#info\#ne{Re-adding forced
break(s) for splitting}%
\setbox\#cclv\vbox{%
\unvbox\colbreak#box
\penalty-\#Mv\unvbox\#cclv}%
\fi
\splittopskip\topskip
\splitmaxdepth\maxdepth
\dimen#\#colroom
\divide\skip\footins\col#number
\ifvoid\footins \else
\leave#mult#footins
\fi
\let\ifshr#kingsaved\ifshr#king
\ifvbox \#kludgeins
\advance \dimen# -\ht\#kludgeins
\ifdim \wd\#kludgeins>\z#
\shr#nkingtrue
\fi
\fi
\process#cols\mult#gfirstbox{%
%%%%% START CHANGE
\ifnum\count#=\numexpr\mult#rightbox+2\relax
\setbox\count#\vsplit\#cclv to \dimexpr \dimen#-1cm\relax
\setbox\count#\vbox to \dimen#{\vbox to 1cm{\header}\unvbox\count#\vss}%
\else
\setbox\count#\vsplit\#cclv to \dimen#
\fi
%%%%% END CHANGE
\set#keptmarks
\setbox\count#
\vbox to\dimen#
{\unvbox\count#
\remove#discardable#items
\ifshr#nking\vfill\fi}%
}%
\setbox\mult#rightbox
\vsplit\#cclv to\dimen#
\set#keptmarks
\setbox\mult#rightbox\vbox to\dimen#
{\unvbox\mult#rightbox
\remove#discardable#items
\ifshr#nking\vfill\fi}%
\let\ifshr#king\ifshr#kingsaved
\ifvoid\#cclv \else
\unvbox\#cclv
\ifnum\outputpenalty=\#M
\else
\penalty\outputpenalty
\fi
\ifvoid\footins\else
\PackageWarning{multicol}%
{I moved some lines to
the next page.\MessageBreak
Footnotes on page
\thepage\space might be wrong}%
\fi
\ifnum \c#tracingmulticols>\thr##
\hrule\allowbreak \fi
\fi
\ifx\#empty\kept#firstmark
\let\firstmark\kept#topmark
\let\botmark\kept#topmark
\else
\let\firstmark\kept#firstmark
\let\botmark\kept#botmark
\fi
\let\topmark\kept#topmark
\mult#info\tw#
{Use kept top mark:\MessageBreak
\meaning\kept#topmark
\MessageBreak
Use kept first mark:\MessageBreak
\meaning\kept#firstmark
\MessageBreak
Use kept bot mark:\MessageBreak
\meaning\kept#botmark
\MessageBreak
Produce first mark:\MessageBreak
\meaning\firstmark
\MessageBreak
Produce bot mark:\MessageBreak
\meaning\botmark
\#gobbletwo}%
\setbox\#cclv\vbox{\unvbox\partial#page
\page#sofar}%
\#makecol\#outputpage
\global\let\kept#topmark\botmark
\global\let\kept#firstmark\#empty
\global\let\kept#botmark\#empty
\mult#info\tw#
{(Re)Init top mark:\MessageBreak
\meaning\kept#topmark
\#gobbletwo}%
\global\#colroom\#colht
\global \#mparbottom \z#
\process#deferreds
\#whilesw\if#fcolmade\fi{\#outputpage
\global\#colroom\#colht
\process#deferreds}%
\mult#info\#ne
{Colroom:\MessageBreak
\the\#colht\space
after float space removed
= \the\#colroom \#gobble}%
\set#mult#vsize \global
\fi}
\makeatother
\setlength{\parindent}{0pt}
\begin{document}
\small
\begin{multicols*}{5}
\input{section1}
\end{multicols*}
\end{document}
When you use the code copy the template and put your LaTeX code in external files like section1.tex, section2.tex,.... Than you can easily follow the normal structure inside these LaTeX files like
\section{Title of section 1}
\subsection*{Title of subsection 1}
Some text...
\subsection*{Title of subsection 2}
With some colored math $\sum_{i=1}^\infty i$.
Inserting an image also works:\\
\includegraphics[width=\linewidth]{yourimage.png}
After filling your sections you'll get a much compressed document which still looks good like this:
I've been making my own cheat sheets as well for various things. I really like how the Latex cheat sheet found here looks. I suggest grabbing the tex source and stealing some ideas from it :).
Consider using multicol.
And consider familiarizing yourself with CTAN. Most things TeX end up there sooner or later, though it does require some digging if you don't know what you're looking for.
Here is a beautiful example of a cheat sheet (is a booklet actually, not just a couple of pages).
http://clqr.boundp.org/index.html
It is made using LaTex. It summarizes all the symbols on the Common Lisp Standard. Maybe you can pick up one or two tips from the available LaTeX source.
I like how these cheat sheets look like:
http://michaelgoerz.net/refcards/
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}