text:
A Short Journey with LaTeX

2011-08-30 by . 8 comments

Like many open-source aficionados, I’ve used LaTeX for quite some time. I have at least used it to typeset my CV (using europecv and later moderncv) and church songs and hymns (using songbook and gchords). While I liked what LaTeX produced, I was under the idea (like many) that TeX was an old lady of a software, a bit rusted and certainly not very active. My recent experience with LaTeX proved me very wrong.

When I decided, a few months back, to start publishing books with LaTeX, little did I suspect to find such a vibrant, dynamic, active community with a fully alive software stack!

Back to basics with PDFTex

About 6 months ago, I started writing a book about Augeas. Following the example of the Git Pro book, I began writing the book in markdown to keep it simple. However, I soon had the need to typeset computer code with syntax highlighting for Augeas code, a syntax not supported by any known highlighter, so it brought me to use minted and define my own syntax. I then started adding index entries to the book.

After that was done, the amount of LaTeX embedded in the markdown code was just too much, and I simply switched the whole project to plain LaTeX and rendered it using pdflatex. I had never typeset more than a few pages in LaTeX, so that was my first big project using it.

Tikz and the CTAN

After gaining some confidence with the Augeas book (which has yet to be finished), I decided I could edit and publish a theology book I had been translating, as well as a daily devotional my pastor had translated. I naturally began rendering them with pdflatex. I happily discovered that the bibleref package could help me typeset Bible references in LaTeX and even generate automated indexes of Bible references.

For the devotional, I had a need to typeset thumbs with the month names on the border of all odd pages. With the help of the TeX.SX users, I was advised to turn to tikz for this, and thus created my very first CTAN package, fancytabs.

XeTeX

As the theology books were getting edited and prepared for printing, I wanted to adapt the fonts used. For one book in particular, I wanted to use proprietary truetype fonts that were used on the cover of the book (which is composed using Inkscape). So I was advised to turn to XeTeX, for its great capabilities to use system fonts. I then discovered about OTF fonts, and how it could achieve many of the OT1 features (such as ligatures) and more using OTF.

Playing with OTF fonts in XeTeX got me to publish the fontbook and babyloniannum packages (as answers to TeX.SX questions), and start a demo project using the EB Garamond open-source font’s OpenType capabilities to reproduce a 16th century Bible.

TeXLive and software packages

Being an Ubuntu developer, I tend to use only software packages to install anything on my systems, and package the software that are missing in the official archive. However, after switching to XeTeX, I had more and more needs for up-to-date LaTeX packages and rendering engines, and Ubuntu only had TexLive 2009. TeXLive is hard to package and split, so most Linux distributions are lagging behind on it. Packaging TexLive 2011 for my own need seemed like too much work (for now), so I gave up and installed TeXLive 2011 the traditional way.

LuaTeX

One thing that soon frustrated me with XeTeX was its lack of support for microtype features. Sure, there was a beta version of microtype with XeTeX support. It added font protrusion, but I still had to fix lots of overfull lines manually for the lack of font expansion. This is what brought me to LuaTeX.

So finally (for now), after migrating to TexLive 2011, I began converting my documents to LuaTeX. I had a few issues with font tracking and microtype, but all in all, I’m really quite happy to have gotten there (and I’m not even making use of Lua just yet).

This short journey with LaTeX has gotten me to use 3 rendering engines (in order of appearance), commit 4 new packages to the CTAN and contribute to one existing package. It has also gotten me to discover a vibrant, active and welcoming community of users and developers, and a collection of software which is all but dying. I’m looking forward to where TeX will take me next!

Filed under LaTeX TeX.sx

• N.N. says:

Nice post! Just a slight correction, in the first sentence under the heading “TeXLive and software packages” I guess software is misspelled.

• jemp says:

Incredible how similar your TeX experiences are to mine! :) Like you, I intended to use the system to typeset a book. I started with PDFTex, then switched to XeTeX to use an OpenType font easily, then was frustrated by the lack of microtype support in XeTeX, then discovered the beta version of microtype, then realized that my ‘Ubuntu-supported’ TeXLive is too old for this version of microtype, then was deeply saddened by the fact that when using XeTeX, I have to say goodbye to font expansion.

