I have made the following equation in sharelatex:
\[ \frac{\delta u}{\delta x} + \frac{\delta v}{\delta y} = 0 \]
How can I automatically label this equation with a number?
I have the following before the beginning of my document. My code is a bit messy, but I hope it can show what the problem is that prevents equation from working.
How can I automatically label this equation with a number?
I have the following before the beginning of my document. My code is a bit messy, but I hope it can show what the problem is that prevents equation from working.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{nomencl}
\makenomenclature
\usepackage[english]{babel}
\usepackage[round]{natbib}
\usepackage{natbib}
\setcitestyle{square}
\usepackage[utf8]
\usepackage[table, svgnames, dvipsnames]{xcolor} %color row
\usepackage{makecell}
\renewcommand\theadfont{\normalsize}
\usepackage{caption}
\usepackage{siunitx}
\usepackage[justification=centering,font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[bottom]{footmisc}
\usepackage[margin=1.1in]{geometry}
\geometry{a4paper,total={170mm,257mm},left=22mm,right=22mm,top=30mm,bottom=20mm}
\usepackage{booktabs}
\usepackage[numbers]{natbib}
\usepackage{float}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\usepackage{blindtext}
\usepackage{color}
\usepackage{comment}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{footnote}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{hyperref}
\usepackage{lastpage}
\usepackage{listings}
\usepackage{longtable}
\usepackage{nomencl}
\usepackage{pifont}
\usepackage{subcaption}
\usepackage{subfiles}
\usepackage{tablefootnote}
\usepackage{times}
\usepackage{tikz}
\usepackage{watermark}
\usepackage{pdfpages}
\usepackage[pdftex]{graphicx}
\usepackage{graphicx,subcaption}
%for the tables
\usepackage[margin=1in,letterpaper]{geometry} % text block parameters
\usepackage{tabularx,siunitx,booktabs}
\usepackage[skip=0.5\baselineskip]{caption}
\usepackage{newtxtext,newtxmath}
\newcommand\mX[1]{\multicolumn{1}{X}{#1}} % handy shortcut macros
\newcommand\mcc[1]{\multicolumn{2}{c}{#1}}
\newcommand\mcl[1]{\multicolumn{2}{l}{#1}}\usepackage[margin=1in,letterpaper]{geometry} % text
\usepackage{multirow}
\graphicspath{{./Figures/}}
\setlength\parindent{0pt}
\usetikzlibrary{arrows,calc,positioning,shadows,shapes}
\newcommand{\cmark}{\textcolor{green!80!black}{\ding{51}}}
\newcommand{\xmark}{\textcolor{red}{\ding{55}}}
\usepackage{enumitem}%make indented dots
\usepackage{textcomp}
\usepackage{amsmath}
% Array commands, depends on \usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% Something with captions, depends on \usepackage{caption}
\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable}
% Front page settings depends on \usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Name}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{#{}c#{}}#2\end{tabular}}
\rhead{Project}
\renewcommand{\baselinestretch}{1.3} % Line spacing
% Color settings depends on \usepackage{color}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\begin{document}
I have tried several codes but nothing is working. Not even the equation option.
Thanks for help in advance!
There are several serve errors in your preamble. You must fix them, if you ignore them tex only syntax checks the rest of the document and you end up with something that might or might not be a valid pdf
you must not load the same package multiple times with different options. The log file will clearly tell you about the error because of an option clash. In your example this concerns geometry, graphicx and natbib
the line \usepackage[utf8] is an syntax error. You must give a package name, not just an option
many other packages are loaded multiple times and some of the options are outdated, you should take a bit of time and clean up this preamble
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{nomencl}
\makenomenclature
\usepackage[english]{babel}
\usepackage[round]{natbib}
%\usepackage{natbib}
\setcitestyle{square}
%\usepackage[utf8]
\usepackage[table, svgnames, dvipsnames]{xcolor} %color row
\usepackage{makecell}
\renewcommand\theadfont{\normalsize}
\usepackage{caption}
\usepackage{siunitx}
\usepackage[justification=centering,font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[bottom]{footmisc}
\usepackage[margin=1.1in]{geometry}
\geometry{a4paper,total={170mm,257mm},left=22mm,right=22mm,top=30mm,bottom=20mm}
\usepackage{booktabs}
%\usepackage[numbers]{natbib}
\usepackage{float}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\usepackage{blindtext}
\usepackage{color}
\usepackage{comment}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{footnote}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{hyperref}
\usepackage{lastpage}
\usepackage{listings}
\usepackage{longtable}
\usepackage{nomencl}
\usepackage{pifont}
\usepackage{subcaption}
\usepackage{subfiles}
\usepackage{tablefootnote}
\usepackage{times}
\usepackage{tikz}
\usepackage{watermark}
\usepackage{pdfpages}
%\usepackage[pdftex]{graphicx}
%\usepackage{graphicx,subcaption}
%for the tables
%\usepackage[margin=1in,letterpaper]{geometry} % text block parameters
\usepackage{tabularx,siunitx,booktabs}
\usepackage[skip=0.5\baselineskip]{caption}
\usepackage{newtxtext,newtxmath}
\newcommand\mX[1]{\multicolumn{1}{X}{#1}} % handy shortcut macros
\newcommand\mcc[1]{\multicolumn{2}{c}{#1}}
\newcommand\mcl[1]{\multicolumn{2}{l}{#1}}
%\usepackage[margin=1in,letterpaper]{geometry} % text
\usepackage{multirow}
\graphicspath{{./Figures/}}
\setlength\parindent{0pt}
\usetikzlibrary{arrows,calc,positioning,shadows,shapes}
\newcommand{\cmark}{\textcolor{green!80!black}{\ding{51}}}
\newcommand{\xmark}{\textcolor{red}{\ding{55}}}
\usepackage{enumitem}%make indented dots
\usepackage{textcomp}
\usepackage{amsmath}
% Array commands, depends on \usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% Something with captions, depends on \usepackage{caption}
\DeclareCaptionLabelFormat{andtable}{#1~#2 \& \tablename~\thetable}
% Front page settings depends on \usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Name}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{#{}c#{}}#2\end{tabular}}
\rhead{Project}
\renewcommand{\baselinestretch}{1.3} % Line spacing
% Color settings depends on \usepackage{color}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\begin{document}
\begin{equation}
\frac{\delta u}{\delta x} + \frac{\delta v}{\delta y} = 0
\end{equation}
\end{document}
Related
I´m trying to follow the documentation of chronosys LaTeX package, to solve my issue to avoid vertical straight to overlap the others labels, but I cannot go ahead!
My code in LaTeX is:
\documentclass[a4paper,12pt]{article}
\usepackage{chronology}
\usepackage{chronosys}
\begin{document}
\startchronology[startyear=1980]
\chronoevent{1982}{\rotatebox{90}{\textbf{ARCH} $\Rightarrow$ \newline Robert Engle~\cite{engle}}}
\chronoevent[markdepth=50pt, ifcolorbox = true, colorbox = white]{1986}{\rotatebox{90}{\textbf{GARCH} $\Rightarrow$ \textit{Tim Bollerslev}~\cite{bollerslev}}}
\chronoevent[markdepth=250pt]{1986}{\rotatebox{90}{\textbf{IGARCH} $\Rightarrow$ \textit{Tim Bollerslev e R. Engle}~\cite{englebollerslev}}}
\stopchronology
\end{document}
That is the result:
I tryed to insert colorbox=white, but I don´t know if I am is in the correct way...
Change the order of the events, so you won't draw the bottom even on top of the other:
\documentclass[a4paper,12pt]{article}
%\usepackage{chronology}
\usepackage{chronosys}
\begin{document}
\startchronology[startyear=1980]
\chronoevent{1982}{\rotatebox{90}{\textbf{ARCH} $\Rightarrow$ \newline Robert Engle~\cite{engle}}}
\chronoevent[markdepth=250pt]{1986}{\rotatebox{90}{\textbf{IGARCH} $\Rightarrow$ \textit{Tim Bollerslev e R. Engle}~\cite{englebollerslev}}}
\chronoevent[markdepth=50pt]{1986}{\rotatebox{90}{\textbf{GARCH} $\Rightarrow$ \textit{Tim Bollerslev}~\cite{bollerslev}}}
\stopchronology
\end{document}
I have images inside a figures folder for my thesis. When I use the \includegraphics[]{} command in my chapterX.tex file, the image just won't appear (in normal mode, fast mode, or in the downloaded PDF). They seem to scale, but just won't appear.
I've tried using the graphicsx and graphics packages, but neither work.
\documentclass[
10pt,
english,
singlespacing,
draft,
parindent 20mm
headsepline,
chapterinoneline,
]{MastersDoctoralThesis}
\usepackage[utf8]{inputenc}
\usepackage{ctable}
\usepackage[T1]{fontenc}
\usepackage{minitoc}
\setcounter{minitocdepth}{2}
\setlength{\mtcindent}{24pt}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
\usepackage{enumitem}
\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\usepackage{graphicx} % Required for including images
\graphicspath{{figures/}} % Location of the graphics files
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=3cm, % Inner margin
outer=3cm, % Outer margin
%bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
%showframe, % Uncomment to show how the type block is set on the page
}
\begin{document}
\chapter{Conceptual framework}
\label{Chapter3}
\minitoc
\section{Introduction}
Below is Jackendoff's parallel architecture.
\includegraphics{figures/jackendoffpa.jpeg}
You need to remove the draft option to see your images:
\documentclass[
10pt,
english,
singlespacing,
%draft,
parindent 20mm
headsepline,
chapterinoneline,
]{MastersDoctoralThesis}
\usepackage[utf8]{inputenc}
\usepackage{ctable}
\usepackage[T1]{fontenc}
\usepackage{minitoc}
\setcounter{minitocdepth}{2}
\setlength{\mtcindent}{24pt}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
\usepackage{enumitem}
\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
\usepackage{graphicx} % Required for including images
\graphicspath{{figures/}} % Location of the graphics files
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=3cm, % Inner margin
outer=3cm, % Outer margin
%bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
%showframe, % Uncomment to show how the type block is set on the page
}
\begin{document}
\chapter{Conceptual framework}
\label{Chapter3}
\minitoc
\section{Introduction}
Below is Jackendoff's parallel architecture.
\includegraphics{jackendoffpa}
\end{document}
How can I make captions under images in Fig. 1.1:, Fig. 1.2:, Fig. 2.1:, Fig. 2.2: depending on the section number and not just sequentially from 1 for all images in the article
For example code:
\begin{figure}[htbp]
\minipage{0.32\textwidth}
\centering\includegraphics[width=\linewidth]{images/1.png}
\caption{caption 1}\label{Fig_1}
\endminipage\hfill
\minipage{0.32\textwidth}%
\centering\includegraphics[width=\linewidth]{images/2.png}
\caption{caption 2}\label{Fig_2}
\endminipage\hfill
\minipage{0.32\textwidth}%
\centering\includegraphics[width=\linewidth]{images/3.png}
\caption{caption 3}\label{Fig_3}
\endminipage
\end{figure}
Without any additional packages, latex itself provides the macro \counterwithin which allows to number the figures on a per section basis:
\documentclass{article}
\usepackage{graphicx}
\counterwithin{figure}{section}
\begin{document}
\section{title}
\begin{figure}[htbp]
\begin{minipage}{0.32\textwidth}
% \centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{caption 1}
\label{Fig_1}
\end{minipage}
\hfill
\begin{minipage}{0.32\textwidth}%
% \centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{caption 2}
\label{Fig_2}
\end{minipage}
\hfill
\begin{minipage}{0.32\textwidth}%
% \centering
\includegraphics[width=\linewidth]{example-image-duck}
\caption{caption 3}
\label{Fig_3}
\end{minipage}
\end{figure}
\end{document}
(\centering is not necessary if the images already have the same width as the minipage)
There is an answer to this question in tex.stackechange https://tex.stackexchange.com/questions/28333/continuous-v-per-chapter-section-numbering-of-figures-tables-and-other-docume
It redefines counters with the chngcntr package.
But in my opinion, the simpler is to use the floatpackage. It allows to redefine floating environments, with a specific graphic appearance, position, etc, and numbering scheme.
\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
% We define a new float environment called image.
% htbp means 'images' will be positioned preferably here, then at top, bottom or
% on a new page
% info on labels will go to file xx.lim (list of images)
% and it will numbered within sections
\newfloat{image}{htbp}{lim}[section]
% and we want 'Fig.' to appear on the caption
\floatname{image}{Fig.}
\begin{document}
\section{A first section}
blah blah. Look at image \ref{im1}. blah blah
\begin{image}
\centering
\includegraphics[width=3cm]{example-image}
\caption{An image}\label{im1}
\end{image}
\section{A second section}
blah blah. And now consider images \ref{im2} and \ref{im3}. blah blah
\begin{image}
\centering
\hfill\includegraphics[width=3cm]{example-image}\hfill\includegraphics[width=3cm]{example-image}\hfill\includegraphics[width=3cm]{example-image}\hfill
\caption{Now a bunch with several images}\label{im2}
\end{image}
blah blah
\begin{image}
\centering
\begin{tabular}{cc}
\includegraphics[width=3cm]{example-image} &\includegraphics[width=3cm]{example-image}\\
Image A&Image B
\end{tabular}
\caption{And two last images}\label{im3}
\end{image}
\end{document}
If you have several images in a fig, just place them as any text. In TeX, images are considered as (large) characters and the standard positioning methods apply. In the first example, I used \hfill to spread them evenly on a line, and in the second a tabular to include small comments on the images. But many other methods, like minipages, can be used. But if your image set is too long to fit on a line, unwanted line breaks may appear.
Unrelated, but any people use the float package because it also defines a new placement directive 'H' that means more or less 'place the float Here and nowhere else'. And modifying the graphics appearance of floats is also very useful.
Here is another solution without the float package
\documentclass{article}
\usepackage{graphicx}
\usepackage{chngcntr}
% change counter numbering
\counterwithin{figure}{section}
\begin{document}
\section{A first section}
blah blah. Look at images \ref{im1}, \ref{im2} and \ref{im3}. blah blah
\begin{figure}[h]
\begin{minipage}{0.3\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{image 1}\label{im1}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{image 2}\label{im2}
\end{minipage}
\hfill
\begin{minipage}{0.3\linewidth}
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{image 3}\label{im3}
\end{minipage}
\centering
\end{figure}
\end{document}
I have a large Beamer file with many frames. Based on the presentation purpose, I want to include/exclude certain slides from the presentation. Is there a way to define the frames at the end of the document and call them up when wanted? Something like the following:
\documentclass{beamer}
\begin{document}
% including the frames
\include{F1}
\include{F2}
% \include{F3}
\include{F4}
% frame definitions
\begin{frame}[F1]
1
\end{frame}
\begin{frame}[F2]
2
\end{frame}
\begin{frame}[F3]
3
\end{frame}
\begin{frame}[F4]
4
\end{frame}
\end{document}
I know that I can go frame by frame and add <beamer:0> to exclude that frame, but since the presentation is too long it would be great if I had the possibility to do as above.
This is exactly what the \includeonlyframes command is made for:
\documentclass{beamer}
\includeonlyframes{%
F1,%
F2,%
%F3,%
F4,%
}
\begin{document}
\begin{frame}[label=F1]
1
\end{frame}
\begin{frame}[label=F2]
2
\end{frame}
\begin{frame}[label=F3]
3
\end{frame}
\begin{frame}[label=F4]
4
\end{frame}
\end{document}
I don't really consider the following very pretty, but you could define a \newcommand unique for each frame, where the command simply translates to a single value, 0 (excluded) or 1 (included). E.g.
\newcommand{\includeFrameA}{0} % exclude frame
\newcommand{\includeFrameB}{1} % include frame
Then, using a help command
\newcommand{\includeFrame}[1]{beamer:#1}
you can define your frames with the addition of <\includeFrame{\includeFrameX}> to the frame environment signature; in so including/excluding the frame depending on the value of \includeFrameX as specified in the header of your document.
The following example excludes frames "A" and "C", and the produced presentation includes only two pages, containing "B" and "D", respectively.
\documentclass{beamer}
\newcommand{\includeFrame}[1]{beamer:#1}
% one command per frame, 0/1 : exclude/include
\newcommand{\includeFrameA}{0}
\newcommand{\includeFrameB}{1}
\newcommand{\includeFrameC}{0}
\newcommand{\includeFrameD}{1}
\begin{document}
% frame definitions
\begin{frame}<\includeFrame{\includeFrameA}>
A
\end{frame}
\begin{frame}<\includeFrame{\includeFrameB}>
B
\end{frame}
\begin{frame}<\includeFrame{\includeFrameC}>
C
\end{frame}
\begin{frame}<\includeFrame{\includeFrameD}>
D
\end{frame}
\end{document}
I'm trying to use the answers I found in these questions:
How to save a plot into a PDF file without a large margin around
Get rid of the white space around matlab figure's pdf output
External source
to print a matlab plot to pdf without having the white margins included.
However using this code:
function saveTightFigure( h, outfilename, orientation )
% SAVETIGHTFIGURE(H,OUTFILENAME) Saves figure H in file OUTFILENAME without
% the white space around it.
%
% by ``a grad student"
% http://tipstrickshowtos.blogspot.com/2010/08/how-to-get-rid-of-white-margin-in.html
% get the current axes
ax = get(h, 'CurrentAxes');
% make it tight
ti = get(ax,'TightInset');
set(ax,'Position',[ti(1) ti(2) 1-ti(3)-ti(1) 1-ti(4)-ti(2)]);
% adjust the papersize
set(ax,'units','centimeters');
pos = get(ax,'Position');
ti = get(ax,'TightInset');
set(h, 'PaperUnits','centimeters');
set(h, 'PaperSize', [pos(3)+ti(1)+ti(3) pos(4)+ti(2)+ti(4)]);
set(h, 'PaperPositionMode', 'manual');
set(h, 'PaperPosition',[0 0 pos(3)+ti(1)+ti(3) pos(4)+ti(2)+ti(4)]);
% save it
%saveas(h,outfilename);
if( orientation == 1)
orient portrait
else
orient landscape
end
print( '-dpdf', outfilename );
end
Results in this output:
As you can see the 'PaperSize' seems to be set not properly. Any idea of possible fixes?
NOTE
If I change the orientation between landscape and portrait the result is the same, simply the image is chopped in a different way.
However if I save the image with the saveas(h,outfilename); instruction the correct output is produced.
Why is this? And what is the difference between the two saving instructions?
Alltogether the answers you mentioned offer a lot of approaches, but most of them didn't worked for me neither. Most of them screw up your papersize when you want to get the tight inset, the only which worked for me was:
set(axes_handle,'LooseInset',get(axes_handle,'TightInset'));
I finally wrote a function, where I specify the exact height and width of the output figure on paper, and the margin I want (or just set it to zero). Be aware that you also need to pass the axis handle. Maybe this functions works for you also.
function saveFigure( fig_handle, axes_handle, name , height , width , margin)
set(axes_handle,'LooseInset',get(axes_handle,'TightInset'));
set(fig_handle, 'Units','centimeters','PaperUnits','centimeters')
% the last two parameters of 'Position' define the figure size
set(fig_handle,'Position',[-margin -margin width height],...
'PaperPosition',[0 0 width+margin height+margin],...
'PaperSize',[width+margin height+margin],...
'PaperPositionMode','auto',...
'InvertHardcopy', 'on',...
'Renderer','painters'... %recommended if there are no alphamaps
);
saveas(fig_handle,name,'pdf')
end
Edit: if you use painters as renderer saveas and print should produce similar results. For jpegs print is preferable as you can specify the resolution.