\input in LaTeX

What not to do

Some people who are not as used to LaTeX write their books the following way:

  1. They write some articles with preambles. (This is fine.)
  2. To compile the whole document, they copy paste their source code and use \part{Chapter 1} \pagebreak to separate each chapter. (And this is if they’re efficient.)

The articles end up being fine, but the whole document is just a jumbled mess.

Here’s the better way.

\input

Here’s what you should do instead.

  1. Make a master document (which we will refer to as master.tex).
  2. Write your articles, but do not include the preamble (that is, do not define theorems, environments, and do not include \begin{document} or \maketitle, among other things). These will be part1.tex, part2.tex… you get the idea.
  3. Do \input{part1.tex}, \input{part2.tex}, and so on.

Then this is how your master document should look:

[Preamble]

\begin{document}

\maketitle

\part{Title 1}

\input{part1.tex}

\pagebreak

\part{Title 2}

\input{part2.tex}

\pagebreak

[… and so on.]

\end{document}

An Example

Let’s give an example of this.

For reference, anything in light blue is optional, though it is recommended for better formatting.

master.tex

\documentclass{article}

\usepackage{amsmath}

\usepackage{asymptote}

[Use whichever packages you feel like.]

\title{Bob}

\author{Billy}

\date{A Fruit}

\begin{document}

\maketitle

\part{Title 1}

\input{part1.tex}

\pagebreak

\part{Title 2}

\input{part2.tex}

\end{document}

part1.tex

Notice that there is no preamble, and \begin{document} and \end{document} are missing. This is so \input works.

Did you know that $2+2=5?$

part2.tex

Big Brother is coming for you!

What if I want my articles compiled individually as well?

This is quite easy; keep your articles part1.tex, part2.tex with the preambles.

Then, make a folder called “book” and make copies of your articles. (We will call them copy1.tex, copy2.tex, and so on.)

Inside book, put copy1.tex, copy2.tex, and so on.

Then, master.tex should look like this.

\documentclass{article}

\usepackage{amsmath}

\usepackage{asymptote}

[Use whichever packages you feel like.]

\title{Bob}

\author{Billy}

\date{A Fruit}

\begin{document}

\maketitle

\part{Title 1}

\input{copy1.tex}

\pagebreak

\part{Title 2}

\input{copy2.tex}

\end{document}

Disclaimer

None of the names chosen (such as “part1.tex,” “master.tex,” and “book”) matter. They can be replaced as desired. I just chose consistent names because 1) encouraging good naming practices is good and 2) for convenience in referring to certain LaTeX files.

(Also, an Anonymous commenter mentions that \usepackage{asymptote} is inferior to \usepackage[inline]{asymptote}. They are completely right about that; I just put some random packages there as “filler.”)

Advertisements

Book – Proofs in Competition Math

This is a book which is about proofs in competition math. This blog post is a promotional one for its release.

Authors: Alex Toller, Freya Edholm, Dennis Chen.

Important Info

Preorders start on March 14th, also known as Pi Day. Yes, this was on purpose. (3/14)

Release is on April 5th. The best way to remember this is you will have to run for your life if you don’t get this book on four-five(4/5)

Why you should pre-order (when the time comes)

First, if you want to see my writing… this book doesn’t have much of it at the time of this post. (Oops.) Unfortunately, I’ve been bogged by other obligations, so I haven’t written much. (If you think the issue of splitting the earnings and me potentially getting money for nothing is an issue, I do too. More on that later.)

But if you agree with what I say on this blog, here’s something you’ll definitely agree with when the book comes out (and even if you don’t agree with me most of the time, you will agree here) – this book is high-quality. I will have proof for that (aka samples) soon, if the other two agree to release nontrivial yet non-significant portions. I’m writing Inversion, so if you liked EEG’s Inversion, you are going to like this one even more.

Also, Alex and Freya are very reputable within the math community themselves (though  I suspect most readers of my blog already know this). (In fact, they’re much more reputable than me, but shh!)

Anyway, this is quality, this is hype, and this covers a lot of stuff.

Actual content

Why you should pre-order: Part 2.

Here’s a rough ToC, with wording that is totally inaccurate.

Part 1: Proofs (this is logic in general, also stuff like iff. Good for beginners.)