So as your post shows, it almost seems natural to turn to LuaTex now :) One thing that has stopped me from doing so is that LuaTeX offers no polyglossia support. Now, if I understand you rightly, the books you typeset are in French, like “Calvinisme, Arminianisme & Parole de Dieu” (which, by the way, is a display of some beautiful typography in my opinion). So how do you cope with hyphenation in your French-language documents typeset in LuaTeX?

• Very interesting indeed. As far as hyphenation goes, I’m still using babel (frenchb in this case) as I’m satisfied with it, so it hasn’t been a problem for me with LuaTeX.

• jemp says:

Thanks for the answer! For some mysterious reason I was convinced LuaTeX didn’t support babel. But because it actually does, then I can take the next step in my LaTeX journey :)

• Well, for the few cases where there’s still a need for hyphenation when using microtype with font expansion, babel works fine for me :-) Enjoy the journey!

• barbara beeton says:

agree with N.N. — nice post!

a small niggle. in the last paragraph it says “all by dying”. i hope that’s “all but dying”! i’m not ready to throw in the towel yet!


text:
### 统计代写|python代考|Growing Lists by Appending Sequences

Python是一种高级的、解释性的、通用的编程语言。它的设计理念强调代码的可读性，使用大量的缩进。

Python是动态类型的，并且是垃圾收集的。它支持多种编程范式，包括结构化（特别是程序化）、面向对象和函数式编程。由于其全面的标准库，它经常被描述为一种 “包含电池 “的语言。

statistics-lab™ 为您的留学生涯保驾护航 在代写python方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写python代写方面经验极为丰富，各种代写python相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|python代考|Growing Lists by Appending Sequences

Suppose you have two lists that you want to join together. You haven’t been shown a purposely built way to do that yet. You can’t use append to take one sequence and add it to another. Instead, you will find that you have layered a sequence into your list:
$>>>$ living_room $=($ “rug”, “table”, “chair”, “TV”, “dustbin”, “shelf”)

apartment $=[1]$
$>>>$ apartment.append(living_room)
$>>$ apartment
[(‘rug’, ‘table’, ‘chair’, ‘TV’, ‘dustbin’, ‘shelf’)]
This is probably not what you want if you were intending to create a list from the contents of the tuple living_room that could be used to create a list of all the items in the apartment.

To copy all of the elements of a sequence, instead of using append, you can use the extend method of lists and tuples, which takes each element of the sequence you give it and inserts those elements into the list from which it is called:
$>>>$ apartment $=[1]$

apartment.extend(1iving_room)
$>>$ apartment = []
$>>$ apartment. extend(living_room)
$>>$ apartment
[‘rug’, ‘table’, ‘chair’, ‘TV’, ‘dustbin’, ‘shelf’]
$>>>$ apartment
[‘rug’, ‘table’, ‘chair’, ‘TV’, ‘dustbin’, ‘shelf’]

## 统计代写|python代考|Using Lists to Temporarily Store Data

You’ll often want to acquire data from another source, such as a user entering data or another computer whose information you need. To do that, it is best to put this data in a list so that it can be processed later in the same order in which it arrived.

However, after you’ve processed the data, you no longer need it to be in the list, because you won’t need it again. Temporal (time-specific) information such as stock tickers, weather reports, or news headlines would be in this category.

To keep your lists from becoming unwieldy, a method called pop enables you to remove a specific reference to data from the list after you’re done with it. When you’ve removed the reference, the position it occupied will be filled with whatever the next element was, and the list will be reduced by as many elements as you’ve popped.

## 统计代写|python代考|Popping Elements from a List

When a value is popped, if the action is on the right-hand side of an equals sign, you can assign the element that was removed to a value on the left-hand side, or just use that value in cases where it would be appropriate. If you don’t assign the popped value or otherwise use it, it will be discarded from the list.
You can also avoid the use of an intermediate name, by just using pop to populate, say, a string format, because pop will return the specified element in the list, which can be used just as though you’d specified a number or a name that referenced a number:

