Adding text after subfigures in Latex - latex

I am writing my master thesis in Latex and I am getting the following error. I am adding three subplots and then some text but I am having the issue where the text does not come after the images but before. Here is my code:
\begin{figure}[hbt!]
\centering
\subfloat[Absolute correlations of initial states in case A]{\includegraphics[width=0.7\textwidth]{Images/Results/correlation_best.png}}
\subfloat[Absolute correlations of initial states of Callisto and Jupiter in case B]{\includegraphics[width=0.7\textwidth]{Images/Results/correlations_vlbi.png}}
\subfloat[Absolute correlations of initial states of Callisto and Jupiter in case C]{\includegraphics[width=0.7\textwidth]{Images/Results/correlations_worst.png}}
\caption{Absolute correlations for Callisto and Jupiter}
\end{figure}
We highlight case B and case C
Here you can find attached the issue I am getting.

Related

Add a custom word to a cross reference in LaTex

Good morning!
I've been searching for a time but I can't reach a solution to my problem. I'm writing my master thesis, and I want to add custom words to my references, I mean, if I want to ref the only table in my document (\label{table:test} for example), I usually do \ref{table:test}, getting as a result just a clickable number 1.
However, I need to set a global option in order to, always I refer to a table, for example, I get {custom word} 1(1 for the first table). This custom word surely will be Table, but I can desire to use Figure(in English) or Imagen (in spanish), for ref figures.
Thanks you very much in advance!
The cleveref package will automatically add the correct words and adapt to the language of your document:
\documentclass[spanish]{article}
\usepackage{babel}
\usepackage{hyperref}
\usepackage[noabbrev,nameinlink]{cleveref}
\begin{document}
\begin{figure}
\caption{content...}
\label{key}
\end{figure}
\cref{key}
\end{document}

Latex/Miktex: Undefined citations

