Text inside of align environment - math

I am currently facing a small problem inside of align environment, which is the the space between words. As you can see in the following figure, the words are close to each other, and the space that is mentioned in the code, are not considered inside of align environment. I would like to know how can I solve this problem and make words more clear like the ones we tend to see in paragraphs.
enter image description here
Here is the code of the mathematic Presentation mentioned above.
\documentclass[a4paper,12pt]{report}
\usepackage[french]{babel}
\usepackage[export]{adjustbox}
\usepackage{enumitem}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{caption}
\usepackage{booktabs, multirow}
\usepackage{soul}
\usepackage[table]{xcolor}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\begin{align*}
{\displaystyle \gamma_{b} = \quad \left\{{\begin{array}{l} 1.5 \quad (Situation Durable ou Transitoire) \\ 1.15 \quad ( Situation Accidentelle) \end{array}}\right.}
\end{align*}
\end{document}

Related

Bibliographystyle {unsrt} fails to sort citations properly

I'm importing my references from Mendeley under 'references.bib'. I want to sort them to match the order in which the citations are used. Adding 'unsrt' as the bibliographystyle doesn't change anything however... Any tips on why this is the case? Here's the content of the .tex file:
\documentclass[whitelogo,table]{tu-report}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage[sort&compress,numbers]{natbib}
\usepackage{changes}
\usepackage{float}
\usepackage{enumerate}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dirtytalk}
\usepackage{pdfpages}
\usepackage{multirow}
\usepackage{romannum}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{todonotes}
\usepackage{longtable}
\usepackage{microtype}
\usepackage{wrapfig,lipsum,booktabs}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{pdfpages}
\usepackage[toc,page]{appendix}
\usepackage{etoolbox}
\apptocmd{\sloppy}{\hbadness 10000\relax}{}{}
\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{fourier, heuristica}
\usepackage{array, booktabs}
\usepackage{caption}
\usepackage[flushleft]{threeparttable}
\usepackage{outlines}
\interfootnotelinepenalty=10000 %% Completely prevent breaking of footnotes
\raggedbottom
\usepackage{rotating}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage[toc, acronym, nonumberlist]{glossaries}
\makenoidxglossaries
\bibliographystyle{unsrt}
\input{001Acronyms}
\begin{document}
\input{_01title}
\input{_02preface}
\input{_03Abstract}
\tableofcontents
\printnoidxglossaries
\mainmatter
\input{01introduction}
\input{02materialsandmethods}
\input{03results}
\input{04discussion}
\input{05conclusion}
\appendix
\input{06appendix}
\bibliography{references}
\end{document}
Typically this is caused by having citations within figure or table captions. The bad numbering is caused by the fact that the first occurrence of the citations end up being in the list of figures or the list of tables, instead of where you are expecting them to occur.
The solution is to provide a short optional caption to be used in the LOF or LOT that does not include the citation: \caption[My caption]{My caption \cite{foo}}.
However, there's no way to know for sure if this is indeed the problem without a more complete example.
See for example: https://tex.stackexchange.com/questions/552054/citation-order-is-corrupted-by-figures-and-tables

Implementing R code in a LaTeX document with Sweave. Characters like é and è won't display correcty

