МатематикаМоя статистика
Тест по LaTeX
100 вопросов в 11 темах (лёгкий — 35, средний — 40, сложный — 25). Выберите темы, уровень и количество вопросов — к каждому ответу есть объяснение.
Структура документа, формулы и окружения amsmath, выравнивание, матрицы, теоремы, таблицы и рисунки, ссылки и библиография, макросы и ошибки компиляции. Вопросы на английском.
Все вопросы теста 100
Нажмите на вариант ответа, чтобы проверить себя, или «Показать ответ».
Document structure9
Which command must come first in a LaTeX document, before any \usepackage lines?
- \begin{document}
- \usepackage{latex}
- \documentclass{article}
- \title{My paper}
Every LaTeX file starts with \documentclass{...}, which loads the class (article, report, book...). Packages are loaded after it, in the preamble, and the body starts only with \begin{document}. Putting \usepackage before \documentclass gives the error "\usepackage before \documentclass".
Where do \usepackage commands belong?
- Right after \begin{document}, before the first paragraph
- In the preamble, between \documentclass and \begin{document}
- After \end{document}
- Anywhere, even in the middle of a paragraph
\usepackage may only be used in the preamble. Moving it into the body is a classic mistake that stops compilation with "LaTeX Error: Can be used only in preamble"; anything after \end{document} is ignored entirely.
The document compiles, but no title, author or date is shown. Why?
\documentclass{article}
\title{Lecture Notes}
\author{A. Smith}
\begin{document}
Some text.
\end{document}- \title must be placed after \begin{document}
- The article class does not support titles
- \maketitle is never called
- \date is missing, so the whole title block is skipped
\title and \author only store the data; the title block is printed by \maketitle, normally the first line after \begin{document}. \title may sit in the preamble, article does support titles, and a missing \date just makes \maketitle print today's date.
Which sectioning command does NOT exist in the standard article class?
- \section
- \subsubsection
- \chapter
- \paragraph
\chapter is only available in the report and book classes. In article it is undefined, so using it gives "Undefined control sequence". \paragraph exists in every class (it is a run-in heading below \subsubsection), which often surprises people who expect it to mean "start a paragraph".
How does \section*{Introduction} differ from \section{Introduction}?
- It is numbered, but not added to the table of contents
- It is unnumbered, but still added to the table of contents
- It always starts on a new page
- It is unnumbered and is not added to the table of contents
The starred form does not step the section counter and writes no TOC entry. If you need an unnumbered section in the table of contents, add \addcontentsline{toc}{section}{Introduction} yourself; assuming the star only hides the number while keeping the TOC line is the usual misconception.
Which line sets a 12 pt base font and A4 paper for an article?
- \documentclass[12pt,a4paper]{article}
- \documentclass{article}[12pt,a4paper]
- \documentclass{article,12pt,a4paper}
- \usepackage[12pt]{a4paper}
Class options go in square brackets BEFORE the class name. Brackets after the name are read as a date/version request and the options are lost; putting options inside the braces makes LaTeX look for a class called "article,12pt,a4paper".
In the report and book classes, which sectioning level comes directly below \part?
- \section
- \subsection
- \paragraph
- \chapter
The hierarchy is \part, \chapter, \section, \subsection, \subsubsection, \paragraph, \subparagraph. \chapter exists only in report and book; in article the level below \part is \section.
What is the optional argument [Short title] used for?
\section[Short title]{A very long section title that would not fit in the header}- It is a label for \ref
- It replaces the title in the table of contents and in running headers
- It is printed as a subtitle under the section heading
- It is ignored
The optional argument is the short form used for the TOC entry and the page headers, while the full title appears in the text. It is not a cross-reference key — that is what \label is for.
How is \appendix used in an article?
- As an environment: \begin{appendix} ... \end{appendix}
- It starts a separate document with its own page numbering
- As a declaration: after \appendix, the following \section commands are numbered A, B, C, ...
- It makes all following sections unnumbered
\appendix is a one-off switch: it resets the section counter and switches its numbering to letters (chapters in book/report). It is not an environment in the standard classes — the appendix package provides an "appendices" environment, which is a frequent source of confusion.
Text formatting9
How do you type typographic double quotes “like this” in plain LaTeX source?
- ``like this''
- "like this"
- ''like this``
- \"like this\"
Opening quotes are two backticks `` and closing quotes are two apostrophes ''. The straight " key gives the same (often wrong-looking) mark on both sides, and \" is the umlaut accent command, not a quote.
Which input produces an en dash for a page range, as in “pages 10–20”?
- 10--20
- 10-20
- 10---20
- 10\dash20
In LaTeX - is a hyphen, -- is an en dash (ranges: 10–20) and --- is an em dash (punctuation in a sentence — like this). Writing a single hyphen for ranges is the common mistake; \dash is not a standard command.
Which line typesets exactly “Price: $5 & 50% off” in normal text?
- Price: $5 & 50% off
- Price: \$5 & 50% off
- Price: \$5 \& 50\% off
- Price: \textdollar5 \& 50% off
$, & and % are special: $ starts math mode, & is an alignment tab (error "Misplaced alignment tab character &") and % starts a comment, silently removing " off" and the rest of the line. All three must be escaped as \$, \& and \%; forgetting % is the sneakiest because it gives no error.
What does \emph{word} do inside text that is already italic?
- It makes “word” bold italic
- Nothing — “word” stays italic
- It underlines “word”
- It sets “word” upright (roman), so it still stands out
\emph is semantic emphasis: it toggles the shape, so inside italic text it switches back to upright. \textit{word} would stay italic and the emphasis would be invisible — the reason to prefer \emph over \textit for emphasis.
Why do careful authors write "Dr.\ Smith" or "e.g.\ the case" instead of a plain space after the period?
- The period is a special character and has to be escaped
- A period after a lowercase letter is treated as a sentence end and gets a wider space; "\ " forces a normal interword space
- It prevents the line from ever breaking at that space
- It makes the period come out in italics
By default TeX puts extra space after sentence-ending punctuation, and it assumes a period after a lowercase letter ends a sentence. "\ " (control space) gives an ordinary space; "Dr.~Smith" also gives a normal space and additionally forbids a line break. The opposite case — a sentence that ends after a capital, as in "NASA." — needs \@ before the period.
Which command produces bold text?
- \bold{important}
- \textbf{important}
- \textit{important}
- \emph{important}
\textbf = bold face, \textit = italic, \emph = emphasis (usually italic). \bold does not exist in LaTeX. The old two-letter switch \bf is deprecated; use \textbf{...} or the declaration \bfseries.
Which character makes a non-breaking space, as in “Figure 3” that should not be split across lines?
- \\ as in Figure\\\ref{fig:a}
- ~ as in Figure~\ref{fig:a}
- \newline as in Figure\newline\ref{fig:a}
- \nbsp as in Figure\nbsp\ref{fig:a}
The tie ~ is an interword space where a line break is not allowed — standard before \ref, \cite and in names (Dr.~Smith). \\ and \newline force a line break, the opposite of what is wanted; \nbsp is HTML, not LaTeX.
Only the word “Important” should be large, but everything after it in the paragraph is large too. Why?
\large{Important} notice: please read the rules.- \large needs a size argument, such as \large[14pt]
- Braces after a size command are ignored only in the first word
- \large must be closed with \endlarge
- \large is a switch, not a command with an argument; write {\large Important}
Size commands (\small, \large, \Huge...) are declarations that act until the end of the current group. In \large{Important} the braces only group "Important"; \large itself is outside them, so it stays in force. Put the switch inside the group: {\large Important}.
You want an indent of 2 cm at the start of a line. Why does \hspace{2cm} placed right after a line break do nothing, while \hspace*{2cm} works?
- \hspace only accepts sizes in pt
- \hspace works only inside math mode
- The starred form doubles the requested space
- Horizontal space at the beginning of a line is discarded at a line break; the starred form keeps it
Glue at a line break (and at the start of a new line) is thrown away by TeX, which is normally what you want for spaces between words. \hspace*{...} inserts space that is not discarded. Similarly \vspace* keeps vertical space at the top of a page.
Inline and display math9
Which is the recommended LaTeX syntax for an unnumbered displayed equation?
- $$ E = mc^2 $$
- $ E = mc^2 $
- \[ E = mc^2 \]
- \( E = mc^2 \)
\[ ... \] is the LaTeX display-math syntax. $$ ... $$ is plain TeX: it still "works", but gives inconsistent vertical spacing and ignores options such as fleqn, so it is discouraged. $...$ and \(...\) are inline math, not displays.
Which delimiters produce INLINE math, inside a running sentence?
- \[ x^2 \]
- \( x^2 \)
- \begin{equation} x^2 \end{equation}
- $$ x^2 $$
\( ... \) is the LaTeX form of $ ... $ — both are inline. \[ \], equation and $$ all produce displayed math on a separate line, which is the mistake if you wanted the formula inside the sentence.
With amsmath loaded, this equation gets number 3. What does the last line print?
\begin{equation}
e^{i\pi} + 1 = 0
\label{eq:euler}
\end{equation}
As shown in \eqref{eq:euler}, ...- As shown in 3, ...
- As shown in Equation 3, ...
- As shown in eq:euler, ...
- As shown in (3), ...
\eqref (amsmath) prints the number in parentheses, matching the equation tag. Plain \ref would print just 3 — which is why people write (\ref{...}) by hand; \eqref does it for you and keeps the parentheses upright even in italic text. The label key itself is never printed.
In $f(x) = 0 if x < 0$ the word "if" comes out as italic letters i f with no spaces around it. What is the fix (with amsmath)?
- $f(x) = 0 \text{ if } x < 0$
- $f(x) = 0 if x < 0$ — add more spaces
- $f(x) = 0 \mathit{if} x < 0$
- $f(x) = 0 \; if \; x < 0$
In math mode letters are variables and spaces are ignored, so extra spaces change nothing. \text{...} switches to text mode inside math; the spaces inside the braces are kept. \mathit still treats "if" as math italic, and \; only adds space around the still-italic variables i and f.
Section 2 contains the following, and the equation is numbered (5). What does \ref{eq:a} print?
\section{Results}
\label{eq:a}
\begin{equation}
x = 1
\end{equation}- 5
- 2
- (5)
- ??
\label records the number of the last counter that was stepped with \refstepcounter. Placed before \begin{equation}, that counter is the section, so \ref gives 2. The label has to go inside the equation environment (after the counter is stepped) to refer to equation (5).
Which amsmath environment produces a displayed equation WITHOUT a number?
- equation
- numbered
- equation*
- eqnarray
The star suppresses numbering: equation* is the same as \[ ... \]. Plain equation is numbered; eqnarray is a deprecated multi-line environment and numbers every line.
What does \tag{$\star$} do inside an equation environment (amsmath)?
- It adds ⋆ after the automatic number
- It adds a label named ⋆ for \ref
- It replaces the automatic number with (⋆)
- It makes the equation unnumbered
\tag{...} prints a custom tag instead of the next number; the equation counter is not stepped. It is not a \label — you still need \label to refer to it, and \ref then prints ⋆.
What is the effect of the blank line before \begin{equation}?
... which gives the following identity.
\begin{equation}
a^2 - b^2 = (a - b)(a + b)
\end{equation}- None — blank lines are always ignored around displays
- The equation is printed inline
- The paragraph ends, so the equation starts after an empty line and gets extra space above it
- It is an error: a display cannot follow a blank line
A blank line is \par. The display then starts in vertical mode, so TeX first opens a new (empty) paragraph — you get an empty line and too much space above the equation. Displays belong to the surrounding paragraph: no blank lines before them (use % if you want visual separation in the source), and a blank line after only if a new paragraph really starts there.
With this preamble, which number does the third equation in section 2 get?
\usepackage{amsmath}
\numberwithin{equation}{section}- (3)
- (2.3)
- (2-3)
- (3.2)
\numberwithin{equation}{section} prefixes equation numbers with the section number and resets the equation counter at each new section: (section.equation). Without it numbering is continuous through the document, giving (3) only if it were the 3rd equation overall.
Math symbols and operators10
Which input typesets x to the power 10?
- x^10
- x^{10}
- x^(10)
- x**10
^ takes only the next token as the superscript, so x^10 gives x¹ followed by a normal 0 — a very common slip. Multi-character exponents need braces: x^{10}. x^(10) raises only the "(", and ** has no meaning in LaTeX.
What does $\sqrt[3]{x}$ produce?
- Three times the square root of x
- The square root of x, cubed
- An error: \sqrt takes no optional argument
- The cube root of x
The optional argument of \sqrt is the root index, so \sqrt[3]{x} is ∛x. Writing 3\sqrt{x} would be the product, and (\sqrt{x})^3 the power.
Which input typesets “sin x” with an upright “sin” and correct spacing before x?
- $\sin x$
- $sin x$
- $\text{sin}x$
- $\mathrm{sin}x$
\sin is a predefined operator: upright and followed by a thin operator space. $sin x$ is the product of variables s, i, n, x in italics; \text{sin} and \mathrm{sin} are upright but get no operator spacing, so the x is glued to "sin".
You need an upright operator “tr” (trace) many times in a document, with correct operator spacing. What is the best way (amsmath loaded)?
- \newcommand{\tr}{tr} in the preamble, then $\tr A$
- \DeclareMathOperator{\tr}{tr} in the body, right before its first use
- \renewcommand{\tr}{\mathrm{tr}} in the preamble
- \DeclareMathOperator{\tr}{tr} in the preamble, then $\tr A$
\DeclareMathOperator defines an operator like \sin: upright with proper spacing — but it is preamble-only, so using it in the body is an error. \newcommand{\tr}{tr} just yields italic t·r, and \renewcommand fails because \tr is not defined yet. For a one-off, \operatorname{tr} works inline.
Inside a paragraph you write $\sum_{i=1}^{n} i$. Where are the limits placed, and how can you force them above and below?
- Below and above, because \sum always places limits that way
- To the right of the sigma; \sum\limits_{i=1}^{n} puts them below and above
- To the right of the sigma; \sum\nolimits_{i=1}^{n} puts them below and above
- To the right of the sigma, and nothing can change that in inline math
In inline (text-style) math, large operators put their limits at the side to keep lines short; in display math they go below and above. \limits forces below/above, \nolimits forces the side position — mixing up the two is the typical error. Forcing \limits inline usually spoils line spacing, so use it sparingly.
Which input produces the capital Greek letter Γ?
- \gamma
- \capgamma
- \Gamma
- G
Greek letter commands are capitalized for capital letters: \gamma = γ, \Gamma = Γ. There is no \capgamma, and capital letters that look Latin (A, B, E...) have no commands at all — you type A for capital alpha.
Which input typesets (a + b) divided by 2 as a built-up fraction?
- \frac{a+b, 2}
- \frac{a+b}{2}
- \frac(a+b)(2)
- \fraction{a+b}{2}
\frac takes two brace-delimited arguments: numerator and denominator. Commas or parentheses are not argument separators in LaTeX, and \fraction does not exist.
In display math, which input puts “x → 0” centered BELOW “lim”?
- \lim{x \to 0}
- \lim_{x \to 0}
- \lim^{x \to 0}
- \operatorname{lim}_{x \to 0}
The limit goes in a subscript; \lim places its subscript below in display style. Without _ the braces are just a group printed after lim, and ^ would put it above. \operatorname{lim} gives an upright name but subscripts at the side — you would need \operatorname*{lim} for limits underneath.
You need a left curly brace that grows to the height of the content, with NOTHING on the right side. Which input works?
- \left\{ ... \right.
- \left{ ... \right.
- \left\{ ... with no \right
- \left\{ ... \right\}
\left and \right must always come in pairs; \right. (with a period) is an invisible delimiter. A bare { is a group, not a delimiter, so \left{ fails — braces must be written \{ and \}. Omitting \right gives "Missing \right. inserted", and \right\} draws a brace you did not want.
$x^2^3$ fails with "Double superscript". How do you write x raised to the power 2³?
- {x^2}^3
- x^{2}^{3}
- x^{2^3}
- x^(2^3)
An atom can have only one superscript; the tower must be nested: x^{2^3}. x^{2}^{3} is still two superscripts on x; {x^2}^3 compiles but attaches 3 to the group, looking like x²³ and meaning (x²)³; in x^(2^3) only the "(" is raised.
Aligning equations9
In the align environment, what do & and \\ do?
- \\ marks the alignment point, & ends the line
- & ends the line, \\ starts a comment
- & marks the alignment point, \\ ends the line
- & adds a space, \\ marks the alignment point
Each line of align is split at & (usually placed just before the relation, as in &=) so that the relations line up, and \\ starts the next line.
How many equation numbers does this produce?
\begin{align}
a &= b + c \\
&= d
\end{align}- One for the whole block
- Two — one per line
- None
- Three
align numbers every line. To number only the final result, put \notag (or \nonumber) on the lines that should stay unnumbered; to number nothing, use align*. Expecting one number for the block is the usual confusion with aligned inside equation.
Why is eqnarray discouraged in favor of amsmath's align?
- eqnarray cannot number equations
- eqnarray needs the amsmath package, align does not
- eqnarray puts too much space around the relation symbol and its numbers can overlap long equations
- align compiles noticeably faster
eqnarray is a kernel environment built like a three-column array, so the spacing around = is the wide column gap, not the normal relation spacing, and long lines can collide with the number. It does number lines and needs no package — align is the one that comes from amsmath.
Inside a cases environment, what separates a value from its condition?
|x| = \begin{cases}
x & x \ge 0 \\
-x & x < 0
\end{cases}- A comma
- &
- \quad
- \\
cases has two left-aligned columns separated by &; \\ separates the rows. A comma would just be printed and the conditions would no longer line up; \quad adds space but no alignment.
How is this block numbered?
\begin{equation}
\begin{aligned}
f(x) &= (x+1)^2 \\
&= x^2 + 2x + 1
\end{aligned}
\end{equation}- With a single number, vertically centered on the block
- With one number per line
- It is not numbered at all
- It does not compile: aligned can only be used inside align
aligned is a building block, not a display: it forms one unit inside another math environment, so the surrounding equation gives the whole block one number. Using align instead would number each line. aligned is designed precisely to be nested inside equation, gather and similar.
Which environment aligns several equations at = WITHOUT numbering any of them?
- align
- align*
- equation
- gather
align* is the unnumbered form of align. align numbers every line, gather numbers every line and does not align, and equation is a single-line display.
How does gather differ from align?
- gather aligns at & like align, but numbers only the last line
- gather centers each line and does not align them; & is not used
- gather is the deprecated old name of align
- gather puts all equations on one line
gather stacks independent equations, each centered and (in the unstarred form) numbered. Use align when the lines should line up at a relation. Putting & inside gather causes an error.
How many equation numbers are printed?
\begin{align}
x &= 1 + 2 \\
&= 3 \notag \\
y &= 4
\end{align}- 1
- 3
- 0
- 2
align numbers each line, and \notag (same as \nonumber) suppresses the number of the line it is on. So the 1st and 3rd lines get numbers, the 2nd does not.
What does this produce?
\begin{align}
a &= b & c &= d \\
e &= f & g &= h
\end{align}- One column with four alignment points per line
- An error: only one & is allowed per line in align
- Four lines, one equation per line
- Two columns of equations side by side, each aligned at =, one number per row
align has pairs of columns (right-aligned, left-aligned). The 1st and 3rd & are alignment points, the 2nd & starts a new equation column. This is how you put several aligned equations next to each other; numbering is per row.
Matrices and arrays9
Which amsmath environment typesets a matrix in round parentheses?
- bmatrix
- vmatrix
- pmatrix
- matrix
pmatrix = parentheses, bmatrix = square brackets, vmatrix = vertical bars (determinant), matrix = no delimiters at all. Wrapping a plain matrix in \left( ... \right) works too but is unnecessary.
What is the size of this matrix?
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6
\end{pmatrix}- 2 rows × 3 columns
- 3 rows × 2 columns
- 1 row × 6 columns
- It does not compile: matrices must be square
\\ separates rows (2 of them) and & separates the entries within a row (3 per row), so this is 2×3. Reading & as a row break gives the 3×2 answer. Matrices of any shape are allowed.
In a general n×n matrix, which command draws the diagonal dots between a₁₁ and aₙₙ?
- \vdots
- \cdots
- \ldots
- \ddots
\ddots = diagonal, \vdots = vertical, \cdots = horizontal at the height of the math axis (between rows of entries or operators: a_1 + \cdots + a_n), \ldots = horizontal on the baseline (lists: x_1, \ldots, x_n).
What does this produce?
\left( \begin{array}{cc|c}
1 & 2 & 3 \\
4 & 5 & 6
\end{array} \right)- An augmented matrix in parentheses with a vertical line before the last column
- A matrix with a vertical line after the first column
- A 2×3 matrix without any line — | is ignored in math mode
- An error: array requires the amsmath package
The column spec cc|c means two centered columns, a vertical rule, then a third centered column — the classic augmented matrix [A | b]. array is part of the LaTeX kernel (not amsmath) and supports | just like tabular.
This pmatrix row has 12 entries and fails with "Extra alignment tab has been changed to \cr". Why?
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
\end{pmatrix}- amsmath matrices allow at most 10 columns by default; raise the limit with \setcounter{MaxMatrixCols}{12}
- A single row matrix must be written with bmatrix
- Numbers above 9 must be put in braces, like {10}
- The row must end with \\ even if it is the last one
The amsmath matrix environments are limited to MaxMatrixCols = 10 columns; any column beyond the 10th triggers this error. \setcounter{MaxMatrixCols}{12} (in the preamble or before the matrix) fixes it; alternatively use array with an explicit column spec.
Which amsmath environment typesets a determinant, with vertical bars?
- pmatrix
- bmatrix
- matrix
- vmatrix
vmatrix gives |...| (determinant), Vmatrix gives ‖...‖ (norm), pmatrix (...), bmatrix [...], Bmatrix {...}, and plain matrix has no delimiters. Drawing bars with | characters around a plain matrix does not scale with the height.
This gives "Missing $ inserted". Why?
The matrix is
\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
and it is the identity.- pmatrix must be used inside math mode, e.g. within \[ ... \] or $...$
- The rows must be separated by \cr, not \\
- pmatrix needs a column spec like {cc}
- A 2×2 matrix must be written with bmatrix
The amsmath matrix environments are math-mode constructs; outside math they trigger "Missing $ inserted". Wrap them in \[ ... \] (display) or $ ... $ (inline). Only array needs a column spec.
Which environment, used inside math mode, lets you choose the alignment of each column separately (for example right-aligned numbers)?
- pmatrix
- bmatrix
- cases
- array
array takes a column spec such as {rcl} or {r|r} just like tabular, but its cells are in math mode. The pmatrix/bmatrix family centers every column and has no column spec (mathtools adds pmatrix*[r] for per-matrix alignment).
You need a small 2×2 matrix inside a line of text without ruining the line spacing. What is the amsmath solution?
- $\begin{smallpmatrix} a & b \\ c & d \end{smallpmatrix}$
- $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$
- $\small\begin{pmatrix} a & b \\ c & d \end{pmatrix}$
- $\bigl(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\bigr)$
smallmatrix uses script-size entries and has no delimiters, so you add them yourself with \bigl( ... \bigr). A normal pmatrix inline forces large gaps between text lines; \small is a text command and is invalid inside math mode; and there is no smallpmatrix (mathtools offers psmallmatrix).
Theorems and proofs9
Which package provides the proof environment and theorem styles such as \theoremstyle{definition}?
- amsmath
- amssymb
- graphicx
- amsthm
amsthm extends \newtheorem with styles (plain, definition, remark), the starred \newtheorem* and the proof environment with its QED box. amsmath is about math typesetting (align, \text...), amssymb about symbols — loading them does not give you proof.
What does the optional argument [theorem] do here?
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}- Lemmas are numbered within theorems: Lemma 1.1, 1.2, ...
- Lemmas share the theorem counter: Theorem 1, Lemma 2, Theorem 3, ...
- Lemmas become unnumbered
- Lemmas copy the formatting of theorems but have their own counter
An optional argument between the name and the title means "use this existing counter", so theorems and lemmas are numbered in one sequence. An optional argument AFTER the title (\newtheorem{lemma}{Lemma}[section]) is the other form: numbering within sections — people often mix up the two positions.
With amsthm, what does \newtheorem*{remark}{Remark} define?
- An environment remark numbered “Remark 1.”, “Remark 2.”, ...
- An environment remark printed as an unnumbered “Remark.”
- Nothing — the star is not allowed and causes an error
- A remark that is numbered within the current section
The starred \newtheorem* (from amsthm) creates an unnumbered theorem-like environment. Without amsthm the star is not supported, and numbering within sections is done with a trailing [section] argument, not a star.
The proof ends with a displayed equation, and the QED box appears alone on the next line. How do you put it at the end of the equation?
\begin{proof}
Combining the bounds we get
\[ a = b. \]
\end{proof}- Write \[ a = b. \qedhere \]
- Write \qed after \end{proof}
- Add \hfill$\square$ before \end{proof}
- Remove the proof environment and draw the box by hand
amsthm's proof puts the box at the end of the last paragraph; after a display that is an empty line. \qedhere placed inside the last display line moves the box there and suppresses the automatic one. \hfill$\square$ would give a second box, and \qed after the environment is outside the proof.
With amsthm, how do you write a proof that ends with the QED box □ automatically?
- \begin{proof} ... \end{proof}
- \proof{...}
- \begin{theorem}[proof] ... \end{theorem}
- \begin{qed} ... \end{qed}
The proof environment prints "Proof." at the start and the box at the end. There is no \proof command with an argument or a qed environment; \qed alone just prints the box.
What does this preamble line define?
\newtheorem{thm}{Theorem}- A command \thm{...} that prints “Theorem”
- An environment Theorem printed as “thm 1”
- An environment thm, used as \begin{thm}...\end{thm} and printed as “Theorem 1”
- A counter named Theorem without any environment
The first argument is the environment name you type in the source, the second is the heading printed in the document. Swapping them is the classic error: \begin{Theorem} would then be undefined.
How are theorems numbered after this definition?
\newtheorem{theorem}{Theorem}[section]- Theorem 1, 2, 3, ... — continuously
- Theorem 1, 2, ... — but sharing the section counter
- Only one theorem is allowed per section
- Theorem 2.1, 2.2, ... — restarting in each section
A trailing optional argument makes the counter subordinate to another counter: the number becomes section.theorem and is reset at each \section. The optional argument between the two braces would instead share an existing counter.
What heading does this proof get (amsthm)?
\begin{proof}[Proof of Theorem~\ref{thm:main}]
...
\end{proof}- “Proof. Proof of Theorem 2”
- “Proof.” — the optional argument is ignored
- An error: proof takes no optional argument
- “Proof of Theorem 2.” instead of “Proof.”
The optional argument replaces the default heading text “Proof”; amsthm still adds the period and the QED box. Use it when the proof does not immediately follow its theorem.
With amsthm, the bodies of Definition environments are still italic. Why?
\newtheorem{defn}{Definition}
\theoremstyle{definition}
\newtheorem{example}{Example}- \theoremstyle must be written inside each defn environment
- The definition style is italic by design
- \theoremstyle affects only the \newtheorem commands that follow it, so defn still has the default plain (italic) style
- \theoremstyle works only with \newtheorem*
\theoremstyle sets the style for subsequent declarations. defn was declared before it, so it gets the default "plain" style (italic body); example gets the upright definition style. Move \theoremstyle{definition} above \newtheorem{defn}{Definition}.
Tables and figures9
How are the columns of \begin{tabular}{lcr} aligned?
- Right, centered, left
- All left, with column widths l, c, r
- Left, centered, right
- Lowercase, capitalized, roman
Each letter of the column spec defines one column: l = left, c = center, r = right, in that order. For fixed-width columns with wrapped text use p{width}.
Which command draws a horizontal line across a tabular?
- \hrulefill
- \line
- \hline
- \horizontalline
\hline is placed at the start of a row (or after \\) and draws a full-width rule. \hrulefill only fills the space inside one cell with a rule, \line is a picture-mode command, and \horizontalline does not exist.
You wrote \begin{figure} ... \end{figure} in the middle of a paragraph, but the image appears on the next page. Why?
- The image file is too large to be shown where it is written
- figure always starts on a new page
- figure is a float: LaTeX moves it to a place allowed by its placement rules
- \includegraphics must be called before \begin{figure}
figure and table are floats; LaTeX places them at the top/bottom of a page, on their own page or "here" according to the [htbp] specifier and its float parameters. This is intended — refer to floats by \ref instead of "the figure below". If it must not move, don't use a float (or use [H] from the float package).
In a figure, where must \label go so that \ref prints the figure number?
- Before \caption
- As an option of \includegraphics
- After \caption (or inside its argument)
- Anywhere inside the figure environment
\caption is what steps the figure counter. A \label before it picks up the previous counter (typically the section), so \ref prints the section number — a very common bug. Put it after \caption{...}.
Which package provides \includegraphics?
- amsmath
- hyperref
- booktabs
- graphicx
graphicx provides \includegraphics[width=..., height=..., scale=..., angle=...]{file}. Forgetting it gives "Undefined control sequence" at the first \includegraphics.
In a tabular row, what separates the cells and what ends the row?
- & separates cells, \\ ends the row
- | separates cells, \\ ends the row
- & separates cells, \hline ends the row
- Tab characters separate cells, a newline ends the row
& is the cell separator and \\ the row terminator. | only appears in the column spec to draw vertical rules, \hline draws a line but does not end a row, and whitespace in the source has no meaning for columns.
With the booktabs package, which set of commands draws the rules of a professional-looking table?
- \toprule, \midrule, \bottomrule — and no vertical lines
- \hline\hline at the top and bottom, plus | between all columns
- \toprule at the top and \hline everywhere else
- \cline between every row
booktabs provides rules with proper weights and spacing around them: \toprule, \midrule (under the header), \bottomrule, and \cmidrule for partial rules. Its documentation recommends avoiding vertical rules and double rules altogether; \hline ignores booktabs' spacing.
Which column spec makes the 2nd column 4 cm wide with automatic line wrapping?
- {l p{4cm} r}
- {l c{4cm} r}
- {l 4cm r}
- {l w r}
p{width} is a paragraph column: fixed width, text wrapped and top-aligned. l, c and r take no width and never wrap — a long cell simply widens the table and runs into the margin. (The array package adds m{} and b{} for vertical centering/bottom alignment.)
A figure uses \begin{figure}[h] and the log shows "LaTeX Warning:
h' float specifier changed to ht'". What does that mean?- The figure was converted into a table
- [h] is not a valid placement option
- “Here” alone was not possible, so LaTeX also allowed placing the float at the top of a page
- The float was forced to stay exactly here
[h] alone is too restrictive: if the float does not fit at that spot, LaTeX adds t to avoid sending it to the end of the document. Use [htbp] to give it freedom, or [H] from the float package if it truly must not move.
References and bibliography9
Which command cites the bibliography entry with key knuth84 in the text?
- \ref{knuth84}
- \bibitem{knuth84}
- \label{knuth84}
- \cite{knuth84}
\cite refers to a bibliography entry. \ref refers to a \label (section, equation, figure), \bibitem defines an entry inside thebibliography, and \label sets a cross-reference target — mixing \ref and \cite gives "??" or "[?]".
A document uses BibTeX with a refs.bib file. Which run order produces correct citations?
- bibtex, pdflatex
- pdflatex once
- pdflatex, pdflatex, bibtex
- pdflatex, bibtex, pdflatex, pdflatex
The first LaTeX run writes the cited keys to the .aux file, bibtex reads it and creates the .bbl, the next LaTeX run includes the bibliography, and the last one resolves the citation numbers. Running bibtex first finds no .aux citations; stopping after bibtex leaves "[?]".
Where should hyperref usually be loaded in the preamble?
- Near the end, after (almost) all other packages
- As the first package, right after \documentclass
- Order does not matter for hyperref
- Before \documentclass
hyperref redefines many commands of other packages to make links; packages loaded after it may overwrite those changes. So load it last — with a few documented exceptions such as cleveref, which must come after hyperref.
Which setup is correct for biblatex with a file refs.bib?
- \usepackage{biblatex}, then \bibliographystyle{plain} and \bibliography{refs} at the end
- \usepackage{biblatex} and \addbibresource{refs.bib} in the preamble, \printbibliography in the body, compile with biber
- \usepackage{biblatex} and \addbibresource{refs} in the preamble, compile with bibtex
- \addbibresource{refs.bib} and \printbibliography both in the preamble
biblatex uses \addbibresource (with the .bib extension), \printbibliography where the list should appear, and biber as its default backend. \bibliographystyle/\bibliography belong to classic BibTeX — mixing the two systems is the typical error; \printbibliography in the preamble prints nothing useful.
The introduction is section 1. What does this text print (after compiling twice)?
\section{Introduction}\label{sec:intro}
...
See Section~\ref{sec:intro}.- See Section Introduction.
- See Section sec:intro.
- See Section 1.
- See Section (1).
\ref prints the number of the labelled object, not its title (\nameref from hyperref does that) and not the key. The word "Section" is typed by hand, joined with ~ so it never ends up alone at the end of a line.
What does loading the hyperref package do?
- Turns \ref, \cite, table of contents entries and URLs into clickable links in the PDF
- Downloads cited papers from the internet
- Checks that all URLs in the document are reachable
- Creates the bibliography
hyperref adds PDF hyperlinks for cross-references, citations, TOC entries and \url/\href, plus PDF bookmarks. Bibliography generation is the job of BibTeX/biber.
After several compilations a reference still prints “??”. What is the most likely reason?
- The key in \ref does not match any \label (typo or missing label)
- The document has not been compiled with bibtex
- hyperref is not loaded
- \ref only works for equations
"??" after the first run is normal; if it survives repeated runs, the label is undefined — the log says "Reference `sec:x' on page 3 undefined". Check the spelling of the key and that the \label really exists (and comes after \caption in floats). For citations the symptom is [?].
With hyperref loaded, which command prints “Figure 3” (including the word) for \label{fig:plot}?
- \ref{fig:plot}
- \autoref{fig:plot}
- \eqref{fig:plot}
- \pageref{fig:plot}
\autoref (hyperref) looks at the type of the label and adds the name — Figure, Table, Section, Equation — making the whole text a link. \ref gives just "3", \eqref "(3)" and \pageref the page number. The cleveref package's \cref does the same with more control.
Your .bib file has 40 entries, but the bibliography lists only the 12 you cite. How do you include all of them?
- Add \nocite{*}
- Add \cite{all}
- Run bibtex twice
- Use \bibliography{refs.bib}*
BibTeX and biber include only cited entries. \nocite{key} adds an entry without a citation mark in the text, and \nocite{*} adds every entry in the database. Running the tools more often does not change which entries are selected.
Macros and packages9
Which package provides \mathbb, as in $\mathbb{R}$?
- amssymb (or amsfonts)
- amsmath
- graphicx
- hyperref
\mathbb (blackboard bold) comes from amsfonts, which amssymb loads. Loading only amsmath is the usual mistake: it does not define \mathbb, so you get "Undefined control sequence".
With amsmath loaded, what does $\norm{x}$ produce after this definition?
\newcommand{\norm}[1]{\lVert #1 \rVert}- ‖#1‖
- ‖ ‖x — empty bars followed by x
- An error: \norm needs two arguments
- ‖x‖ — x between double bars
[1] declares one argument; #1 in the body is replaced by whatever is in the braces, here x. Writing [1] but forgetting #1 in the body would give empty bars; the argument count is the number in brackets, not the number of delimiters.
\newcommand{\vec}[1]{\mathbf{#1}} stops with "Command \vec already defined". Why?
- \mathbf cannot be used inside \newcommand
- \vec is already a LaTeX command (the arrow accent); use \renewcommand or a different name
- \newcommand needs a star when the macro has arguments
- Commands with arguments must be defined with \def
\newcommand refuses to overwrite existing commands, which protects you from silently breaking things. \vec is the standard arrow accent, so either redefine it deliberately with \renewcommand or pick another name such as \bvec.
What does $\pair{5}$ produce?
\newcommand{\pair}[2][0]{(#1, #2)}- (0, 5)
- (5, 0)
- (5, )
- An error: \pair needs two arguments
[2][0] means two arguments, the FIRST of them optional with default 0. So \pair{5} is \pair[0]{5} → (0, 5), and \pair[3]{5} → (3, 5). Assuming the optional argument is the last one gives (5, 0).
Which package must be loaded to use the align environment?
- amssymb
- graphicx
- amsmath
- align
align, gather, multline, cases, \text, \eqref and \DeclareMathOperator all come from amsmath. Without it you get "Environment align undefined". amssymb only adds symbols.
The first use of $\R$ gives "Undefined control sequence". What is the most likely cause?
\documentclass{article}
\usepackage{amsmath}
\newcommand{\R}{\mathbb{R}}
\begin{document}
Let $x \in \R$.
\end{document}- \newcommand needs [0] for a macro without arguments
- \R must be used outside math mode
- amssymb (or amsfonts) is not loaded, so \mathbb is undefined
- Macros defined in the preamble are not visible in the body
\newcommand stores the body without checking it, so the error appears only when \R expands to the undefined \mathbb. amsmath does not provide \mathbb; add \usepackage{amssymb}. Argument-less macros need no [0].
What error does this give, assuming \myvec has never been defined?
\renewcommand{\myvec}[1]{\mathbf{#1}}- "Command \myvec undefined" — \renewcommand only redefines existing commands
- No error — \renewcommand also defines new commands
- "Command \myvec already defined"
- "Missing $ inserted" because of \mathbf
\newcommand requires the name to be new; \renewcommand requires it to exist. Using the wrong one gives "already defined" or "undefined" respectively. \providecommand defines a command only if it does not already exist.
With \newcommand{\name}{Alice}, the text \name is great comes out as “Aliceis great”. Why?
- \newcommand removes the last character of its body
- The space after a command name like \name is eaten when the name is read; write \name{} or \name\ is
- Macros defined with \newcommand never output spaces
- The definition is missing a trailing \space argument
A control word ends at the first non-letter, and the spaces after it are skipped by TeX's tokenizer — they never reach the macro. Use \name{} or "\name\ " in the text, or end the definition with \xspace from the xspace package.
Why is \ensuremath used in this definition?
\newcommand{\Rn}{\ensuremath{\mathbb{R}^n}}- To make \Rn bold
- Because \mathbb is not allowed directly in \newcommand
- So that \Rn is always shown as a displayed equation
- So that \Rn works both in text and inside $...$ without "Missing $ inserted"
\ensuremath switches into math mode only if it is not already there. With a plain $...$ in the body, using \Rn inside a formula would close math mode instead; without any $, using it in text gives "Missing $ inserted".
Errors and compilation9
What typically causes the error "Missing $ inserted"?
- A math-only command such as ^, _ or \alpha used in normal text
- An unbalanced closing brace }
- A missing \end{document}
- A package that is not installed
^, _ and commands like \alpha, \frac exist only in math mode; TeX tries to recover by inserting a $ for you. The classic sources are a forgotten $...$ around a formula, or an underscore in a file name or identifier (write \_ or use \texttt with escaping).
Why does \ref show "??" after the first compilation and the right number after the second?
- The first run is only a syntax check
- Labels are stored in the PDF and read back from it
- It is a bug that depends on the package order
- The first run writes label values to the .aux file; the next run reads them
LaTeX processes the file in one pass. While running it writes each \label's value to the .aux file, and \ref uses the values read from .aux at the start of the run — i.e. from the previous run. The same mechanism is why the table of contents and citations need extra runs.
What is the most likely cause of this error?
% preamble: \newcommand*{\note}[1]{\textbf{Note:} #1}
\note{Check the bounds again
Next paragraph ...
Runaway argument?
! Paragraph ended before \note was complete.- \textbf cannot be used inside a macro
- The argument contains a space
- \note is already defined in LaTeX
- The closing brace of the argument is missing, so the argument ran into a blank line
A macro defined with \newcommand* is "short": its argument may not contain a paragraph break. Because } was forgotten, TeX kept reading the argument until the blank line and stopped. The fix is to add the missing brace; the line number in the log points to where the runaway argument STARTED.
What causes "LaTeX Error: There's no line here to end."?
First paragraph.
\\ Second paragraph.- A \\ in a tabular row with too many cells
- \\ is used where there is no current line, e.g. at the start of a paragraph
- A missing \end{document}
- \\ used inside math mode
\\ ends the current line, but after a blank line there is no line yet. People often use \\ (or blank line + \\) to add vertical space between paragraphs; use \vspace{...}, \medskip or \parskip instead. Too many cells in a row gives "Extra alignment tab" instead.
What does "LaTeX Error: File `mathtool.sty' not found" mean?
- The .tex file is not saved
- The package name is misspelled or the package is not installed
- There is a syntax error inside the package
- The package must be loaded after \begin{document}
A \usepackage{...} names a file that TeX cannot find. Here it is a typo for mathtools; otherwise install the package with your distribution's package manager (MiKTeX can install on the fly, TeX Live uses tlmgr).
What typically causes "LaTeX Error: Missing \begin{document}" when \begin{document} IS in the file?
- A missing \end{document}
- A package that is loaded twice
- An empty line between \documentclass and \usepackage
- Text or a stray character in the preamble, which LaTeX tries to typeset before \begin{document}
Anything that produces output in the preamble — a typo such as "\usepackage{amsmath}s", a word typed above \begin{document}, or a misplaced command — starts typesetting too early. Look at the line shown in the error message; blank lines in the preamble are harmless.
What is wrong in a document that gives "\begin{itemize} on input line 5 ended by \end{enumerate}"?
- itemize and enumerate cannot be used in the same document
- itemize must contain at least two \item
- Environments are improperly nested or mismatched: the itemize opened on line 5 is closed with \end{enumerate}
- Line 5 has a missing $
LaTeX checks that each \end matches the most recent unclosed \begin. Often the real cause is a forgotten \end{itemize} inside an enumerate (nested lists), so the first \end{enumerate} meets the still-open itemize.
What does "Overfull \hbox (25.3pt too wide) in paragraph at lines 12--14" mean?
- A fatal error: compilation stops at line 12
- A warning: a line sticks 25.3 pt into the right margin because no good break was found
- The paragraph has 25.3 pt of too much space between words
- An image on lines 12–14 is 25.3 pt too large and was cropped
Overfull boxes are warnings, not errors: output is produced, but the line overflows (often a long URL, a long math formula or an unhyphenatable word). Fix it by rephrasing, \url{...}, adding hyphenation hints (\-), or locally \sloppy. Too much white space is the opposite message, "Underfull \hbox".
Why does this fail with "LaTeX Error: \verb illegal in command argument"?
\section{Using \verb|\frac|}- \verb changes how characters are read, which is impossible once they are already read as an argument of another command
- \verb can only be used in math mode
- The | delimiter is not allowed; \verb needs braces
- \section titles cannot contain any commands
\verb must change character codes before its text is read, but an argument of \section (or \footnote, \caption...) has already been tokenized. Use \texttt{\textbackslash frac} instead, or a package such as cprotect. | is a perfectly normal \verb delimiter.
Как проходить тест
- Выберите темы и уровень — лёгкий уровень проверяет определения и задачи в одно действие, средний — стандартные вычисления, сложный — многошаговые задачи и теорию.
- Отвечайте касанием или с клавиатуры: 1–4 или A–D, Enter — следующий вопрос.
- Читайте объяснения — после ошибки разбор открывается сразу, после верного ответа его можно раскрыть кнопкой «Почему».
- Работайте над ошибками — «Повторить ошибки» в конце теста или режим «Только мои ошибки» потом: ответы запоминаются в этом браузере.
Незавершённый тест сохраняется — после перезагрузки страницы можно продолжить с того же вопроса.
Темы теста
- Document structure 9
- Text formatting 9
- Inline and display math 9
- Math symbols and operators 10
- Aligning equations 9
- Matrices and arrays 9
- Theorems and proofs 9
- Tables and figures 9
- References and bibliography 9
- Macros and packages 9
- Errors and compilation 9
Другие тесты
Тест по линейной алгебре160 вопросовТест по дифференциальным уравнениям130 вопросовТест по теории вероятностей и статистике130 вопросовТест по SAS100 вопросовТест по языку R100 вопросовТест по системам компьютерной алгебры100 вопросовТест по Fortran120 вопросовТест по языку C100 вопросовТест по COBOL100 вопросовТест по MATLAB100 вопросовТест по PowerBuilder100 вопросовТест по UNIX100 вопросов
