首页 技术 正文
技术 2022年11月22日
0 收藏 777 点赞 4,770 浏览 66010 个字


<!–
/*–><!–*/
.title { text-align: center; }
.todo { font-family: monospace; color: red; }
.done { color: green; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right { margin-left: auto; margin-right: 0px; text-align: right; }
.left { margin-left: 0px; margin-right: auto; text-align: left; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
pre.src-sh:before { content: ‘sh’; }
pre.src-bash:before { content: ‘sh’; }
pre.src-emacs-lisp:before { content: ‘Emacs Lisp’; }
pre.src-R:before { content: ‘R’; }
pre.src-perl:before { content: ‘Perl’; }
pre.src-java:before { content: ‘Java’; }
pre.src-sql:before { content: ‘SQL’; }

table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.right { text-align: center; }
th.left { text-align: center; }
th.center { text-align: center; }
td.right { text-align: right; }
td.left { text-align: left; }
td.center { text-align: center; }
dt { font-weight: bold; }
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
–>

latex

Table of Contents

1 Presentation/Slides with Beamer

https://www.shuzhiduo.com/A/kvJ3R9aQzg/beamer.html

2 Drawing in LaTex With TikZ

3 Tracked changes and comments with todonotes

4 Latex

 

4.1 nomenclature in article

\usepackage{nomencl}

\makenomenclature http://blog.modelworks.ch/how-to-generate-nice-nomenclatures-in-latex/

file name: classes/CUEDthesisPSnPDF.cls

% Nomenclature
\usepackage{nomencl}
\makenomenclature
\renewcommand\nomgroup[1]{%
\ifthenelse{\equal{#1}{A}}{%
\item[\textbf{Roman Symbols}] }{% A - Roman
\ifthenelse{\equal{#1}{G}}{%
\item[\textbf{Greek Symbols}]}{% G - Greek
\ifthenelse{\equal{#1}{R}}{%
\item[\textbf{Superscripts}]}{% R - Superscripts
\ifthenelse{\equal{#1}{S}}{%
\item[\textbf{Subscripts}]}{{% S - Subscripts
\ifthenelse{\equal{#1}{X}}{%
\item[\textbf{Other Symbols}]}{{% X - Other Symbols
\ifthenelse{\equal{#1}{Z}}{%
\item[\textbf{Acronyms}]}% Z - Acronyms
{{}}}}}}}}}}\ifpdf

4.2 section without number

\section*{name}

4.3 page break

\clearpage \newpage

4.4 defining a new environment

https://www.overleaf.com/learn/latex/Environments

syntax:

\newenvironment{name}

To define a boxed environment:

\newenvironment{boxed}
{\begin{center}
\begin{tabular}{|p{0.9\textwidth}|}
\hline\\
}
{
\\\\\hline
\end{tabular}
\end{center}
}

To use boxed environmen

\begin{boxed}
*bold text here*
\end{boxed}

To create a environment named “abstract”:

\newenvironment{abstract}

%The abstract environment puts a large, bold, centered "Abstract" label at
%the top of the page. The abstract itself appears in a quote environment,
%i.e. tabbed in at both sides, and on its own page.
%%% tabbed???\newenvironment{abstracts}
{\begin{alwayssingle} %\pagestyle{empty}
\renewcommand{\headrulewidth}{0pt}
\begin{center}
\vspace*{1.5cm}
{\Large \bfseries Abstract}
\end{center} \vspace{0.5cm}
\begin{quote}}
{\end{quote}
\end{alwayssingle}}

{\Large \bfseries Abstract} # make “Abstract” bold

quote
for a short quotation, or a series of small quotes, separated by blank lines.

5 Installation

6 FAQ

 

6.1 Missing \endcsname inserted. …ll model as follows\cite{Øye1991dynamic}

change Øye1991dynamic to Oye1991dynamic

The citation/entry keys in your .bib file should not contain non-ASCII chars such as í if you use a non-Unicode engine.

6.2 Paragraph ended before \T@ref was complete.

extra { in the section

6.3 Misplaced alignment tab character &. in thesis.bbl file

6.4 You have requested document class `Classes/CUEDthesisPSnPDF’, but the document class provides `CUEDthesisPSnPDF’.

6.5 Latex vs MS word vs Markdown

LaTeX should be used as a document preparation system only in cases in which a document is heavily loaded with mathematical equations.

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you 3to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

From http://daringfireball.net/projects/markdown/ An Efficiency Comparison of Document Preparation Systems Used in Academic Research and Development

7 QMUL latex thesis template by harish bhanderi

author: harish.bhanderi@cantab.net from:http://www.maths.qmul.ac.uk/~beheshti/PGR_Training s.beheshti@qmul.ac.uk

7.1 Page numbering

In books, is customary to use Roman numerals for the pages before the first chapter/section, and Arabic numbers for the rest of the document. There are two commands available in the book document class that accomplish this:

7.2 Document class

7.3 Using two page numbering styles in a single document

In books, is customary to use Roman numerals for the pages before the first chapter/section, and Arabic numbers for the rest of the document. There are two commands available in the book document class that accomplish this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}\pagenumbering{roman}\begin{document}
\tableofcontents\section{First section}
\setcounter{page}{3}Some text here...\section{Second section}
Some more text here..\section{Heading on Level 1 (section)}
\pagenumbering{arabic}More text here...
\end{document}\pagenumbering{roman}
This command sets the page numbers to lowercase Roman numerals. \setcounter{page}{3}
This will manually set the page counter to 3 in this page, subsequent pages are numbered starting the count from this one. \pagenumbering{arabic}
The page numbering is switched to Arabic, this will also restart the page counter.

7.4 Nomenclature

% Nomenclature \usepackage[intoc]{nomencl} \makenomenclature \renewcommand\nomgroup[1]{% \ifthenelse{={#1}{A}}{% \item[\textbf{Roman Symbols}] }{% A – Roman \ifthenelse{={#1}{G}}{% \item[\textbf{Greek Symbols}]}{% G – Greek \ifthenelse{={#1}{R}}{% \item[\textbf{Superscripts}]}{% R – Superscripts \ifthenelse{={#1}{S}}{% \item[\textbf{Subscripts}]}{{% S – Subscripts \ifthenelse{={#1}{X}}{% \item[\textbf{Other Symbols}]}{{% X – Other Symbols \ifthenelse{={#1}{Z}}{% \item[\textbf{Acronyms}]}% Z – Acronyms {{}}}}}}}}}}

\ifpdf

8 Multi-file Latex Projects

9 Environments

 

9.1 Table

table vs tabular environment https://texblog.org/2007/08/07/introduction-to-tables-in-latex/

\begin{table}

\begin{tabular}

10 commands

\doublespacing

\newcommand defines a new command, and makes an error if it is already defined.

\renewcommand redefines a predefined command, and makes an error if it is not yet defined.

\providecommand defines a new command if it isn’t already defined.

If you want to define a command whether it is new or predefined, you can use \def or

\providecommand\foo{} \renewcommand\foo{…}

10.1 \renewcommand

e.g. \renewcommand\nomgroup[1]{

10.2 \addcontentsline

e.g. \addcontentsline{toc}{chapter}{List of Symbols}

Syntax:

\addcontentsline{file}{sec_unit}{entry}

The \addcontentsline command adds an entry to the specified list or table where

file is the extension of the file on which information is to be written: toc – table of contents lof – list of figures lot – list of tables sec_unit controls the formatting of the entry. It should be one of the following, depending upon the value of the file argument: toc – the name of the sectional unit, such as part or subsection lof – figure lot – table entry is the text of the entry. https://www.giss.nasa.gov/tools/latex/ltx-171.html

11 TOC

 

11.1 Manually add nomenclature at ToC

In the thesis.tex file \include{toc}

add the following in toc.tex file

% print table of contents, figures, tables
\tableofcontents
\listoffigures
\pagestyle{empty} %% clear the header on 'list of tables' pages, disable header on "list of tables" pages, otherwise, 'list of tables' shown on header of 'list of symbols'
\listoftables% list of symbols
\chapter*{List of symbols}
\addcontentsline{toc}{chapter}{List of symbols}
\begin{tabular}{ll}
D & Diameter\\
\end{tabular}

Important commands:

  • \chapter*{List of symbols}
  • \addcontentsline{toc}{chapter}{List of symbols} #manually add content on ‘table of contents’

Latex Notes

12 Nomenclature, list of symbols

available packages: nomencl, glossary ,and glossaries

  • The package uses an in­dex­ing pro­gram to pro­vide the ac­tual glos­sary

Methods:

  • Nomenclature package for article document type
  • Use table for Multiple tex project
  • glosaries package e.g. \include*{Symbols/symbol} # include a tex file, symbol.tex in the folder, Symbols

add the package \usepackage{nomencl} in the preamble

The three basic commands to produce the nomenclatures are: \makenomenclature # Usually put right after importing the package. \nomenclature{$a$}{the axial induction factor} # Used to define the nomenclature entries themselves. Takes two arguments, the symbol and the corresponding description. \printnomenclatures # this command prints the abbreviation/symbol list at the corresponding position of the document.

From https://www.sharelatex.com/learn/Nomenclatures

  • Nomenclature not work in Texstudio

makeindex <filename>.nlo -s nomencl.ist -o <filename>.nls

From https://sourceforge.net/p/texstudio/feature-requests/104/

makeindex -s nomencl.ist -t %.nlg -o %.nls %.nlo

Error

Input index file bladedesign.idx not found. Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 …]

12.1 nomenclature in Emacs

http://blog.modelworks.ch/how-to-generate-nice-nomenclatures-in-latex/

add nomencl package

\usepackage{nomencl}  % If you want to use the references add options refpage, refeq
\makenomenclature

To print the nomenclature \printnomenclature

Symbols can be added in the text like follows (after the equation they appear the first time):

\nomenclature{$vw$}{ Time cost multiple for walking time}

To generate the nomenclature you have to give a specific command. In Emacs you can add the following code to your .emacs-file

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("Nomenclature" "makeindex %s.nlo -s nomencl.ist -o %s.nls"
(lambda (name command file)
(TeX-run-compile name command file)
(TeX-process-set-variable file 'TeX-command-next TeX-command-default))
nil t :help "Create nomenclature file")))

When you now hit C-c C-c you can choose the option “Nomenclature” and the necessary files are generated.

If you want to have the distinction between several groups, you just add the following code in your preamble and change the second part according your preferences:

\usepackage{xstring}
\usepackage{xstring}
\usepackage{xpatch}
\patchcmd{\thenomenclature}
{\leftmargin\labelwidth}
{\leftmargin\labelwidth\itemindent 1em }
{}{}\newcommand{\nomenclheader}[1]{%
\item[\hspace*{-\itemindent}\normalfont\bfseries#1]}
\renewcommand\nomgroup[1]{%
\IfStrEqCase{#1}{%
{V}{\nomenclheader{Variables}}% V - Variables
{P}{\nomenclheader{Parameters}}% P - Parameters
{A}{\nomenclheader{Acronyms}}% A - Acronyms
}%
}

To produce an entry for paramters, you just add [P] in front of the normal entry

<p>\nomenclature[P]{$vw$}{ Time cost multiple for walking time}
</p>

One last remark: The entries might not be aligned properly. For this you can add in your preamble:

\nomlabelwidth=30mm

and choose the width accordingly. The nomenclature entries have rather much vertical space between them. This can be changed by adding one of the following lines to your preamble:

;;No extra skip
\setlength{\nomitemsep}{-\parsep};; Set to 1cm
\setlength{\nomitemsep}{1cm}

12.2 nomenclature in a multi-tex project

 

12.2.1 methods 1

use \include{Symbols/symbol} in the main part of thesis.tex file use non listed chapter \chapter*{Nomenclature} in the symbol.tex

12.3 Manuallly setting the title

\documentclass{article}
\usepackage[utf8]{inputenc}\usepackage{nomencl}
\makenomenclature\renewcommand{\nomname}{List of Symbols}\renewcommand{\nompreamble}{The next list describes several symbols that will be later used within the body of the document}\begin{document}
\mbox{}\nomenclature{$c$}{Speed of light in a vacuum inertial frame}
\nomenclature{$h$}{Planck constant}\printnomenclature
\end{document}

The line

\renewcommand{\nomname}{List of Symbols}

changes the default title.

The command

\renewcommand{\nompreamble}{The next list...}

inserts some text in between the title and the list symbols.

12.4 nomenclature in Texstudio

讲述如何在使用Latex编辑术语表,并在Texstudio中添加命令编辑

  1. 新建一个.tex文档,在其导言区加入usepackage{nomencl},即begin{document}前
  2. 在导言区加入makenomenclature,即begin{document}前
  3. 在文档正文中想使符号加入术语表的地方,使用nomenclature命令

4.将printnomenclature置于你想要你的术语表出现的地方

一个示例文档代码如下所示:

documentclass{article}
usepackage{nomencl}
makenomenclature
begin{document}
section*{Main equations}
begin{equation}
a=frac{N}{A}
end{equation}%
nomenclature{$a$}{The number of angels per unit area}%
nomenclature{$N$}{The number of angels per needle point}%
nomenclature{$A$}{The area of the needle point}%
The equation $sigma = m a$%
nomenclature{$sigma$}{The total mass of angels per unit area}%
nomenclature{$m$}{The mass of one angel}
follows easily.
printnomenclature
end{document}

Related codes:

  • usepackage{nomencl}
  • makenomenclature
  • nomenclature{$a$}{The number of angels per unit area}%
  • printnomenclature

以上代码来自nomenclature宏包的使用手册。 假设文档名为sample.tex

Compiling

method 1:

  1. latex
  2. 在控制台下输入(windows下运行cmd,cd进入文件所在目录,即使用命令提示符)

makeindex sample.nlo -s nomencl.ist -o sample.nls

  1. latex

即可得到术语表

method 2: Texstudio内一键编辑方法: 1.add a user commands named makeindex Options ->>configure->> Build>> User Commands – Add

syntax

  • name : command

user0:makeindex makeindex Filename.nlo -s nomencl.ist -o Filename.nls Latex Notes where % means filename without extension

  1. Tools –>> Users
  2. F6

参考: http://mirrors.huaweicloud.com/repository/toolkit/CTAN/macros/latex/contrib/glossaries/glossaries-user.html https://texblog.org/2012/05/14/list-of-symbols-or-abbreviations-nomenclature/ https://tex.stackexchange.com/questions/161304/makeindex-no-nls-file/161381 http://tex.stackexchange.com/questions/62061/problem-with-the-nomenclature http://tex.stackexchange.com/questions/27824/using-package-nomencl http://bbs.ctex.org/forum.php?mod=viewthread&tid=40304 http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/nomencl.pdf

12.4.1 makeindex log

Process started: makeindex -s nomencl.ist -t “test2”.nlg -o “test2”.nls “test2”.nlo

This is makeindex, version 2.15 [TeX Live 2015] (kpathsea + Thai support). Scanning style file /usr/share/texlive/texmf-dist/makeindex/nomencl/nomencl.ist……

….done (10 attributes redefined, 3 ignored). Scanning input file test2.nlo….done (5 entries accepted, 0 rejected). Sorting entries….done (16 comparisons). Generating output file test2.nls….done (16 lines written, 0 warnings). Output written in test2.nls. Transcript written in test2.nlg.

Process exited normally

12.5 How to include List of Symbols entry in the ToC?

12.6 How to rename “Nomenclature” to “List of Symbols”?

12.7 There are some symbols that are used in different locations in the document and their meanings are different. How to duplicate the entry?

12.8 How to reduce line spacing on the nomenclature page?

13 style Files

 

13.1 class file .cls

14 Compiling

15 Chinese input

Chinese need special document class, such as ctexart (Chinese Tex Article), ctexrep, ctexbook

15.1 Error

 

15.1.1 File `ctexart.cls’ not found. \oddsidemargin

https://www.overleaf.com/learn/latex/Chinese https://www.sharelatex.com/learn/Chinese

16 Images/Figure

 

16.1 refer multiple figures

https://tex.stackexchange.com/questions/20698/reference-multiple-subfloated-figures-using-refx-y-z-to-give-fig-1a-1b-1c-in

without package cleveref is must be \ref{..},\ref{…}

16.2 two figures side by side

use Subfigures package, and add caption and subcaption packages in the preamble

\usepackage{caption}
\usepackage{subcaption}\begin{ducment}\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph1}
\caption{$y=x$}
\label{fig:y equals x}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph2}
\caption{$y=3sinx$}
\label{fig:three sin x}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph3}
\caption{$y=5/x$}
\label{fig:five over x}
\end{subfigure}
\caption{Three simple graphs}
\label{fig:three graphs}
\end{figure}
- for two or more figure, use subfigure package (subfigure.sty)

16.2.1 case 2

\documentclass{article} \usepackage{graphicx,subfigure}

\begin{document} \begin{figure} \centering %%% not \center \subfigure[Figure A]{\label{fig:a}\includegraphics[width=60mm]{example-image-a}} \subfigure[Figure B]{\label{fig:b}\includegraphics[width=60mm]{example-image-b}} \caption{Spanwise distribution of the power coefficient, left TSR=4; right TSR=5.5} \label{Fig. spanwise cp} \end{figure} \end{document}

16.3 two figures side by side in latex

keywords: subfigures

\begin{subfigure} \end{subfigure}

\textwidth \hfill # add some spacing between the figures

3 subfigures

\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph1}
\caption{$y=x$}
\label{fig:y equals x}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph2}
\caption{$y=3sinx$}
\label{fig:three sin x}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{graph3}
\caption{$y=5/x$}
\label{fig:five over x}
\end{subfigure}
\caption{Three simple graphs}
\label{fig:three graphs}
\end{figure}
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{image1}
\caption{A subfigure}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{image1}
\caption{A subfigure}
\label{fig:sub2}
\end{subfigure}
\caption{A figure with two subfigures}
\label{fig:test}
\end{figure}

16.4 Width, size

the width of a figure should be specified in terms of \columnwidth in a figure environment and of \textwidth in a figure* environment

  • \hsize is a TeX primitive that should not be usually used in LaTeX
  • \textwidth is the (constant) width of the total text block
  • \columnwidth is the (constant) width of a single column of text (which is the same as \textwidth for a single column document)
  • \linewidth is a variable that represents the current size of the line of text, whether inside a column or a minipage or a list

In general, then, it’s best to always use \linewidth if you are specifying the relative size of an image or a box, since it will adapt to the current situation.

16.5 Positioning of Figure

\begin{figure}[!htb]

Explanation of the figure placement parameters:

  • h – Place figure here, if possible
  • t – Place figure at the top of a page
  • b – Place figure at the bottom of a page and
  • ! – Over-ride default LaTeX figure placement (do not use the parameter values).

For better display, use:

> \begin{figure}[!htb]

  • it is often easier to add ! before the placement options, thus forcing LaTeX to ignore most of these contraints.

causes LaTeX to try to fit the float “here”, or at the “top” of the current page (or the next page), or at the “bottom” of the current page (or the next page). If “p” is specified, it will allow the float to take a whole page to itself.

One of the reasons that the floats won’t go where you want them is that there are a lot of constraints on where they can go. The main ones are

Specifier Permission
h Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot)
t Position at the top of the page.
b Position at the bottom of the page.
p Put on a special page for floats only.
! Override internal parameters, LaTeX uses for determining “good” float positions.
Counter Default
topnumber maximum number of floats at top of page 2
bottomnumber maximum number of floats at bottom of page 1
totalnumber maximum number of floats on a page 3
Command  
\topfraction maximum fraction of page for floats at top 0.7
\bottomfraction maximum fraction of page for floats at bottom 0.3
\textfraction minimum fraction of page for text 0.2
\floatpagefraction minimum fraction of floatpage that should have floats 0.5
   

These can be changed individually. But it is often easier to add ! before the placement options, thus forcing LaTeX to ignore most of these contraints.

If you want to change the defaults, the following values give reasonable results:

  • \setcounter{topnumber}{2}
  • \setcounter{bottomnumber}{2}
  • \setcounter{totalnumber}{4}
  • \renewcommand{\topfraction}{0.85}
  • \renewcommand{\bottomfraction}{0.85}
  • \renewcommand{\textfraction}{0.15}
  • \renewcommand{\floatpagefraction}{0.7}

The \clearpage command starts a new page and inserts all floats that have not yet appeared before continuing. This can leave a bad page break, so a useful alternative is to use the afterpage package, and then insert

\afterpage{\clearpage}

which will put all the floats at the end of the current page.

A very useful package is placeins. This provides the command \FloatBarrier which causes all unprocessed floats to be processed at that point, but does not start a new page unless it is necessary. To keep floats in the sections in which they were included, use

\usepackage[section]{placeins}

This silently puts a \FloatBarrier command before each section. There are other options explained in the placeins documentation.

Another useful package is flafter. This causes floats to always appear after their placement in the document.

If you really don’t want LaTeX to move your float at all, then use the float package with the command \restylefloat{figure} in the preamble. This allows you to specify [H] as the position parameter which means “Here and only Here”. However, this often gives bad page breaks.

>> https://www.sharelatex.com/learn/Positioning_of_Figures

16.5.1 figures cross sections

example problem: Latex Notes solution: add \clearpage and \newpage before conclusion sections

\clearpage
\newpage
\section{conclusion}
  • use \begin{figure}[h]

or \begin{figure}[!htb]. In nearly all cases it helps.

Explanation of the figure placement parameters:

  • h – Place figure here, if possible
  • t – Place figure at the top of a page
  • b – Place figure at the bottom of a page and
  • ! – Over-ride default LaTeX figure placement (do not use the parameter values).

If that doesn’t work then use:

\usepackage[section]{placeins}

to automatically ensure floats do not go into the next section.

The package also gives you a \FloatBarrier command that you can use to prevent floats to appear beyond some point in your document. Use it as

% ... some floats here ...\FloatBarrier\subsection{My new subsection}

This prevents placing floats before a section. https://tex.stackexchange.com/questions/279/how-do-i-ensure-that-figures-appear-in-the-section-theyre-associated-with https://tex.stackexchange.com/questions/32598/force-latex-image-to-appear-in-the-section-in-which-its-declared

16.6 A double column floating figure using two subfigures.

(The subfig.sty package must be loaded for this to work.) The subfigure \label commands are set within each subfloat command, the \label for the overall figure must come after \caption.

  • \hfil must be used as a separator to get equal spacing.

The subfigure.sty package works much the same way, except \subfigure is used instead of \subfloat.

%\begin{figure*}[!t]
%\centerline{\subfloat[Case I]\includegraphics[width=2.5in]{subfigcase1}%
%\label{fig_first_case}}
%\hfil
%\subfloat[Case II]{\includegraphics[width=2.5in]{subfigcase2}%
%\label{fig_second_case}}}
%\caption{Simulation results}
%\label{fig_sim}
%\end{figure*}

Note that often IAENG papers with subfigures do not employ subfigure captions (using the optional argument to \subfloat), but instead will reference/describe all of them (a), (b), etc., within the main caption.

16.7 Embed

  • pgfplot
  • gnuplot
  • TkiZ/PGF

function plots in LaTeX?

  • pgfplots

16.8 TikZ and PGF- Embed Graphic systems for TeX

TikZ and PGF are TeX packages for creating graphics programmatically. TikZ is build on top of PGF and allows you to create sophisticated graphics in a rather intuitive and easy manner. PGF : Create normal/logarithmic plots in two and three dimensions official web

16.8.1 Tutorial

http://www.texample.net/tikz/

16.9 Combining sub-figures to a single figure for submission to journal

a journal might disallow usage of LaTeX packages such as subfigure, subfig, or subcaption.

Essentially, we combine sub-figures in a separate document, thereby adding sub-captions and labels.

16.10 embed image using tikz package

\documentclass{article} \usepackage{tikz} \usetikzlibrary{plotmarks} % The data files, written on the first run.

\begin{filecontents}{div_soft.data} #MOPS Power [mW] 1.33E-02 10.403432 1.33E-01 12.53108 2.66E-01 14.90265 3.99E-01 17.22483 5.31E-01 19.58292 6.64E-01 21.89876 7.97E-01 24.44624 9.30E-01 26.6708 \end{filecontents} \begin{filecontents}{div_ciu.data} # MOPS Power [mW] 4.35E-02 9.562436 4.35E-01 10.845494 8.69E-01 12.24356 1.30E+00 13.66974 1.74E+00 15.13008 2.17E+00 16.57845 2.61E+00 17.97894 3.04E+00 19.41534 \end{filecontents} \begin{filecontents}{div_ciu_oscar.data} #MOPS Power [mW] 8.57E-01 11.255013 9.99E-01 11.4804 1.14E+00 11.718 1.29E+00 11.9916 1.64E+00 12.65854 2.00E+00 13.308 2.64E+00 14.484 3.85E+00 16.8 \end{filecontents} \begin{filecontents}{div_ciu_oscar_extrapolated.data} # MOPS Power [mW] 4.28E+00 17.56312023 5.71E+00 20.21127914 7.14E+00 22.85943805 8.57E+00 25.50759696 9.99E+00 28.15575587 \end{filecontents} \begin{document} \begin{tikzpicture}[y=.2cm, x=.7cm,font=\sffamily] %axis \draw (0,0) — coordinate (x axis mid) (10,0); \draw (0,0) — coordinate (y axis mid) (0,30); %ticks \foreach \x in {0,…,10} \draw (\x,1pt) — (\x,-3pt) node[anchor=north] {\x}; \foreach \y in {0,5,…,30} \draw (1pt,\y) — (-3pt,\y) node[anchor=east] {\y}; %labels \node[below=0.8cm] at (x axis mid) {MOPS}; \node[rotate=90, above=0.8cm] at (y axis mid) {Power [mW]}; %plots \draw plot[mark=*, mark options={fill=white}] file {div_soft.data}; \draw plot[mark=triangle*, mark options={fill=white} ] file {div_ciu.data}; \draw plot[mark=square*, mark options={fill=white}] file {div_ciu_oscar.data}; \draw plot[mark=square*] file {div_ciu_oscar_extrapolated.data}; %legend \begin{scope}[shift={(4,4)}] \draw (0,0) — plot[mark=*, mark options={fill=white}] (0.25,0) — (0.5,0) node[right]{soft}; \draw[yshift=\baselineskip] (0,0) — plot[mark=triangle*, mark options={fill=white}] (0.25,0) — (0.5,0) node[right]{ciu}; \draw[yshift=2\baselineskip] (0,0) — plot[mark=square*, mark options={fill=white}] (0.25,0) — (0.5,0) node[right]{ciu + oscar}; \draw[yshift=3\baselineskip] (0,0) — plot[mark=square*, mark options={fill=black}] (0.25,0) — (0.5,0) node[right]{ciu + oscar extrapolated}; \end{scope} \end{tikzpicture} \end{document}

17 Text Color

Using colours in LaTeX

  • use color or xcolor packages

e.g.

The background colour of some text can also be \textcolor{red}{easily} set.
For instance, you can change to orange the background of \colorbox{BurntOrange}{this
text} and then continue typing.
  • \textcolor{red}{easily} # set “easily” red color
  • \colorbox{color definition}{text}

for clor names, refer to Basic colour names available in LaTeX

To set page background colour:

\pagecolor

18 Version control system for LaTeX documents?

keywords: git latex thesis

Options: Mercurial, Git

> http://www.codiply.com/blog/place-your-latex-thesis-under-version-control-with-mercurial-and-bitbucket/

LaTeX and Subversion

  • SVN: subversion

As a single user the main advantages are

Automatic backups: If you accidentally delete some file (or part of a file) you can undelete it. If you change something and want to undo it, the VCS can do so. Sharing on multiple computers: VCSes are designed to help multiple people collaboratively edit text files. This makes sharing between multiple computers (say your desktop and laptop) particularly easy. You do not need to bother if you always copied the newest version; the VCS will do that for you. Even if you are offline and change files on both computers, the VCS will merge the changes intelligently once you are online. Version control and branching: Say you published some class notes as a pdf and want to fix some typos in them while simultaneously working on the notes for next year. No problem. And you only need to fix the typos once, the VCS will merge them to the other versions.

Firstly, almost every common VCS is supported by an Emacs extension so that is not a key concern.

The only VCS that can output things to your drafts that I am aware of is SVN(subversion). To do this you have to install a couple of LaTeX packages, as described here: http://www.tug.org/pracjourn/2007-3/kalderon-svnmulti/ These allow you to put SVN version numbers and other details into your drafts. There is no real reason why this can’t be done with other VCSs, but so far nobody has released any LaTeX packages for them.

I don’t know of any LaTeX packages that allow you to track changes in the pdf itself, but they all allow you to do this for the .tex file via the various diff commands. Again, getting this in the pdf file would be a matter of writing LaTeX packages.

Aside from these issues, the main thing you need to decide is whether to use a centralized (e.g. CVS, SVN) or distributed (e.g. git, Mercurial) system. Distributed systems have a number of advantages and, as far as I can tell, no disadvantages for use with LaTeX. For one thing, you can use them without setting up a server to just work with single-author projects on your own machine. They also store the whole history of the project on your local machine so you always have access to it even if you are offline (one of my coauthors is very picky about this).

Personally, I use Mercurial rather than git for the following reasons:

Git is undoubtedly more powerful than Mercurial, but the extra functionality is mainly relevant to software developers and you are extremely unlikely to need it for a LaTeX document. Mercurial has a better user interface in the sense that, unlike git, most commands do what you would expect them to do and you won’t need to use lots of flags and command line options to get it to do what you want. (WARNING! The Git vs. Mercurial debate is an example of a holy war. This is the personal view of the author and you are free to disagree, but if you do disagree then it is probably because you have never worked with anyone who is not intimately familiar with a *nix command line.) Mercurial has excellent documentation, especially Mercurial:The Definitive Guide, which is available for free online. I didn’t find anything nearly as good for git. Mercurial makes it easy to throw up a repository server on even the most backwards shared hosting provider that you can get for $5 a month. The standard ways of serving git repositories require persistent processes, which means you may have to pay more for hosting. Of course, this is moot if you run your own server or have in house IT staff to do it for you.

In summary, Mercurial will scare your collaborators who are only reluctantly agreeing to use a VCS in the first place a lot less than git would.

18.1

18.2 SVN

Linux and Mac OSX normally provide already svn tools, for Windows, the installation of “SlikSVN” is recommended.

18.3 Reference

https://tex.stackexchange.com/questions/1118/what-are-the-advantages-of-using-version-control-git-etc-in-latex-documents/1121#_=_

19 Table

\begin{table}[h!]
\begin{center}
\caption{Wake decay coefficient and RMS Error}
\label{tab:WakeDecayCoefficient}
\begin{tabular}{|c|c|c|}
\hline
TI (\%) & k & RMS Error\\
\hline
15 & 0.0190 & 0.0190\\
1 & 0.0075 & 0.0371\\
\hline
\end{tabular}\end{center}
\end{table}

in the above exapple, the table caption is below the table.

To make sure caption on top of table contents:

The \caption and \label commands are optional. However, if you have both of them, \label must come between \caption and \end{table}.

19.1 fit width of table to text width

use tabu environment, but not works https://www.overleaf.com/learn/latex/Tables https://tex.stackexchange.com/questions/10535/how-to-force-a-table-into-page-width

\begin{tabu} to \textwidth {|X[l]|X[c]|X[c]|X[c]|X[c]|X[c]|X[r]|} Location & TI\(_{\infty}^s\) (\%) & TI\(_{\infty}\) (\%) & U\(_{\infty}\) (m/s) & h(m) & Techniques & Ref
\hline
Island of Eday, UK & 10-11 & 7.9-8.7 & 1.5 & 5.0 & ADCP & \cite{osalusi2009reynolds}
Sound of Islay, UK & 12-13 & 9.5-10.3 & 2.0 & 5.0 & ADV & \cite{milne2013characteristics}
Puget Sound, USA & 8.4/11.4 & 6.6/9.0 & 1.3 (\(\pm\) 0.5) & 4.7 & ADV/ADCP & \cite{thomson2012measurements}
Strangford Lough, UK & 4-9 & 3.2-7.1 & 1.5-3.5 & 14 & – &\cite{macenri2013influence}
East River, NY,USA & 20-30 & 16-24 & 1.5-2.3 & 5.22 & ADCP & \cite{li2010inflow}
Goto Islands, Japan & 10-25.5 & 8-23 & 0.25-2 & 18& ADCP & \cite{novo2017field}
\hline
\end{tabu}

If you don’t need to control the width of each cell, but of the entire table and
then distribute the space within evenly, use the package tabu.
See the example below:

\begin{tabu} to 0.8\textwidth { | X[l] | X[c] | X[r] | }
\hline
item 11 & item 12 & item 13 \\
\hline
item 21 & item 22 & item 23 \\
\hline

19.2 embed org-tables inside of a latex document

20 Error log

 

20.1 Not in outer par mode. \begin{figure}[!htb]

20.2 Sorry, but pdflatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again: C:/Users/exw692/AppData/Local/MiKTeX/2.9/miktex/log/pdflatex.log You may want to visit the MiKTeX project page, if you need help.

20.3 I found no \bibdata command

message: This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit) The top-level auxiliary file: e387A7ransbem.aux I found no \bibdata command—while reading file e387A7ransbem.aux I found no \bibstyle command—while reading file e387A7ransbem.aux (There were 2 error messages)

answer: The BibTeX log reports that the aux files does not contain \bibstyle and \bibdata. These two instructions are written in the aux file by the commands \bibliographystyle and \bibliography. The two commands are present in the main file.

This suggests that one of the included files contains \end{document}. In this case, the \end{document} appears in mathfluid3.tex (or as the edit indicates in one of the files embedded in it). \end{document}, typically, instructs the TeX compilers to terminates the compilation, and everything appering after it is ignored.

20.4 Unsupported document class (or package) detected,(caption) usage of the caption package is not recommended.

20.5 Underfull \hbox (badness 1648) in paragraph

99 times out of 100 it means you have \\ incorrectly placed at the end of a paragraph. But to dissect the message:

Underfull \hbox (badness 10000) in paragraph at lines 4–5

A box is underfull if there is not enough content to fill its stated size.

If you go \hbox to 5cm{A} then it makes a horizontal box (\hbox) 5cm wide just containing an A so it is underfull and will generate a warning, the exact amount of badness depends how much any white space is over-stretched, but here there is no white space so it is infinitely bad, which is arbitrarily truncated to the maximum value, 10000.

By placing \\ at the end of a paragraph you force a line break but there is nothing at all in the forced final line of the paragraph so it is a box that is \textwidth wide with no content. It appears a bit like vertical space but it is not it is a spurious line at the end of the paragraph. So for example it does not stretch and is not dropped at the start of a page.

20.6 There’s no line here to end. \end{itemize} \newline

add “\bigskip” e.g.

\begin{itemize} \item This \item That \item Where \end{itemize}

\bigskip I am doing it here to test this.

20.7 Unknown graphics extension: .bmp

20.8 Missing number, treated as zero. \begin{subfigure}{0.55\textwidth}

 

20.8.1 code

\begin{figure}[!t] \centering \begin{subfigure}{0.55\textwidth} \includegraphics[width=1\linewidth]{fig/2r_tsr55_e387} \caption{} \label{fig:Ng1} \end{subfigure} \hfill \begin{subfigure}{0.55\textwidth} \includegraphics[width=1\linewidth]{fig/5r_tsr55_e387} \caption{} \label{fig:Ng2} \end{subfigure} \end{figure}

20.8.2 solution

change package to \usepackage{subcaption}

20.9 Package caption Error: The package option `caption=false’ is obsolete. \caption@ProcessOptions*{caption}

21 Glossary

environments
Everything between \begin and \end

e.g.

\begin{equation} \end{equation}

Floats
containers for things in a document that cannot be broken over a page.
textwidth
the global width of the text area
\columnwidth
the width of a column of text (it will be different from \textwidth when typesetting in two or more columns).

22 Editors

  • Texstudio
  • Texlive

23 Syntax

 

23.1 comment

% # comment

23.2 Special characters

Type \ before these characters, i.e. type “\&” in order to see: &.

  • combination of “≈” and “=”,
  • used to indicate isomorphism or sometimes congruence

23.3 Spaces

Two or more spaces in text are the same as one \hfill Inserts a blank space that will stretch accordingly to fill the space available.

23.4 Paragraphs and new lines

New paragraph Blank line \par From https://www.sharelatex.com/learn/Paragraphs_and_new_lines

23.5 Line breaks and blank spaces

\\ #line break From https://www.sharelatex.com/learn/Line_breaks_and_blank_spaces

23.6 Emphasising text

Text can be emphasized by using \emph command. Sometimes the \emph command behaves just as \textit, but is not exactly the same: * Some of the greatest \emph{discoveries} in science were made by accident.   \textit{Some of the greatest \emph{discoveries} in science were made by accident.}   \textbf{Some of the greatest \emph{discoveries} in science were made by accident.} **

From https://www.sharelatex.com/learn/Bold,_italics_and_underlining

List

Ordered lists

\begin{enumerate} \item \end{enumerate}

Unordered lists

\begin{itemize} \item \end{itemize}

From https://www.sharelatex.com/learn/Learn%20LaTeX%20in%2030%20minutes

\makeatletter # changes the catcode of @ to 11 <your changes here> \makeatother #changes the catcode of @ back to 12 From https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do

Environment ** \begin{he name of the environment}

\end{he name of the environment} *

Command \commandname[options]{argument}

Defining a new environment Just as with commands, you can define new environments. [edit] Defining simple environments The new environment definition is achieved by the \newenvironment tag: \newenvironment{boxed} {\begin{center} \begin{tabular}{|p{0.9\textwidth}|} \hline\\ } { \\\\\hline \end{tabular} \end{center} } %–————————————————   Below this line a boxed environment is used   \begin{boxed} This is the text formatted by the boxed environment \end{boxed}   This text is again outside the environment

This environment will draw a box around the text within. Right after the \newcommand, in between braces, you must write the name of the environment, boxed in the example. Below that are two pairs of braces. Inside the first pair of braces is set what your new environment will do before the text within, then inside the second pair of braces declare what your new environment will do after the text. In the example, in between the before braces a horizontal line is drawn and the tabular environment is started to draw the vertical lines. Inside the after braces another horizontal line is drawn and the tabular environment is closed.

From https://www.sharelatex.com/learn/Environments

Hyperlinks when importing hyperref. Usually it has to be the last package to be imported,

\hypersetup{ … } This will set the options to configure the behaviour of the links within the document. Every parameter must be comma-separated and the syntax must be in the forma parameter=value. \url #command to display the actual link \href #set a hidden link and show a word/sentence instead. i.e. \href{http://www.sharelatex.com}{Sharelatex}

From https://www.sharelatex.com/learn/Hyperlinks

24 indent size

It is possible to change the indent size. In the example, the first lines of each paragraph are indented 4em (an “em” equals the length of the “m” in the current font), this is accomplished by the command \setlength{\parindent}{4em}

25 Citation   citation

 

25.1 cite multiple reference

\cite{ahmed2013investigation, shen2015numerical}

26 package vs class file

.cls #class file .sty #package file

  • class: specify the structure of the ducument
  • package:

27 Packages

 

27.1 cite

cite.sty was written by Donald Arseneau

% \cite{} output to follow that of IAENG. Loading the cite package will % result in citation numbers being automatically sorted and properly % “compressed/ranged”. e.g., 1, 2, 3, 4, 5, 6 without using % cite.sty will become 1, 3, 54, 2 using cite.sty. cite.sty’s % \cite will automatically add leading space, if needed. Use cite.sty’s % noadjust option (cite.sty V3.8 and later) if you want to turn this off. % cite.sty is already installed on most LaTeX systems. Be sure and use % version 4.0 (2003-05-27) and later if using hyperref.sty.

cite.sty does not currently provide for hyperlinked citations. % The latest version cban be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/cite/ % The documentation is contained in the cite.sty file itself.

27.2 graphics

% graphics is required if you want graphics, photos, etc. graphicx.sty is already % installed on most LaTeX systems. The latest version and documentation can % be obtained at: % http://www.ctan.org/tex-archive/macros/latex/required/graphics/ % Another good source of documentation is “Using Imported Graphics in % LaTeX2e” by Keith Reckdahl which can be found as epslatex.ps or % epslatex.pdf at: http://www.ctan.org/tex-archive/info/ % % latex, and pdflatex in dvi mode, support graphics in encapsulated % postscript (.eps) format. pdflatex in pdf mode supports graphics % in .pdf, .jpeg, .png and .mps (metapost) formats. Users should ensure % that all non-photo figures use a vector format (.eps, .pdf, .mps) and % not a bitmapped formats (.jpeg, .png). IAENG frowns on bitmapped formats % which can result in “jaggedy”/blurry rendering of lines and letters as % well as large increases in file sizes. % % You can find documentation about the pdfTeX application at: % http://www.tug.org/applications/pdftex

% * MATH PACKAGES * % %\usepackage[cmex10]{amsmath} % A popular package from the American Mathematical Society that provides % many useful and powerful commands for dealing with mathematics. If using % it, be sure to load this package with the cmex10 option to ensure that % only type 1 fonts will utilized at all point sizes. Without this option, % it is possible that some math symbols, particularly those within % footnotes, will be rendered in bitmap form which will result in a % document that can not be IAENG compliant! % Also, note that the amsmath package sets \interdisplaylinepenalty to 10000 % thus preventing page breaks from occurring within multiline equations. Use: %\interdisplaylinepenalty=2500 % after loading amsmath to restore such page breaks as IAENGtran.cls normally % does. amsmath.sty is already installed on most LaTeX systems. The latest % version and documentation can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/

% * SPECIALIZED LIST PACKAGES * % %\usepackage{algorithmic} % algorithmic.sty was written by Peter Williams and Rogerio Brito. % This package provides an algorithmic environment for describing algorithms. % You can use the algorithmic environment in-text or within a figure % environment to provide for a floating algorithm. Do NOT use the algorithm % floating environment provided by algorithm.sty (by the same authors) or % algorithm2e.sty (by Christophe Fiorio) as IAENG does not use dedicated % algorithm float types and packages that provide these will not provide % correct IAENG style captions. The latest version and documentation of % algorithmic.sty can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/algorithms/ % There is also a support site at: % http://algorithms.berlios.de/index.html % Also of interest may be the (relatively newer and more customizable) % algorithmicx.sty package by Szasz Janos: % http://www.ctan.org/tex-archive/macros/latex/contrib/algorithmicx/

% * ALIGNMENT PACKAGES * % %\usepackage{array} % Frank Mittelbach’s and David Carlisle’s array.sty patches and improves % the standard LaTeX2e array and tabular environments to provide better % appearance and additional user controls. As the default LaTeX2e table % generation code is lacking to the point of almost being broken with % respect to the quality of the end results, all users are strongly % advised to use an enhanced (at the very least that provided by array.sty) % set of table tools. array.sty is already installed on most systems. The % latest version and documentation can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/required/tools/

27.3 mdmath

%\usepackage{mdwmath} %\usepackage{mdwtab} % Also highly recommended is Mark Wooding’s extremely powerful MDW tools, % especially mdwmath.sty and mdwtab.sty which are used to format equations % and tables, respectively. The MDWtools set is already installed on most % LaTeX systems. The lastest version and documentation is available at: % http://www.ctan.org/tex-archive/macros/latex/contrib/mdwtools/

27.4 array

%\usepackage{array} % Frank Mittelbach’s and David Carlisle’s array.sty patches and improves % the standard LaTeX2e array and tabular environments to provide better % appearance and additional user controls. As the default LaTeX2e table % generation code is lacking to the point of almost being broken with % respect to the quality of the end results, all users are strongly % advised to use an enhanced (at the very least that provided by array.sty) % set of table tools. array.sty is already installed on most systems. The % latest version and documentation can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/required/tools/

28 Package error

subcaption package is incompatible with the subfigure and subfig packages inputenc – Accept different input encodings babel – Multilingual support for Plain TeX or LaTeX The pack­age man­ages cul­tur­ally-de­ter­mined ty­po­graph­i­cal (and other) rules, and hy­phen­ation pat­terns for a wide range of lan­guages. A doc­u­ment may se­lect a sin­gle lan­guage to be sup­ported, or it may se­lect sev­eral, in which case the doc­u­ment may switch from one lan­guage to an­other in a va­ri­ety of ways.

From https://www.ctan.org/pkg/babel

Generated pdf file Check the folder of tex file, in my pc , it is document/TexDemo Sort the bibliography by citation order

From http://tex.stackexchange.com/questions/17354/sort-thebibliography-by-citation-order

\usepackage[square,                     numbers,                                     sort&amp; compress                %按先后顺序引用并压缩,如[3-5,8]             ]{natbib}

From http://bbs.ctex.org/forum.php?mod=viewthread&tid=37235 Keyboard shortcut

MiKTeX: The etoolbox pack­age is in­cluded in MiKTeX. Use the MiKTeX pack­age man­ager to in­stall it.

From https://www.ctan.org/tex-archive/macros/latex/contrib/etoolbox?lang=en

Biblatex not work in Texstudio

Problem description My test.tex file

* \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage[backend=biber]{biblatex} \addbibresource{sample.bib}

\begin{document} Let’s cite! The Einstein’s journal paper \cite{einstein} and the Dirac’s book \cite{dirac} are physics related items. \printbibliography \end{document}

* Error message * Citation ‘einstein’ on page 1 undefined Citation ‘dirac’ on page 1 undefined Empty bibliography There were undefined references. Please (re)run Biber on the file:(biblatex) test(biblatex) and rerun LaTeX afterwards. ** Answer: ** In the current release (2.6 branch), TeXstudio’s build process (‘Build & View’) by default runs pdfLaTeX but not a bibliography tool, which you need to do separately. There is also a need to change the settings to run Biber rather than BibTeX for creating a bibliography. Thus the steps required are as follows:

  1. In the TeXstudio preferences (‘Preferences …’ on the Mac or ‘Options -> Configure TeXstudio’ on Windows), choose the Build tab and alter the ‘Default Bibliography’ to ‘Biber’. Save and close the preferences.
  2. Run ‘Build & View’ from the ‘Tools’ menu (or press the two green arrows icon), which will create a PDF but with the bibliography not completed
  3. Run ‘Bibliography’ from the ‘Tools’ menu.
  4. Run ‘Build & View’ again: the bibliography will appear in the PDF.

It is possible to set up TeXstudio in alternative ways to achieve the same effect. The key is that you have to ensure that the is a sequence

  1. LaTeX
  2. Biber
  3. LaTeX

which can be done ‘by hand’ (as I have) or can be automated in various ways. Note that the same general idea applies whatever editor is used: this is a feature of LaTeX and not of the editor.

From http://tex.stackexchange.com/questions/154751/biblatex-with-biber-configuring-my-editor-to-avoid-undefined-citations/154754#154754

From http://tex.stackexchange.com/questions/153647/biblatex-biber-and-latex-citations-undefined

Biblatex not work in texstudio A:update miktex, unstall default miktex package in protext, download latest from web, install manually

Latex model for Elsevier journal paper https://www.elsevier.com/authors/author-schemas/latex-instructions

Online latex, ShareLaTeX, Overleaf

Source Code Listings include the source code of any programming language within your document

From https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

From https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings Emphasising text Text can be emphasized by using \emph command. Sometimes the \emph command behaves just as \textit, but is not exactly the same:

What the \emph command actually does with its argument depends on the context – inside normal text the emphasized text is italicized, but this behaviour is reversed if used inside an italicized text- see example above:

From https://www.sharelatex.com/learn/Bold,_italics_and_underlining

Why should I put a ~ before \ref or \cite?

The ~ is a non-breaking space, (not really a symbol) so when you write in your text Table~\ref{mytable} it ensures that the Table part is kept together with the number.

From https://tex.stackexchange.com/questions/9633/why-should-i-put-a-before-ref-or-cite

From https://tex.stackexchange.com/questions/9633/why-should-i-put-a-before-ref-or-cite

List of Symbols?

From https://tex.stackexchange.com/questions/74451/list-of-symbols

28.1 Why should I put a*~* before \ref or \cite?

~ #non-breaking space ~ is called a tie because it ties two words together like in Section~\ref{sec:intro}. The tie causes TeX never to break a line at a tie.

28.2 Package subcaption Error: This package can’t be used in cooperation(subcaption) with the subfigure package. \subcaption@CheckCompatibility

don’t use subcaption and subfigure at the same times

28.3 Missing number, treated as zero. \begin{subfigure}[b]{0.4\textwidth}

28.4 Illegal unit of measure (pt inserted). \begin{subfigure}[b]{0.4\textwidth}

29 Math

\[ \dot{a} \hat{a} \]

29.1 Underbrace

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath\begin{document}
\[
\underbrace{u'-P(x)u^2-Q(x)u-R(x)}_{\text{=0, since ~$u$ is a particular solution.}}
\]
\end{document}

Latex Notes

29.2 example

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amssymb,amsmath}

\title{Lecture two} \author{Ivan Toma\v{s}i\’c } \date{September 2017}

\begin{document} \maketitle \section{Separating maths from text} 2. dfshfhksgsf fdgh hd hkslgdhjsdj;ldjfg dfg df d;flk gjkl;dfgkl;dsfg TeX strictly separates mathematical formulae/symbols from the surrounding text. There are \begin{itemize} \item INLINE maths formulae; \item DISPLAYED maths formulae. \end{itemize} For example, Pythagoras said the following. Let \(a\), \(b\), \(c\) be the sides of a right-angled triangle, where \(c\) is the hypothenuse. Then \(a^2+b^2=c^2\). Fermat conjectured that the equation $$ x^n+y^n=z^n $$ does not have integer solutions \(x\), \(y\), \(z\) for \(n\geq 3\). ALL MATH SYMBOLS MUST be enclosed within \$ signs or \\(\\) signs. BAD: The solutions to the equation \(x^2=1\) in variable x are \(x_{1,2}=\pm 1\). Compare \(a\) and a. \section{Spaces, paragraphs, commas, fullstops} Adding superfluous spaces does nothing. We open a new paragraph by inserting one or more blank lines, and the new paragraph is slightly indented. New paragraph, daskjghgdlkjahgsfhaldhfkjlsadhflkjha d fads fsad f asdf asd f asdfas df asg fdg dsfg sd fg dfg sdfg sdfg sdf gfs dg sdfg sdf gsd fg sdfg sdfgsd. After a comma or a fullstop, we always insert a space. TeX then knows what to do. BAD: Compare to the following,where we didn’t.This does not look good at all! \section{The appearance of text} Text can be {\bf bold}, {\it italic}, {\sl slanted} or {\sc small caps}. When we define things, we usually emphasise the word we are defining using \emph{word}. For example: a positive integer is \emph{prime}, if it has no proper divisors. We can make it {\large large} or {\small small}, or even {\Large Larger} or {\tiny smaller}. Usually it is not a good idea to go wild with mixing up these features, these ought to be used in moderation, and consistently. In particular, there is no point sometimes emphasizing things using boldface and sometimes using italic font. \section{Itemize and enumerate} Should you wish to give a list of bulletpoints, use: \begin{itemize} \item first item; \item second item; \item third item. \end{itemize} If you prefer to have a numbered list, use: \begin{enumerate} \item first item; \item second item; \item third item. \end{enumerate} \section{Mathematical formulae and expressions} Superscripts are easy: $$ x^n, \ \ \ {n^n}^n, n^{n^{n^n}}. $$ Subscripts too: $$ x_n, \ \ \ a_{i_j}, \ \ \ a_{ij} \ \ \ a_{11,12}. $$ Note that curly braces are used to group objects together in TeX source, so they are not visible. The different types of brackets are typeset like this: $$ (), \ \ \ \ [ ], \ \ \ \ \{ \} $$ Larger brackets are obtained as follows: $$ \left( \frac{a}{b}+\frac{c}{d}\right)^2. $$ For Greek letters, you just need to know what they are called, and then $$ \alpha, \beta, \gamma, \delta, \epsilon\ldots $$ You have seen that the ellipsis operator is called \(\ldots\) (compare to …), and sometimes we also use \(\cdots\) to continue a sequence of arithmetical operations. In order to typeset the `blackboard bold’ symbols for the most common number systems, we must include the package \verb+amssymb+, and this is done using the command \verb+\usepackage{amssymb}+ in the preamble (near the start of the document). So we get our friends $$ \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}, \mathbb{C}. $$ As seen above, fractions are obtained as $$ \frac{a}{b}+\frac{c}{d}=\frac{ad+bc}{bd}. $$ Sums: $$\sum_{n=1}^{\infty} 2^{-n} = 1$$ Products: $$ n!=\prod_{i=1}^{n}i. $$ Integrals: $$ \int x\, dx=\frac{x^2}{2}+C, \ \text{ so }\ \int_0^1 x\, dx=\frac{1}{2}. $$ A combination: $$ \zeta(s)=\sum_{n=1}^\infty n^{-s}=\prod_{p\text{ prime}}\frac{1}{1-p^{-s}}=\frac{1}{\Gamma(s)}\int_0^\infty \frac{x^s}{e^x-1}\frac{dx}{x}. $$ Matrices: $$A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} $$ $$ M = \begin{bmatrix} \frac{5}{6} & \frac{1}{6} & 0 \\[0.3em] \frac{5}{6} & 0 & \frac{1}{6} \\[0.3em] 0 & \frac{5}{6} & \frac{1}{6} \end{bmatrix} $$ \end{document}

29.3 text in Eq.

two equations in a line

two equations in a same row \mbox{ and }

e.g.

\begin{equation} a=\frac{1}{3} \quad \mbox{ and } \quad a’ =\frac{a(1-a)}{TSR^2x^2} \end{equation}

https://www.andy-roberts.net/res/writing/latex/textineqn.pdf

29.4 equations

 

29.4.1 unnumbered equation

$$ \theta_c[k+1]=\theta_c[k]+Tu_p[k] $$

29.5 volume and surface integral

\[ \[
\iiint_V \left( \mathbf{\nabla}\cdot\mathbf{F} \right)\,dV=\oiint_S (\mathbf{F}\cdot\mathbf{n})\,dS
\]

\[ \iiint_V \left( \mathbf{\nabla}\cdot\mathbf{F} \right)\,dV=\oiint_S (\mathbf{F}\cdot\mathbf{n})\,dS \]

30 Symbol

Soldworks \(^{\textregistered}\)

30.1 list of symbols

C:\akmkemin\Backup\software tutorial\LATEX\ \otimesx

ν \nu
   

μ υ ℧ \mathscr{v} \(\propto\)

\(\infty\)

\(\ne\)

\(\approx\)

\(\sim\) : same order of magnitude

\(\bar{a}\) https://en.wikipedia.org/wiki/List_of_mathematical_symbols

∏ products of sequences, Capital Pi notation,

30.1.1 vertical bar

What’s the difference between the different vertical bars?

\mid, | (vertical bar), |, \lvert, \rvert, \divides

30.2 How to look up a symbol or identify a math symbol or character?

I know what my symbol or character looks like, but I don’t know what the command is or which math alphabet it came from. How do I go about finding this out?

answer:

31 Bibliography

 

31.1 Cite an URL web page

There isn’t any @website entry option for BibTeX. So, we have to make use of another entry type—we’ll use @misc. In order to do this, make sure that \usepackage{url} is in your preamble

@misc For use when nothing else fits. Required fields: none Optional fields: author, title, howpublished, month, year, note

31.1.1 BibTex

@misc{seaGen, title = {SeaGen S}, howpublished = {\url{http://www.marineturbines.com/SeaGen-Products/SeaGen-S }}, note = {Accessed: 2015-05-30} }

@misc{knuthwebsite, author = “Donald Knuth”, title = “Knuth: Computers and Typesetting”, url = “http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html

31.1.2 BibLaTex

@online{WinNT, author = {MultiMedia LLC}, title = {{MS Windows NT} Kernel Description}, year = 1999, url = {http://web.archive.org/web/20080207010024/http://www.808multimedia.com/winnt/kernel.htm}, urldate = {2010-09-30} }

31.2 bibtex

31.3 technical report citation in bibtex

@techreport{}

Format:

@TECHREPORT{citationkey, requiredfields [, optionalfields] }

Required fields: author, title, institution, year

Optional fields: type, number, address, month, note, key https://nwalsh.com/tex/texhelp/bibtx-20.html

Standard entry types

article Article from a magazine or journal

book A published book

booklet A work that is printed but have no publisher or sponsoring institution

conference An article in a conference proceedings

inbook A part of a book (section, chapter and so on)

incollection A part of a book having its own title

inproceedings An article in a conference proceedings

manual Technical documentation

masterthesis A Master’s thesis

misc Something that doesn’t fit in any other type

phdthesis A PhD thesis

proceedings The same as conference

techreport Report published by an institution

unpublished Document not formally published, with author and title

https://www.overleaf.com/learn/latex/Bibliography_management_with_bibtex

32 Macro

Macro
user defined commands

Format: \newcommand{\name}[no_of_parameters]{defn_of_command}

33 Templates for journal & Book

 

33.1 Springer book

https://www.springer.com/gp/authors-editors/book-authors-editors/manuscript-preparation/5636

33.2 figure and tables

Large figures and tables may span both columns. Place figure captions below the figures; place table titles above the tables. If your figure has two parts, include the labels “(a)” and “(b)” as part of the artwork. Please verify that the figures and tables you mention in the text actually exist.

33.3 IAENG example

%% IAENGtran contains the IAENGeqnarray family of commands that can be used to % generate multiline equations as well as matrices, tables, etc., of high % quality.

%\usepackage{eqparbox} % Also of notable interest is Scott Pakin’s eqparbox package for creating % (automatically sized) equal width boxes – aka “natural width parboxes”. % Available at: http://www.ctan.org/tex-archive/macros/latex/contrib/eqparbox/

% * SUBFIGURE PACKAGES * %\usepackage[tight,footnotesize]{subfigure} % subfigure.sty was written by Steven Douglas Cochran. This package makes it % easy to put subfigures in your figures. e.g., “Figure 1a and 1b”. For IAENG % work, it is a good idea to load it with the tight package option to reduce % the amount of white space around the subfigures. subfigure.sty is already % installed on most LaTeX systems. The latest version and documentation can % be obtained at: % http://www.ctan.org/tex-archive/obsolete/macros/latex/contrib/subfigure/ % subfigure.sty has been superceeded by subfig.sty.

%\usepackage{caption} %\usepackage[font=footnotesize]{subfig} % subfig.sty, also written by Steven Douglas Cochran, is the modern % replacement for subfigure.sty. However, subfig.sty requires and % automatically loads Axel Sommerfeldt’s caption.sty which will override % IAENGtran.cls handling of captions and this will result in nonIAENG style % figure/table captions. To prevent this problem, be sure and preload % caption.sty with its “caption=false” package option. This is will preserve % IAENGtran.cls handing of captions. Version 1.3 (2005/06/28) and later % (recommended due to many improvements over 1.2) of subfig.sty supports % the caption=false option directly: %\usepackage{subfig} % % The latest version and documentation can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/ % The latest version and documentation of caption.sty can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/caption/

% * FLOAT PACKAGES * % %\usepackage{fixltx2e} % fixltx2e, the successor to the earlier fix2col.sty, was written by % Frank Mittelbach and David Carlisle. This package corrects a few problems % in the LaTeX2e kernel, the most notable of which is that in current % LaTeX2e releases, the ordering of single and double column floats is not % guaranteed to be preserved. Thus, an unpatched LaTeX2e can allow a % single column figure to be placed prior to an earlier double column % figure. The latest version and documentation can be found at: % http://www.ctan.org/tex-archive/macros/latex/base/

%\usepackage{stfloats} % stfloats.sty was written by Sigitas Tolusis. This package gives LaTeX2e % the ability to do double column floats at the bottom of the page as well % as the top. (e.g., “\begin{figure*}[!b]” is not normally possible in % LaTeX2e). It also provides a command: %\fnbelowfloat % to enable the placement of footnotes below bottom floats (the standard % LaTeX2e kernel puts them above bottom floats). This is an invasive package % which rewrites many portions of the LaTeX2e float routines. It may not work % with other packages that modify the LaTeX2e float routines. The latest % version and documentation can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/sttools/ % Documentation is contained in the stfloats.sty comments as well as in the % presfull.pdf file. Do not use the stfloats baselinefloat ability as IAENG % does not allow \baselineskip to stretch. Authors submitting work to the % IAENG should note that IAENG rarely uses double column equations and % that authors should try to avoid such use. Do not be tempted to use the % cuted.sty or midfloat.sty packages (also by Sigitas Tolusis) as IAENG does % not format its papers in such ways.

%\ifCLASSOPTIONcaptionsoff % \usepackage[nomarkers]{endfloat} % \let\MYoriglatexcaption\caption % \renewcommand{\caption}[2][\relax]{\MYoriglatexcaption[#2]{#2}} %\fi % endfloat.sty was written by James Darrell McCauley and Jeff Goldberg. % This package may be useful when used in conjunction with IAENGtran.cls’ % captionsoff option. Some IAENG journals/societies require that submissions % have lists of figures/tables at the end of the paper and that % figures/tables without any captions are placed on a page by themselves at % the end of the document. If needed, the draftcls IAENGtran class option or % \CLASSINPUTbaselinestretch interface can be used to increase the line % spacing as well. Be sure and use the nomarkers option of endfloat to % prevent endfloat from “marking” where the figures would have been placed % in the text. The two hack lines of code above are a slight modification of % that suggested by in the endfloat docs (section 8.3.1) to ensure that % the full captions always appear in the list of figures/tables – even if % the user used the short optional argument of \caption[]{}. % IAENG papers do not typically make use of \caption[]’s optional argument, % so this should not be an issue. A similar trick can be used to disable % captions of packages such as subfig.sty that lack options to turn off % the subcaptions: % For subfig.sty: % \let\MYorigsubfloat\subfloat % \renewcommand{\subfloat}[2][\relax]{\MYorigsubfloat[]{#2}} % For subfigure.sty: % \let\MYorigsubfigure\subfigure % \renewcommand{\subfigure}[2][\relax]{\MYorigsubfigure[]{#2}} % However, the above trick will not work if both optional arguments of % the \subfloat/subfig command are used. Furthermore, there needs to be a % description of each subfigure somewhere and endfloat does not add % subfigure captions to its list of figures. Thus, the best approach is to % avoid the use of subfigure captions (many IAENG journals avoid them anyway) % and instead reference/explain all the subfigures within the main caption. % The latest version of endfloat.sty and its documentation can obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/endfloat/ % % The IAENGtran \ifCLASSOPTIONcaptionsoff conditional can also be used % later in the document, say, to conditionally put the References on a % page by themselves.

% * PDF, URL AND HYPERLINK PACKAGES * % %\usepackage{url} % url.sty was written by Donald Arseneau. It provides better support for % handling and breaking URLs. url.sty is already installed on most LaTeX % systems. The latest version can be obtained at: % http://www.ctan.org/tex-archive/macros/latex/contrib/misc/ % Read the url.sty source comments for usage information. Basically, % \url{my_url_here}.

% * Do not adjust lengths that control margins, column widths, etc. * % * Do not use packages that alter fonts (such as pslatex). * % There should be no need to do such things with IAENGtran.cls V1.6 and later. % (Unless specifically asked to do so by the journal or conference you plan % to submit to, of course. )

% correct bad hyphenation here % \hyphenation{op-tical net-works semi-conduc-tor}

33.4 reference

http://www.michaelshell.org/tex/

34 IAENG journal style

 

34.1 Appendix

if have a single appendix: \appendix[Proof of the Zonklar Equations] or \appendix for no appendix heading

do not use \section anymore after \appendix, only \section* is possibly needed

use appendices with more than one appendix then use \section to start each appendix you must declare a \section before using any \subsection or using \label (\appendices by itself starts a section numbered zero.)

34.2 table

An example of a floating table. Note that, for IAENG style tables, the \caption command should come BEFORE the table. Table text will default to % \footnotesize as IAENG normally uses this smaller font for tables. % The \label must come after \caption as always. % %\begin{table}[!t] %% increase table row spacing, adjust to taste %\renewcommand{\arraystretch}{1.3} % if using array.sty, it might be a good idea to tweak the value of % \extrarowheight as needed to properly center the text within the cells %\caption{An Example of a Table} %\label{table_example} %\centering %% Some packages, such as MDW tools, offer better commands for making tables %% than the plain LaTeX2e tabular which is used here. %\begin{tabular}{|c||c||c|} %\hline %One & Two & Five
%\hline
%Two & Four & Ten
%\hline
%\end{tabular}
%\end{table}

34.2.1 example

\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{An Example of a Table} \label{table_example}
\centering
\begin{tabular}{|c||c||c|}
% horizontal line
\hline

One & Two & Five\\
\hline
Two & Four & Ten\\
\hline
\end{tabular}
\end{table}

34.3 Float packages

\usepackage{fixltx2e}

fixltx2e, the successor to the earlier fix2col.sty, was written by Frank Mittelbach and David Carlisle.
This package corrects a few problems in the LaTeX2e kernel, the most notable of which is that in current
LaTeX2e releases, the ordering of single and double column floats is not guaranteed to be preserved.
Thus, an unpatched LaTeX2e can allow a single column figure to be placed prior to an earlier double column figure.
The latest version and documentation can be found at:
http://www.ctan.org/tex-archive/macros/latex/base/

34.4 subfigures: one on top of another

  • increase the widths of the graphs, 1\textwidth
  • use subcaption package rather than subfigure

e.g.
\usepackage{subcaption}

\begin{figure}[h]
\centering
\begin{subfigure}{0.5 \textwidth}
\includegraphics[width=\linewidth]{fig/2r_tsr55_e387}
\caption{}
\label{fig:Ng1}
\end{subfigure}

\begin{subfigure}{0.5 \textwidth}
\includegraphics[width=\linewidth]{fig/5r_tsr55_e387}
\caption{}
\label{fig:Ng2}
\end{subfigure}

\end{figure}

34.5 Packages

 

34.5.1 subfigure, subfig

subfigure.sty has been superceeded by subfig.sty.

This package makes it easy to put subfigures in your figures. e.g., “Figure 1a and 1b”.
For IAENG work, it is a good idea to load it with the tight package option to reduce the amount of white space around the subfigures.

The latest version and documentation can be obtained at:
http://www.ctan.org/tex-archive/obsolete/macros/latex/contrib/subfigure/

subfig.sty is the modern replacement for subfigure.sty.

\usepackage{caption}
\usepackage[font=footnotesize]{subfig}

However, subfig.sty requires and automatically loads Axel Sommerfeldt’s caption.sty
which will override IAENGtran.cls handling of captions and this will result in nonIAENG style
figure/table captions.

To prevent this problem, be sure and preload caption.sty with its “caption=false” package option.
This is will preserve IAENGtran.cls handing of captions. Version 1.3 (2005/06/28) and later
(recommended due to many improvements over 1.2) of subfig.sty supports
the caption=false option directly:

\usepackage{subfig}

The latest version and documentation can be obtained at:
http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/
The latest version and documentation of caption.sty can be obtained at:
http://www.ctan.org/tex-archive/macros/latex/contrib/caption/

35 Reference

https://www.andy-roberts.net/writing/latex
https://www.latex-project.org/
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/LaTeX_intro.html

Footnotes:

1

DEFINITION NOT FOUND.

2

DEFINITION NOT FOUND.

3

DEFINITION NOT FOUND.

4

DEFINITION NOT FOUND.

5

DEFINITION NOT FOUND.

6

DEFINITION NOT FOUND.

Author: kemina

Created: 2019-03-20 Wed 15:20

Emacs 24.5.1 (Org mode 8.2.10)

Validate

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,001
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,772
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,850