I always use the bable (french) package and it works fine when one Overleaf or MiKTex. However, when copy pasting my code to Rstudio (with Sweave etc), it just does not work properly.
Document with "é" when done with Sweave
Same document (code copy pasted) on MiKTex
I have following packages:
\documentclass[a4paper, parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tensor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[abbrev,backrefs]{amsrefs}
\usepackage{appendix}
Since I don't know much about Rstudio, I don't know what information you need about it. I will provide more info when asked for.
I followed a simple tutorial on youtube to get sweave working.
Thank you.
Edit:
Here is a minimal document.
(not sure how to link the whole pdf)
The code in Rstudio (Sweave) is following:
\documentclass[a4paper, parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{array}
\usepackage{tensor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[abbrev,backrefs]{amsrefs}
\usepackage{appendix}
\title{Année académique}
\date{}
\begin{document}
\SweaveOpts{concordance=TRUE}
\maketitle
This is a sentence with the characters é and è.
\end{document}

kable function with encoding (polish signs) in R

I use knitr::kable function to dynamicly print tables in pdf with latex.
the problem is that in the table there are polish signs, which are encoded for example:
'Galeria Mokotów' is encoded into 'Galeria MokotĂłw' and my '.Rnw' file fails.
how should I change the preamble to fix pdf printing?
\documentclass[10pt,a4paper]{res}
\usepackage{helvet}
\usepackage[cp1250]{inputenc}
\usepackage{fontenc}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage[pdfstartview=FitB]{hyperref}
\usepackage{float}
\usepackage{polski}
\usepackage{layout} % show a page layout
\usepackage{blindtext} % dummy text
\begin{document}
\end{document}

RMarkdown and YAML not able to load packages

I have a text that I want to convert from latex to Markdown for various reasons. But I'm not able to make it work. If I load all the packages and only type "yo" as text, it's returning me an error.
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: while scanning a directive at line 5, column 1could not find expected directive name at line 5, column 2
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted
Many people had this error before but I haven't saw somebody encountering this error so far and a solution for packages like this.
Can we write comments "%" in the preamble?
How can I add my latex packages in RMarkdown?
Will it work if I export it in word?
Here is my code:
---
title: "rest"
author: "Me"
date: '2016-10-26'
header-includes:
% Titles
- \usepackage{titlesec}
% figure
- \usepackage{color}
- \usepackage{graphicx} % Enhanced support for graphics
- \usepackage{subfig} % subfigure environment
- \usepackage{float} % Improved interface for floating objects
- \usepackage{rotating} % Rotation tools, including rotated full-page floats
% \usepackage[labelfont=bf]{caption} % Customising captions in floating environments
% tables
- \usepackage[table]{xcolor} % Driver-independent color extensions
- \usepackage{array} % Extending the array and tabular environments
- \usepackage{longtable} % Allow tables to flow over page boundaries
- \usepackage{multirow} % Create tabular cells spanning multiple rows
% math
- \usepackage{amssymb} % some weird math symbols
- \usepackage{amsthm}
- \usepackage{amsmath} % AMS mathematical facilities for LATEX
% documents aspect
- \usepackage{lineno} % Line numbers on paragraphs
- \usepackage[top=2.2cm, left=2.2cm,right=2.2cm,bottom=4.2cm]{geometry} % Flexible and complete interface to document d=imensions
% see geometry.pdf on how to lay out the page. There's lots.
- \usepackage[utf8]{inputenc} % Accept different input encodings
- \usepackage[T1]{fontenc}
- \usepackage{lscape} % Place selected parts of a document in landscape
- \usepackage{babel}
% reference in text
- \usepackage[unicode=true, pdfusetitle, bookmarks=true, bookmarksnumbered=false, bookmarksopen=false, breaklinks=true, pdfborder={0 0 0}, backref=page,colorlinks=true]
{hyperref}
- \newcommand*{\fullref}[1]{\hyperref[{#1}]{\autoref*{#1} \nameref*{#1}}}
% bibliography
%\usepackage[style=authoryear, backend=bibtex,bibencoding=ascii]{biblatex} % Bibliographies in LATEX using BibTEX for sorting only
- \usepackage{natbib} % Flexible bibliography support
% \usepackage{translation-natbib-fr} %French translation of the documentation of natbib
%\renewbibmacro{in:}{}
%\bibliography{yo.bib}
% \ref{} makes reference to a \label{} set in a table or figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
- \theoremstyle{plain}
title: "data"
author: "Me"
date: '2016-10-26'
output:
pdf_document: default
word_document: default
documentclass: article % - \documentclass[english]{scrartcl
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
YO
Your header contains invalid YAML, inline comments need #:
---
title: "rest"
author: "Me"
date: '2016-10-26'
header-includes:
# Titles
- \usepackage{titlesec}
# figure
- \usepackage{color}
- \usepackage{graphicx}
...
You'll also need to de-duplicate your YAML map keys. Sure, you can render RMarkdown to Word with the obvious caveat that LaTeX-specific formatting won't automagically carry over.

How to start text in next line after subsubsubtitle in rmarkdown when generating pdf?

I have some .Rmd files in which I need to make some changes to the layout in subsections. This example shows what I need to do.
This is an example Rmd code:
---
title: "test"
output:
pdf_document:
latex_engine: xelatex
number_sections: yes
toc: yes
toc_depth: 3
html_document: default
mainfont: Calibri Light
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{test}
- \usepackage{floatrow}
- \floatsetup[table]{capposition=top}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{caption}
- \captionsetup{labelsep=space,justification=justified,singlelinecheck=off}
---
# Article
## title
#### subsubsubtitle {-}
Here is some text
The result if generating pdf is:
But what I really want is:
So I want the text to be starting on the next line instead of right after the section header. (Also I don't want the subsection to be numbered and, that's why I put the {-} right after it.)
Does someone know how to manage this?
This addresses the Latex side of the problem.
The \paragraph, which is what \subsubsubsection is, just has different formatting and presentation. One of the things is that it doesn't start a new line. This is in pure Latex.
Ways around it:
The package titlesec allows you to customize the title appearance a lot. See this post.
Do it in Latex itself -- [re]define how \paragraph works -- see the above post, and/or this post.
Tweak it in the next itself, adding a newline. See below.
There may be a more direct way in .Rmd but I am not familiar with it and this has the Latex tag.
I have to address another aspect of this, without debating poster's purpose. Such deep hierarchy may indicate a need to rethink the structure. Does it help in making the document easier and more intuitive to use, or does it do the opposite?
With that out of the way, here are some direct ways of making it add a line, as requested.
Tweak it in the text itself, so that it takes a newline (\newline alone doesn't work).
\paragraph{title_text}
\mbox{ }\\
paragraph text here
Another way
\paragraph{title_text} \hspace{0pt} \\
paragraph text here
With titlesec package you can redefine the \paragraph, by changing [runin] to [hung]
\usepackage{titlesec}
\titleformat{\paragraph}[hung] % default is [runin]
{\normalfont\normalsize\bfseries}
{\theparagraph}{1em}{}
Or, can explicitly change the spacings
\usepackage{titlesec}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
For a succinct summary of the titlesec package see this post.
All this is straight-up Latex and I am not sure how it works with .Rmd.

Resources