print “Afternoon temperature was 호. $02 \mathrm{f}$ ” 와 todays_temperatures.pop(0)
Afternoon temperature was $31.00$
print “Afternoon temperature was $8.02 \mathrm{f}$ ” of todays
Afternoon temperature was $31.00$
$>>>$ todays_temperatures
${[29] }$
$\rightarrow>$ todays_temperatures
[29]
If you don’t tell pop to use a specific element ( 0 in the examples) from the list it’s invoked from, it will remove the last element of the list, not the first as shown here.

In this chapter, you learned how to manipulate many core types that Python offers. These types are tuples, lists, dictionaries, and three special types: None, True, and False. You’ve also learned a special way that strings can be treated like a sequence. The other sequence types are tuples and lists.

A tuple is a sequence of data that’s indexed in a fixed numeric order, starting at zero. The references in the tuple can’t be changed after the tuple is created. Nor can it have elements added or deleted. However, if a tuple contains a data type that has changeable elements, such as a list, the elements of that data type are not prevented from changing. Tuples are useful when the data in the sequence is better off not changing, such as when you want to explicitly prevent data from being accidentally changed.

A list is another type of sequence, which is similar to a tuple except that its elements can be modified. The length of the list can be modified to accommodate elements being added using the append method, and the length can be reduced by using the pop method. If you have a sequence whose data you want to append to a list, you can append it all at once with the extend method of a list.

## 统计代写|python代考|Growing Lists by Appending Sequences

>>>客厅=(“地毯”、“桌子”、“椅子”、“电视”、“垃圾箱”、“架子”）

>>>公寓。附加（客厅）
>>apartment
[(‘rug’, ‘table’, ‘chair’, ‘TV’, ‘dustbin’, ‘shelf’)]

>>>公寓=[1]

>>公寓 = []
>>公寓。扩展（客厅）
>>公寓
[‘地毯’, ‘桌子’, ‘椅子’, ‘电视’, ‘垃圾箱’, ‘架子’]
>>>公寓
[‘地毯’, ‘桌子’, ‘椅子’, ‘电视’, ‘垃圾箱’, ‘架子’]

## 统计代写|python代考|Popping Elements from a List

>>>今天_温度
[29]
→>todays_temperatures
[29]

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。

format: plain


text:
Q. There 5 students in the class and there are 5 cricket bats and 5 football. If Rohan and Sunil come to pick up. Then find the probability if each of them pick up cricket bat.
A) 3/9
B) 2/9
C) 5/9
D) 1/9

### Related Questions

Q. There 5 students in the class and there are 5 cricket bats and 5 football. If Rohan and Sunil come to pick up. Then find the probability if each of them pick up cricket bat.
A) 3/9
B) 2/9
C) 5/9
D) 1/9
Today's Challenging Question
Q. Ajay & Bimal can do a price of work in 10 days, Bimal & Chetan can do in 15 days and Chetan and Ajay in 20 days. They work together for 6 days and then Ajay leaves and now Bimal & Chetan work together for 4 more days. If Bimal leaves, how long will Chetan take to finish the work?
A) 12 days
B) 10 days
C) 16 days
D) none
1 members solved


text:
### 33.35.6 Regularity

Here is the definition.

Definition 33.35.7. Let $k$ be a field. Let $n \geq 0$. Let $\mathcal{F}$ be a coherent sheaf on $\mathbf{P}^ n_ k$. We say $\mathcal{F}$ is $m$-regular if

$H^ i(\mathbf{P}^ n_ k, \mathcal{F}(m - i)) = 0$

for $i = 1, \ldots , n$.

Note that $\mathcal{F} = \mathcal{O}(d)$ is $m$-regular if and only if $d \geq -m$. This follows from the computation of cohomology groups in Cohomology of Schemes, Equation (30.8.1.1). Namely, we see that $H^ n(\mathbf{P}^ n_ k, \mathcal{O}(d)) = 0$ if and only if $d \geq -n$.