I am writing a latex script for my work, and I am having infinite trouble in getting the references in the PDF. My code is shown below, and I am using MikTex 2.9 on RStudio. Some background information that might be relevant:
I am using Mendeley for my references, which I have set up correctly (as it seems) to Enable bibtex syncing
The .bib file doesn't seem to look strange to me (Irungu is added below)
I am using the exact same script as my colleagues (apart from the different path referring to my articles), and they are having no issues compiling it into pdf.
The errors regarding citations are:
Citation Draganovic2013 on page 1 undefined on input line xx
Citation Irungu2019 on page 1 undefined on input line xx
There were undefined citations
I hope one of you is able to help me out!
Cheers!
#article{Irungu2019,
abstract = {A composite blend consisting of sunflower cake, maize germ, wheat bran, fresh water shrimps and cassava flour was extruded using a single-screw extruder to produce expanded fish feed pellets. The effects of temperature (80–120 °C), die diameter (2–4 mm), and feed pre-conditioning time (50–150 s; steam 400 kPa) on properties of the pellets (expansion ratio, bulk density, floatability, durability, water absorption, water solubility, water stability, and in-vitro protein digestibility) were investigated using response surface methodology. Regression equations describing the effect of each variable on the product responses were obtained. The pellets extruded using a factor combination of 120 °C extruder barrel temperature, 2 mm die diameter, and 100 s of feed pre-conditioning time gave most desirable pellet floatability (100{\%}), durability index (99{\%}), expansion ratio (2.64), water absorption index (4.12), water solubility index (9.31), water stability (87{\%}), bulk density (479 g/L), and in vitro protein digestibility (69.97{\%}) with a composite desirability of 0.88. Practical applications: Extrusion is a modern feed processing method whose use is fast gaining popularity among small feed processors in developing countries. However, extrusion is a process that involves many parameters that need to be optimized for desirable end properties. These findings guide fish feed manufacturers on the optimum conditions for single screw extruders for production of feeds with desirable properties especially for the fish types that are top feeders. In addition, the results offer important insights on how temperature, die diameter, and feed pre-conditioning, may be manipulated to influence properties of extruded aquafeed when using simple low-cost small-scale extruders.},
author = {Irungu, Francis Gichuho and Mutungi, Christopher and Faraj, Abdul and Affognon, Hippolyte and Ekesi, Sunday and Nakimbugwe, Dorothy and Fiaboe, Komi K.M.},
doi = {10.1111/jfpe.12980},
file = {:L$\backslash$:/Marjanne/ScientificArticles/Irungu2019.pdf:pdf},
issn = {17454530},
journal = {Journal of Food Process Engineering},
number = {2},
pages = {1--12},
title = {{Optimization of extruder cooking conditions for the manufacture of fish feeds using response surface methodology}},
volume = {42},
year = {2019}
}
\documentclass[10pt,a4paper]{article}
\usepackage{etoolbox}
\usepackage{mathpazo}
\renewcommand{\sfdefault}{lmss}
\renewcommand{\ttdefault}{lmtt}
\usepackage{geometry}
\usepackage[usenames,dvipsnames]{xcolor}
% \geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2.5cm,rmargin=2.5cm}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage[margin=10pt,font=small,labelfont=bf,labelsep=colon]{caption}
\usepackage{amstext}
%% \usepackage{esint}
\usepackage[english]{babel}
\usepackage{eurosym}
\usepackage{booktabs}
\usepackage[parfill]{parskip}
\usepackage[round]{natbib}
%\usepackage{caption}
\usepackage{pdfpages}
\usepackage[figuresright]{rotating}
\usepackage{longtable}
\usepackage[version=4]{mhchem}
\usepackage{todonotes}
\usepackage{hyperref}
\usepackage{subfig}
\usepackage{array}
\usepackage{float}
\usepackage{lipsum}
\usepackage{lastpage}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes.geometric}
\usepackage{textcomp}
\begin{document}
\title[Title of Document]
\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}
\section {Introduction}
Introduction is written here, but not relevant for this question.
\section {Background}
Here I write some text and refer to an article of Draganovic from 2013 \citep{Draganovic2013}. \\
In another section, I would like to refer to Irungu from 2019 \citep{Irungu2019}.\\
Current project will investigate the possibilities to re-evaluate Sustainable Fiber Technology's Wheat Straw Co-Product, by using it as a (partial) replacement of wheat gluten and/or starch in aquafeed. Being relatively high in lignin (20 - 40\% based on 30 - 50\% solids), the product is a potential excellent binder.
\section {Rest of the document}
Doesn't pose any significant errors.
\bibliographystyle{plainnat}
\bibliography{C://Users/Marjanne/Documents/April8/library}
\end{document}
I have not any problems with this LaTeX code (even if I use a Mac): there are anyway a couple of problems within your code:
The title is given as \title[Title of Document] and not as \title{Title of Document}
There are 2 \begin{document}: I do not know if this is just a typo when you copied your code here
Are you sure that the path of your .bib file is correct? I suggest to write just \bibliography{library} and put the library.bib file in the same directory of the tex file on which you are working on.
Moreover, have a look also at https://tex.stackexchange.com/ for questions about Tex, LaTeX.
EDIT: Make sure that you are compling your tex files with
pdflatex (or latex)
bibtex
pdflatex (or latex)
pdflatex (or latex)
run first pdflatex "file" -interaction=nonstopmode
then
biber "file"
then again
pdflatex "file" -interaction=nonstopmode
Should work
Even though the correct reference/citation was called from the bib file, the output generated a question mark in some cases. After making sure all files ended with .tex separately and in the main + checking if the reference file had a .bib extension, it worked however. In one case, simply renaming a file seemed to do the job.

Equation not displayed in latex

The equation below does not display in latex. Also, the introductory text does not display properly(all words together without space and in italics)
A common form of this potential is the 12-6 Lennard Jones (LJ) potential
expressed as equation 2.7
\begin{align}
U_{ij}= 4\epsilon_{ij}[(\frac{\sigma_{ij}}{r_{ij})^12-
(\frac{\sigma_{ij}}{r_{ij})^6]
\end{align}
Also, in the text below, all words are together without space and in italics.
Where \epsilon_{ij} and \sigma{ij} represent well depth and diameter of
the atom respectively. \epsilon_{ij} and \sigma_{ij} for unlike atoms
are determined using Lorentz-Berthelot combination rules [44] given in
equations 2.8 and 2.9
Your help is appreciated.
I attach here a picture of the output.
This is because you're not using inline math mode properly. In the image you posted
it shows that your text is preceded by (what looks like) \epsilon_{ij}. \epsilon requires a math font, and therefore you should use $\epsilon_{ij}$. The same goes for any inline math you want to typeset. This would be the suggested/proper coding:
A common form of this potential is the 12-6 Lennard Jones (LJ) potential
expressed as equation~\eqref{eq:lj-potential},
\begin{equation}
U_{ij} = 4 \epsilon_{ij} [ (\frac{\sigma_{ij}}{r_{ij})^{12}
- (\frac{\sigma_{ij}}{r_{ij})^6 ] \label{eq:lj-potential}
\end{equation}
where $\epsilon_{ij}$ and $\sigma{ij}$ represent well depth and diameter of
the atom respectively. $\epsilon_{ij}$ and $\sigma_{ij}$ for unlike atoms
are determined using Lorentz-Berthelot combination rules~\cite{lorentz-berthelot}
given in equations~\eqref{eq:epsilon} and~\eqref{eq:sigma}.
Note the following:
Use equation for a single-line numbered equation; align is for multi-line equations (that may require alignment).
No blank line (paragraph break) before equation.
Use \labels and \refs (or \eqref, since you're using amsmath) since equation numbers can change. Let TeX take care of storing and recalling these numbers.
Use \cite to reference something in a bibliography.
Use $...$ (or \(...\)) for inline math (already discussed above).
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
U_{ij}= 4\epsilon_{ij}[
(\frac{
\sigma_{ij}
}{
(r_{ij})^{12} -
\frac{
\sigma_{ij}
}{(r_{ij})^6
}
}]
\end{align}
\end{document}
three groups were not closed properly in the equation.
Read about amsmath package.
I suggest you try to write as clean as possible.
Output

Extracting code from beamer presentation?

Some years ago I created a Beamer presentation (using only basic features). Unfortunetaly, I've lost the source code but still have the output PDF. Is there a convenient way to extract the original code from the presentation? Simple copy methods does not handle the mathematics well.
No, I don't think it is possible to do that. LaTeX is a typesetting language, in which you say "put a section here, this text here, some formulae here, etc., and use this style file to weight the fonts and spacing" and then compile it to PDF. The PDF document tells the PDF viewer (loosely speaking): "here's the font, place these sets of characters at these places in the document". It has no notion of section/heading/figure/equation/equation number etc.
It would be very hard to do PDF->LaTeX because of the multiple possibilities. i.e., LaTeX->PDF is a many-to-one function, so the inverse operation is going to have ambiguities.
For e.g., here's a test file using two different methods:
\documentclass{article}
\begin{document}
This is a StackOverflow test file.
\section{Method A}
\begin{equation}
ax^2+bx+c=0
\end{equation}
\end{document}
\documentclass{article}
\begin{document}
This is a StackOverflow test file.\\[0.1in]
\noindent {\Large \textbf{1\quad Method B}}
\begin{center}
$\displaystyle ax^2+bx+c=0$
\end{center}
\vspace{-0.25in}
\hfill{(1)}
\end{document}
You can see that you can't tell the two documents apart. A PDF to LaTeX converter will face the same problems.
That said, some word processing applications (open office?) can interpret PDF documents (usually only if all text) and convert it to a word document, and then you can convert that into LaTeX (usually provided by the same application). This might be one option worth trying. Other than that, there is no software that I know of that will do this for you.

Three columns frame in a big document and renaming stuff in latex

I'm just learning latex, so this may be trivial to some of you.
I went through a few tutorials but they all seem to cover the same things.
I'm writing a big report - calculation all the way (and it has to be neat, because it's part of the documentation). It consists of a frame around the page (15mm margins), and 3 columns inside it: in the left column (3cm wide) are references from where the equation came from (e.g. "ABS 3-2-7"), in the middle is the calculation and in the right is the accepted value (5cm wide). It is a standard way of doing things, so I don't have a choice over the layout.
Now, I don't understand, how would I go in creating such layout ? The frame with columns has to appear on every page. How to accomplish that ?
I've never seen such a document so I'm not sure how to ease the creation.
And second, how do I rename things that are in english language in document classes ? For example, "article" class, I have "References" and I need to have "Literatura".
Is there a way to rename it without touching .cls file?
For your first problem, look at the longtable package (available at ctan.org if you haven't already got it installed)
The problem with using tabular is it won't work as you want across pages.
As far as the second problem, it will depend on the environment and the document type, but typically you'll have to renew a command.
For example, add to the preamble \renewcommand\refname{Literatura} for the article class to do what you were asking for. If I recall correctly it is bibname for books.
Table design in LaTeX has not been made very easy. I would use tabbing rather than tabular and draw the lines manually to keep things simple. A downside is that you don't get any automatic sizing of the table cells, but since your format is fixed, I would consider it a good thing (i.e., if text overflows, you notice it and get to fix it yourself, and your table doesn't accidentally get stretched into the margins). If you use multiple tables like this in your document, try packaging the commands with \newenvironment.
\documentclass{article}
\usepackage[margin=15mm]{geometry}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\tableheight}
\setlength{\tableheight}{20cm} % how high to draw the lines of the table
\newlength{\rulethickness}
\setlength{\rulethickness}{1pt} % how thick lines to draw
\newcommand{\verticalline}{\smash{\rule[-\tableheight]{\rulethickness}{\tableheight}}}
\newlength{\myindent}
\setlength{\myindent}{3mm} % how much to indent each column
\newlength{\leftcolumn}
\setlength{\leftcolumn}{3cm-\myindent}
\newlength{\midcolumn}
\setlength{\midcolumn}{\textwidth-3cm-5cm-\myindent-\rulethickness}
\newlength{\rightcolumn}
\setlength{\rightcolumn}{5cm-\myindent}
\begin{document}
\begin{tabbing}
% first set the tab stops
\hspace*{\myindent}\=\hspace{\leftcolumn}\=%
\hspace{\myindent}\=\hspace{\midcolumn}\=%
\hspace{\myindent}\=\hspace{\rightcolumn}\=\kill
% then draw the lines
\rule{\textwidth}{\rulethickness}\\[-\baselineskip]
\smash{\rule[-\tableheight]{\textwidth}{\rulethickness}}\\[-\baselineskip]
\verticalline\>\>\verticalline\>\>\verticalline\>\>\verticalline\\
% Now start the table: indent the first column with \>
\>ABS 3--2--7
% ... and each additional column with \>\>
\>\> $\iint_{-\infty,-\infty}^{\infty,\infty} e^{-x^2-y^2}\, dx\,dy$
\>\> 2.507
% End each line with \\, add e.g. [2pt] to get 2pt extra space if required
\\[2pt]
% here's another line:
\>ABS 3--2--8 \>\> $\displaystyle\sum_{k=0}^n k^2$ \>\> $\frac12 n(n+1)$ \\
% etc. Be careful not to overflow the table - there's no automatic check for that.
\end{tabbing}
\newpage % also remember to start a new page after the table
\end{document}
To change the fixed names, see this FAQ, or possibly this one if you are using babel.
In this case you probably want to use the tabular environment to generate the three columns (or as simon notes longtable if your report-thingy runs longer than one page). Something like:
\framebox{
\centering
\begin{tabular}{p{3cm}|p{\specialwidth}|p{5cm}}
Ref 1-0-0 & 1.2345 & 1.2346 \\
Ref 1-0-1 & 2.3456 & 2.3454 \\
...
\end{tabular}
}
You'll note that I've used paragraph formatted columns (the p{<length>} formatting specifiers), and stuck a frame around it with \framebox.
You can either compute \specialwidth by hand, or calculate it:
\newlength{\specialwidth}
\setlength{\specialwidth}{\textwidth}
\addtolength{\specialwidth}{-10cm} % extra room for the seperators...
I can't help you on the internationalization issue...

Resources