How , to avoid vertical straight to overlap the others labels in LaTeX chronosys - time

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}

Related

Subfigures in latex never shrinks to be on one row (pfd file)

I'm trying to adjust two subfigures into one row. This is my code:
\begin{figure}[ht]
\centering
\caption{Migration rates and nightlights in Albania in 1992-1995}
\begin{subfigure}[a]{0.3\textwidth}
\caption{Emigration rate before 1995 at the municipality level}
\label{fig: migration_rate}
\includegraphics[width=\linewidth, trim = 5cm 0cm 5cm 0cm, clip]{Figures/migration_rate.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
\caption{Night luminosity in 1992}
\label{fig: nighlights}
\includegraphics[width=\linewidth, trim = 5cm 0cm 5cm 0cm, clip]{Figures/nightlight.pdf}
\end{subfigure}
\caption*{\footnotesize{\textbf{Notes}:}}.
\end{figure}
enter image description here
Even if I shrink the subfigure to tiny size (for example {0.01\textwidth}), the two always appear in one column. I have deep blank space on the left and right of both figures that I have tried to trim. Including or excluding "trim" does not change much.
How do I get the two into one row?
Thank you!

Generate equations with label in sharelatex

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}

Image numbering depending on the partition number in which the image is displayed

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}

Side comment between equation (LEFT)

I found the following page, which is almost what I want https://tex.stackexchange.com/questions/344379/side-comment-between-equation/344386#344386
Can someone explain me what change I have to do such that I can put this arrow on the left of my equation? Since this is what I have right now wrong arrow
Thanks in advance
You need to:
move the tikzmarks to the other side of the equations ;
invert the curve: .. controls +(-1,0) and +(-1,0) .. ;
readjust the starting positions: \newcommand\sidecomment[5][-0.5,0.1]% ;
move and align the text attached to the curve to the opposing side: node[left,align=right]{#5}.
Here's the result:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows,calc}
\usepackage{amsmath}
\newcommand\sidecomment[5][-0.5,0.1]%
{\begin{tikzpicture}[remember picture,overlay]
\draw[-stealth',thick]
($({pic cs:#4}|-{pic cs:#2})+(#1)$)
.. controls +(-1,0) and +(-1,0) ..
node[left,align=right]{#5}
($({pic cs:#4}|-{pic cs:#3})+(#1)$);
\end{tikzpicture}%
}
\begin{document}
\begin{align*}
\tikzmark{a}\beta_1^*
&= \frac{\sum_{i=1}^n(x_i^*-\hat x^*)y_i^*}{\sum_{i=1}^n(x_i^*-\hat x^*)^2}\\
\tikzmark{b}&= \frac{\sum_{i=1}^n(w_2x_i-w_2\hat x)w_1y_i}{\sum_{i=1}^n(w_2x_i-w_2\hat x)^2}
\end{align*}
\sidecomment{a}{b}{b}{since $y_i^*=w_1y_i$\\and $x_i*=w_2x_i$}
\end{document}

Adding a legend to a scatter plot with two sets of data

I plotted my data in the following way:
G=[(1.42*1e-5, 8.5*1e-2), (1.19*1e-5, 7.8*1e-2), (1.03*1e-5, 6*1e-2), (8.95*1e-6, 4.7*1e-2), (7.63*1e-6, 3.8*1e-2), (7.12*1e-6, 3.2*1e-2), (5.72*1e-6, 2.6*1e-2)]
PN=[5*1e3, 10*1e3, 20*1e3, 40*1e3, 80*1e3, 120*1e3, 200*1e3]
figure(5,figsize=(12,10))
for PNe, Ge, in zip(PN, G):
scatter([PNe]*len(Ge), Ge, color=['red', 'green'])
grid()
xlim(xmin=0, xmax=200000)
#ylim(ymin=0, ymax=1)
xlabel('Number of particles')
ylabel(r'Energy release rate')
legend(['$G_{simulation}$','$G_{analytical}$'])
and what I get as legend is the following: legend
As you see the colors are not attributed properly.
I need to assign red to G_{analytical} and green to G_{simulation}.
What am I doing wrong here?
Thanks
So here is the deal,
Simply changing the plot format to
Gs=[8.5*1e-2, 7.8*1e-2, 6*1e-2, 4.7*1e-2, 3.8*1e-2, 3.2*1e-2, 2.6*1e-2]
Ga=[1.42*1e-5, 1.19*1e-5, 1.03*1e-5, 8.95*1e-6, 7.63*1e-6, 7.12*1e-6, 5.72*1e-6]
PN=[5*1e3, 10*1e3, 20*1e3, 40*1e3, 80*1e3, 120*1e3, 200*1e3]
figure(5,figsize=(12,10))
scatter(PN, Gs, color='red', label='$G_{Simulation}$')
scatter(PN, Ga, color='green', label='$G_{Analytical}$')
grid()
xlim(xmin=0, xmax=200000)
#ylim(ymin=0, ymax=1)
xlabel('Number of particles')
ylabel(r'Energy release rate')
legend()
does the job.
Here is the result: Label with correct color assignment
There we go.

Resources