Lemma 33.35.8. Let $k'/k$ be an extension of fields. Let $n \geq 0$. Let $\mathcal{F}$ be a coherent sheaf on $\mathbf{P}^ n_ k$. Let $\mathcal{F}'$ be the pullback of $\mathcal{F}$ to $\mathbf{P}^ n_{k'}$. Then $\mathcal{F}$ is $m$-regular if and only if $\mathcal{F}'$ is $m$-regular.

Proof. This is true because

$H^ i(\mathbf{P}^ n_{k'}, \mathcal{F}') = H^ i(\mathbf{P}^ n_ k, \mathcal{F}) \otimes _ k k'$

by flat base change, see Cohomology of Schemes, Lemma 30.5.2. $\square$

Lemma 33.35.9. In the situation of Lemma 33.35.3, if $\mathcal{F}$ is $m$-regular, then $\mathcal{G}$ is $m$-regular on $H \cong \mathbf{P}^{n - 1}_ k$.

Proof. Recall that $H^ i(\mathbf{P}^ n_ k, i_*\mathcal{G}) = H^ i(H, \mathcal{G})$ by Cohomology of Schemes, Lemma 30.2.4. Hence we see that for $i \geq 1$ we get

$H^ i(\mathbf{P}^ n_ k, \mathcal{F}(m - i)) \to H^ i(H, \mathcal{G}(m - i)) \to H^{i + 1}(\mathbf{P}^ n_ k, \mathcal{F}(m - 1 - i))$

by Remark 33.35.5. The lemma follows. $\square$

Lemma 33.35.10. Let $k$ be a field. Let $n \geq 0$. Let $\mathcal{F}$ be a coherent sheaf on $\mathbf{P}^ n_ k$. If $\mathcal{F}$ is $m$-regular, then $\mathcal{F}$ is $(m + 1)$-regular.

Proof. We prove this by induction on $n$. If $n = 0$ every sheaf is $m$-regular for all $m$ and there is nothing to prove. By Lemma 33.35.8 we may replace $k$ by an infinite overfield and assume $k$ is infinite. Thus we may apply Lemma 33.35.3. By Lemma 33.35.9 we know that $\mathcal{G}$ is $m$-regular. By induction on $n$ we see that $\mathcal{G}$ is $(m + 1)$-regular. Considering the long exact cohomology sequence associated to the sequence

$0 \to \mathcal{F}(m - i) \to \mathcal{F}(m + 1 - i) \to i_*\mathcal{G}(m + 1 - i) \to 0$

as in Remark 33.35.5 the reader easily deduces for $i \geq 1$ the vanishing of $H^ i(\mathbf{P}^ n_ k, \mathcal{F}(m + 1 - i))$ from the (known) vanishing of $H^ i(\mathbf{P}^ n_ k, \mathcal{F}(m - i))$ and $H^ i(\mathbf{P}^ n_ k, \mathcal{G}(m + 1 - i))$. $\square$

Lemma 33.35.11. Let $k$ be a field. Let $n \geq 0$. Let $\mathcal{F}$ be a coherent sheaf on $\mathbf{P}^ n_ k$. If $\mathcal{F}$ is $m$-regular, then the multiplication map

$H^0(\mathbf{P}^ n_ k, \mathcal{F}(m)) \otimes _ k H^0(\mathbf{P}^ n_ k, \mathcal{O}(1)) \longrightarrow H^0(\mathbf{P}^ n_ k, \mathcal{F}(m + 1))$

is surjective.

Proof. Let $k'/k$ be an extension of fields. Let $\mathcal{F}'$ be as in Lemma 33.35.8. By Cohomology of Schemes, Lemma 30.5.2 the base change of the linear map of the lemma to $k'$ is the same linear map for the sheaf $\mathcal{F}'$. Since $k \to k'$ is faithfully flat it suffices to prove the lemma over $k'$, i.e., we may assume $k$ is infinite.

Assume $k$ is infinite. We prove the lemma by induction on $n$. The case $n = 0$ is trivial as $\mathcal{O}(1) \cong \mathcal{O}$ is generated by $T_0$. For $n > 0$ apply Lemma 33.35.3 and tensor the sequence by $\mathcal{O}(m + 1)$ to get

$0 \to \mathcal{F}(m) \xrightarrow {s} \mathcal{F}(m + 1) \to i_*\mathcal{G}(m + 1) \to 0$

see Remark 33.35.5. Let $t \in H^0(\mathbf{P}^ n_ k, \mathcal{F}(m + 1))$. By induction the image $\overline{t} \in H^0(H, \mathcal{G}(m + 1))$ is the image of $\sum g_ i \otimes \overline{s}_ i$ with $\overline{s}_ i \in \Gamma (H, \mathcal{O}(1))$ and $g_ i \in H^0(H, \mathcal{G}(m))$. Since $\mathcal{F}$ is $m$-regular we have $H^1(\mathbf{P}^ n_ k, \mathcal{F}(m - 1)) = 0$, hence long exact cohomology sequence associated to the short exact sequence

$0 \to \mathcal{F}(m - 1) \xrightarrow {s} \mathcal{F}(m) \to i_*\mathcal{G}(m) \to 0$

shows we can lift $g_ i$ to $f_ i \in H^0(\mathbf{P}^ n_ k, \mathcal{F}(m))$. We can also lift $\overline{s}_ i$ to $s_ i \in H^0(\mathbf{P}^ n_ k, \mathcal{O}(1))$ (see proof of Lemma 33.35.2 for example). After substracting the image of $\sum f_ i \otimes s_ i$ from $t$ we see that we may assume $\overline{t} = 0$. But this exactly means that $t$ is the image of $f \otimes s$ for some $f \in H^0(\mathbf{P}^ n_ k, \mathcal{F}(m))$ as desired. $\square$

Lemma 33.35.12. Let $k$ be a field. Let $n \geq 0$. Let $\mathcal{F}$ be a coherent sheaf on $\mathbf{P}^ n_ k$. If $\mathcal{F}$ is $m$-regular, then $\mathcal{F}(m)$ is globally generated.

Proof. For all $d \gg 0$ the sheaf $\mathcal{F}(d)$ is globally generated. This follows for example from the first part of Cohomology of Schemes, Lemma 30.14.1. Pick $d \geq m$ such that $\mathcal{F}(d)$ is globally generated. Choose a basis $f_1, \ldots , f_ r \in H^0(\mathbf{P}^ n_ k, \mathcal{F})$. By Lemma 33.35.11 every element $f \in H^0(\mathbf{P}^ n_ k, \mathcal{F}(d))$ can be written as $f = \sum P_ if_ i$ for some $P_ i \in k[T_0, \ldots , T_ n]$ homogeneous of degree $d - m$. Since the sections $f$ generate $\mathcal{F}(d)$ it follows that the sections $f_ i$ generate $\mathcal{F}(m)$. $\square$

There are also:

• 4 comment(s) on Section 33.35: Coherent sheaves on projective space

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).


text:
# XGBoost (R Interface) throwing “label set cannot be empty” error

I am trying to use the XGBoost model to perform a multi-class classification over 40 classes.

The code is as follows:

xgb_params = list(colsample_bytree= 0.7,
subsample = 0.7,
eta = 0.05,
objective= 'multi:softmax',
max_depth= 5,
min_child_weight= 1,
eval_metric= "mlogloss", num_class = categoryclassnos,

fit.xgb = xgb.train(params = xgb_params,
data = dtrain,
nrounds = 500,
watchlist = list(train = dtrain, test=dtest),
print_every_n = 50)

However, I am getting the following error:

Check failed: (info.labels.size()) != (0) label set cannot be empty

I have reproduced the dataset and the R script here.

Any help/ pointers are deeply appreciated.

• In your code what does trainlabelsfactored <- as.integer(train\$primarydeptt) - 1 return – grldsndrs Jun 1 '17 at 19:02
• This returns an integer in the range [0,max] based on the factor values. XGBoost requires this range (starting from 0) for label. – Chints Jun 2 '17 at 1:45
• Continuing to explore this... As an attempt, I added label value in dtest parameter. The error went away... I still don't get the logic as there is unlikely to be a label tag available for test data set while predicting.. – Chints Jun 2 '17 at 9:53
• When creating the xgb.DMatrix (dtrain, dtest), specify the label parameter. – bradS Jun 27 '18 at 8:18

In python I needed to set the label param in dtrain = xgb.DMatrix(X_train,label=y_train,feature_names=cfg_col_X)
To train a model you need two things, your training data(a matrix of variables and observations) and your labels (the known classification of each observation in the training data). Perhaps the last column in your data is actually the label? If so you will to vertically split your dtrain so that parameter data= all columns but the last, and a parameter label= just the last column.
Once you have the model, you can use it to predict on data that doesn’t have labels and the output will be the labels.