Part 2: Algebra

A: algebra for noobs

B: Basic Inequalities + Complex Numbers + just stuff you should know for polynomials

C: Really hard stuff (see newton sums)

Part 3: Geometry

A: normal stuff

B: normal, but more advanced stuff

C: really hard normal stuff + bary/polar/cylindrical + inversion (I’ll get spiral similarity and homothety added if I can)

Part 4: Number Theory/Combinatorics

A: intro+interesting but unimportant stuff (its kind of the equivalent to spiral similarity or inversion)

B: More interesting but unimportant stuff.

C: Classic NT (Bases, mod arith)

D: Hard NT (HELP)

E: Even harder NT. (HELP II)

Part 5: Open Problems + for fun

A: Goes over open problems. Makes no progress but defines the backgrounds. (If we could make significant progress, we’d submit that as an article hm?)

B: Pythagorean’s Proofs (my favorite) and Fake-Proofs (my LEAST favorite).

I’m not being paid for this

I forget if I’ve said this to Alex, but I don’t intend to be paid for this simply due to the fact I’ve done an embarrassingly small amount of work on the book. I will still

a) take responsibility for the final product

b) be involved in marketing

c) actually work on the book now

but the little work I did does not warrant payment. (It’s a wonder I’m on the authors list…) I intend to make up for that by working on it now.

In Conclusion…

Buy the book when it comes out!

I’m a lazy bum too, so I deserve all the blame for flaws because I’d be able to fix them if I was paying more attention and none of the credit for success because I didn’t do anything. (Oops.)

Also, I don’t know where Homothety/Spiral Similarity will go. Preferably next to Inversion, with Homothety before Spiral (since Homothety is a special case of Spiral).

Please support this by sharing with your friends or whoever might be interested!

(If this post seems lazy, it’s because I’d rather get onto writing the book.)

Edit: I’m going to put this in every category, so people see this. I also will update my website soon.

 

GitHub Pages

In this post I argue that you should use GitHub to host your website. (Unless if it’s used for work-related purposes.)

I want to bring some of its benefits to light, but before that, some disclaimers.

  1. You can’t sell products on a GitHub website, no matter if you have your own domain or not. I don’t mean it’s hard; I mean you legally can’t. It’s in the Terms of Service somewhere.
  2. You have 1 GB of repository information, period, and 1 GB of bandwidth every month. (You can google what “repository information” means, and I’m sure you know what bandwidth means, else you wouldn’t even be reading this post.) In my experience this has been enough for me, and I don’t think you’ll be running out of repository information soon. Even then, it’s a “recommendation,” not a hard stop, so I’m not entirely sure how that plays out. If your website is Fortnite, however, you’re going to need a little more bandwidth (read: a lot more), which GitHub does offer. At the point you reach that, GitHub is still a viable competitor, but it’s not as much the definitive answer as it was before.

Let’s look at the benefits now. (I won’t be going over them so deeply, as they are pretty well-known once you know that GitHub Pages exists.)

  1. Free hosting. This means that instead of using Wix or Squarespace and having to deal with either a domain that looks like https://garlic-icosahedron-garm.squarespace.com (this was my trial website for Squarespace) or shelling out ~$150 annually, you shell out ~10 annually for the domain. I bought geometryexplorer.xyz for $1.17. (Plus tax? I don’t know.) Disclaimer: .xyz domains are cheaper, and you get them for less in your first year.
  2. Free HTTPS encryption. It took me embarrassingly long to get rid of the “Insecure Site Warning” on my website. At least it’s fixed now. Anyway, most things actually have HTML (e.g. WordPress, Wix, Squarespace, etc) so this really just keeps it in the running. It’s as if GitHub’s web hosting was competitive with paid web hosting… However, GoDaddy hosting doesn’t give you free SSL, so I guess there are a couple of examples floating around.
  3. It’s easy to learn and easy to use. Not once did I have to learn how to input code into GitHub. All you need is to set up the CNAME and URL redirect, which is very intuitive and simple.

If you want to use a website builder, be warned: there is no way to pack your stuff and leave. The website design stays with the host, not you, which is very scary. If you insist, use Google Sites; I believe they should provide free hosting + HTML + etc as well.