### Example Environment Usage Source: https://github.com/elegantlatex/elegantbook/wiki/MathEnvironments The example environment can be used directly without specific options. It is numbered within the chapter and may include a prompt. ```tex \begin{example} This is the content of example environment. \end{example} ``` -------------------------------- ### Basic Introduction Environment Usage Source: https://github.com/elegantlatex/elegantbook/wiki/ChapterSummary This snippet shows the fundamental usage of the \begin{introduction} environment to list chapter items. It requires no special setup beyond including the ElegantLaTeX package. ```latex \begin{introduction} \item Definition of Theorem \item Ask for help \item Optimization Problem \item Property of Cauchy Series \item Angle of Corner \end{introduction} ``` -------------------------------- ### Update TeX Live Packages Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Use these commands to update the TeX Live manager itself and all installed packages. ```latex tlmgr update --self tlmgr update --all ``` -------------------------------- ### Custom Chinese Fonts with nofont Option Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-cn.tex Configure custom Chinese fonts using the nofont option. This example sets main, sans-serif, and monospace fonts, and defines custom commands for different styles. ```latex \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01} \setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03} \setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02} \setCJKfamilyfont{zhsong}{FZShuSong-Z01} \setCJKfamilyfont{zhhei}{FZHei-B01} \setCJKfamilyfont{zhkai}[BoldFont={FZHei-B01}]{FZKai-Z03} \setCJKfamilyfont{zhfs}[BoldFont={FZHei-B01}]{FZFangSong-Z02} \newcommand*{\songti}{\CJKfamily{zhsong}} \newcommand*{\heiti}{\CJKfamily{zhhei}} \newcommand*{\kaishu}{\CJKfamily{zhkai}} \newcommand*{\fangsong}{\CJKfamily{zhfs}} ``` -------------------------------- ### Create Introduction Environment Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Use the \begin{introduction} environment to list items, such as definitions or topics. The title can be customized with an optional argument. ```latex \begin{introduction} \item Definition of Theorem \item Ask for help \item Optimization Problem \item Property of Cauchy Series \item Angle of Corner \end{introduction} ``` ```latex \begin{introduction}[Brief Introduction] ...\end{introduction} ``` -------------------------------- ### Theorem Environment Usage (Fancy Mode) Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Demonstrates various ways to use the \begin{theorem} environment with and without names and labels in fancy mode. ```latex % name + label \begin{theorem}{theorem name}{label} The content of a theorem with name and label. Use \ref{thm:label} to refer this theorem. \end{theorem} % no name + label \begin{theorem}{}{label no name} The content of a theorem without name. Use \ref{thm:label no name} to refer this theorem. \end{theorem} % name + no label \begin{theorem}{theorem name}{} The content of a theorem without label. Can't refer this theorem. The last {} can be removed. \end{theorem} % no name + no label \begin{theorem}{}{} The content of a theorem without name and label. Can't refer this theorem. Both of {} can be removed. \end{theorem} ``` -------------------------------- ### Customizing Introduction Environment Title Source: https://github.com/elegantlatex/elegantbook/wiki/ChapterSummary Demonstrates how to change the default title of the 'introduction' environment by providing an optional argument. This allows for more specific labeling of the content. ```latex \begin{introduction}[Brief Introduction] ... \end{introduction} ``` -------------------------------- ### Theorem Environment Usage (Simple Mode) Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Illustrates the usage of theorem environments in simple mode, which relies on the amsthm package. ```latex \begin{theorem}[theorem name]\label{thm:theorem-label} The content of theorem. \end{theorem} % or \begin{theorem}\label{thm:theorem-without-name} The content of theorem without name. \end{theorem} ``` -------------------------------- ### Defining a Theorem Environment Source: https://github.com/elegantlatex/elegantbook/wiki/MathEnvironments Use the \begin{theorem} command to create a theorem. Provide a name for the theorem and a label for cross-referencing. Cross-references must be prefixed with 'thm:'. ```tex \begin{theorem}{theorem name}{label} The content of theorem. \end{theorem} ``` -------------------------------- ### Theorem Environment Usage (Fancy Mode, v4.1+) Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Shows the updated syntax for theorem environments from version 4.1 onwards, using optional arguments for names and labels. ```latex \begin{theorem}[theorem name]\label{thm:theorem-label} The content of theorem. \end{theorem} % or \begin{theorem}\label{thm:theorem-without-name} The content of theorem. \end{theorem} ``` -------------------------------- ### Selecting Bibliography Backend (Biber/BibTeX) Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Shows how to select the bibliography backend using the 'bibtex' option or 'bibend=bibtex'. Biber is the recommended backend for this template. ```LaTeX \documentclass[bibtex]{elegantbook} % or \documentclass[bibend=bibtex]{elegantbook} ``` -------------------------------- ### Basic ProblemSet Environment Usage Source: https://github.com/elegantlatex/elegantbook/wiki/ProblemSet Use the `problemset` environment to list exercises. Customize the title using an optional argument, similar to the `introduction` environment. Entries appear in the catalogue but not headers/footers. ```tex \begin{problemset} \item exercise 1 \item exercise 2 \item exercise 3 \end{problemset} ``` -------------------------------- ### Add Unnumbered Chapter with Preface Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Use \chapter*{...} to add a preface or unnumbered chapter. Ensure \markboth is used for correct header/footer pagination. ```latex \chapter*{Introduction} \markboth{Introduction}{Introduction} The content of introduction. ``` -------------------------------- ### Enable yhmath Package Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-cn.tex Uncomment these lines in elegantbook.cls to load the yhmath package when using newtxmath, resolving potential symbol font conflicts. ```latex %%% use yhmath pkg, uncomment following code % \let\oldwidering\widering % \let\widering\undefined % \RequirePackage{yhmath} % \let\widering\oldwidering ``` -------------------------------- ### Selecting a Color Theme Source: https://github.com/elegantlatex/elegantbook/wiki/ColorThemes Choose a color theme by passing its name as an option to the \documentclass command. The default theme is blue. ```tex \documentclass[green]{elegantbook} %or \documentclass[color=green]{elegantbook} ``` -------------------------------- ### Enable esvect Package Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-cn.tex Uncomment these lines in elegantbook.cls to load the esvect package when using newtxmath, resolving potential symbol font conflicts. ```latex %%% use esvect pkg, uncomment following code % \RequirePackage{esvect} ``` -------------------------------- ### Set Elegant Book Document Class Options Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Specify document class options for one or two-column layouts, and for including a table of contents. ```latex \documentclass[twocol]{elegantbook} ``` ```latex \documentclass[toc=twocol]{elegantbook} ``` -------------------------------- ### Customizing List Environments Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Demonstrates the customization of itemize and enumerate list environments to specific depths using TikZ. This is useful for creating deeply nested lists with consistent styling. ```LaTeX \begin{minipage}[b]{0.49\textwidth} - first item of nesti; - second item of nesti; - first item of nestii; - second item of nestii; - first item of nestiii; - second item of nestiii. \end{minipage} \hfill \begin{minipage}[b]{0.49\textwidth} - first item of nesti; - second item of nesti; - first item of nestii; - second item of nestii; - first item of nestiii; - second item of nestiii. \end{minipage} ``` -------------------------------- ### Add Figures to Margin Notes with Center Environment Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Alternatively, use the \begin{center} environment within \marginpar to center figures and their captions. This method also requires \captionof for the figure caption. ```latex % graph with center environment \marginpar{ \begin{center} \includegraphics[width=0.2\textwidth]{logo.png} \captionof{figure}{your figure caption} \end{center} } ``` -------------------------------- ### Minimal ElegantBook Document Structure Source: https://github.com/elegantlatex/elegantbook/wiki/MinimalExample This snippet shows the essential preamble and document body for a minimal elegantbook. It includes metadata like title, author, and date, along with basic document content such as a title page, table of contents, and a sample chapter. ```tex \documentclass{elegantbook} % title info \title{Title} \subtitle{Subtitle is here} % bio info \author{Your Name} \institute{XXX University} \date{\today} % extra info \version{1.00} \extrainfo{Victory won't come to us unless we go to it. --- M. Moore} \logo{logo.png} \cover{cover.jpg} \begin{document} \maketitle \tableofcontents \mainmatter \hypersetup{pageanchor=true} % add preface chapter here if needed \chapter{Example Chapter Title} The content of chapter one. \bibliography{reference} \end{document} ``` -------------------------------- ### Define Custom Colors in ElegantBook Preamble Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Customize colors by setting 'nocolor' or 'color=none' and defining 'structurecolor', 'main', 'second', and 'third' colors using RGB values in the preamble. ```latex \definecolor{structurecolor}{RGB}{60,113,183} \definecolor{main}{RGB}{0,166,82}% \definecolor{second}{RGB}{255,134,24}% \definecolor{third}{RGB}{0,174,247}% ``` -------------------------------- ### Setting Document Class to Simple Mode Source: https://github.com/elegantlatex/elegantbook/wiki/MathEnvironments Change the document to 'simple' mode by specifying it in the \documentclass command. This affects the styling of theorem environments. ```tex \documentclass[simple]{elegantbook} %or \documentclass[mode=simple]{elegantbook} ``` -------------------------------- ### Add Bio Information to Cover Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Use the \bioinfo command to display custom user information on the cover page. It takes two arguments: the caption and the content. ```latex \bioinfo{Username}{115520} ``` -------------------------------- ### Customizing Colors Source: https://github.com/elegantlatex/elegantbook/wiki/ColorThemes To customize colors, set the 'nocolor' option or 'color=none' and then define the structurecolor, main, second, and third colors using \definecolor in the preamble. ```tex \definecolor{structurecolor}{RGB}{60,113,183} \definecolor{main}{RGB}{0,166,82}% \definecolor{second}{RGB}{255,134,24}% \definecolor{third}{RGB}{0,174,247}% ``` -------------------------------- ### Add Preface to Elegant Book Source: https://github.com/elegantlatex/elegantbook/wiki/Preface Use this LaTeX code to add a preface before the first chapter. It ensures the preface is listed in the table of contents and has its own header, while chapter numbering remains unaffected. ```tex \chapter*{Preface} \addcontentsline{toc}{chapter}{Preface} \markboth{Preface}{} The content of Preface. ``` -------------------------------- ### Placing Equations in Margin Notes Source: https://github.com/elegantlatex/elegantbook/wiki/SideNote Equations can be placed within `\marginpar` by enclosing them in a LaTeX math environment. Ensure the environment is compatible with margin placement. ```tex % equation \marginpar{ \begin{equation} a^2 + b^2 = c^2 \end{equation} } ``` -------------------------------- ### Setting Theorem Counter Display Style Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Configures the theorem counter display style using the 'thmcnt' option in the document class. ```latex \documentclass[section]{elegantbook} % turn the Theorem 4.1 to Theorem 4.1.1 \documentclass[thmcnt=section]{elegantbook} ``` -------------------------------- ### Placing Text in Margin Notes Source: https://github.com/elegantlatex/elegantbook/wiki/SideNote Use the `\marginpar` command to insert text directly into the margin. This is suitable for short annotations or comments. ```tex % text \marginpar{margin paragraph text} ``` -------------------------------- ### Changing Bibliography Styles Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Demonstrates how to change the citation and bibliography styles using the 'citestyle' and 'bibstyle' options. Refer to the biblatex CTAN page for available styles. ```LaTeX \documentclass[citestyle=numeric-comp, bibstyle=authoryear]{elegantbook} ``` -------------------------------- ### Activate iPad Mode in ElegantBook Source: https://github.com/elegantlatex/elegantbook/wiki/DeviceModeOption Use the 'pad' option directly or specify 'device=pad' when loading the elegantbook document class to activate iPad mode. ```tex \documentclass[pad]{elegantbook} %or \documentclass[device=pad]{elegantbook} ``` -------------------------------- ### Uncommenting yhmath Package Loading Source: https://github.com/elegantlatex/elegantbook/wiki/SymbolFont Uncomment this code block in `elegantbook.cls` to enable the `yhmath` package and resolve symbol font conflicts. ```tex % \let\oldwidering\widering % \let\widering\undefined % \RequirePackage{yhmath} % \let\widering\oldwidering ``` -------------------------------- ### Set Math Font to newtx Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-cn.tex Use this option to select the newtxmath package for mathematical fonts. This was the default in older versions. ```latex \documentclass[math=newtx]{elegantbook} ``` -------------------------------- ### Handling Hyphens with Newtx Math Font Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Illustrates a specific hyphenation and math rendering issue when using the 'newtx' math font option. Pay attention to the rendering of '_R^q f(x,y) dy.*of0pt f* x'. ```LaTeX \begin{equation} \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} \sin x \end{equation} ``` -------------------------------- ### Set Document Language in ElegantBook Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Use the \documentclass command with the 'lang' option to specify the document's language. The default is 'en'. ```latex \documentclass[en]{elegantbook} ``` ```latex \documentclass[lang=en]{elegantbook} ``` -------------------------------- ### Uncommenting esvect Package Loading Source: https://github.com/elegantlatex/elegantbook/wiki/SymbolFont Uncomment this code block in `elegantbook.cls` to enable the `esvect` package and resolve symbol font conflicts. ```tex % \RequirePackage{esvect} ``` -------------------------------- ### Hiding the Base with Document Class Options Source: https://github.com/elegantlatex/elegantbook/wiki/BaseHideOption Use the `hide` or `base=hide` option in the \documentclass command to hide the end-of-chapter or below-of-page base. This is an optional setting. ```tex \documentclass[hide]{elegantbook} %or \documentclass[base=hide]{elegantbook} ``` -------------------------------- ### Fix newtxmath Hyphenation Issue Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-cn.tex This code snippet demonstrates the correct way to typeset a formula with newtxmath to avoid hyphenation issues with the underscore. ```latex \begin{equation} \int_{R^q} f(x,y) dy.\emph{of\kern0pt f} \sin x \end{equation} ``` -------------------------------- ### Include Non-Cited References in Bibliography Source: https://github.com/elegantlatex/elegantbook/wiki/Bibliography Use the \nocite command to include specific or all bibitems in the generated bibliography. This is useful for adding references that are not directly cited in the text. ```tex \nocite{EINAV2010,Havrylchyk2018} %or include some bibitems \nocite{*} %include all the bibitems ``` -------------------------------- ### Printing the Bibliography Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Includes commands to print the bibliography within the document, with options for including it in the table of contents and setting a custom title. The default title is '\ebibname'. ```LaTeX \printbibliography[heading=bibintoc, title=\ebibname] ``` -------------------------------- ### Handling Mathematical Expressions with Hyphens Source: https://github.com/elegantlatex/elegantbook/wiki/Hyphen This snippet demonstrates how to correctly format a mathematical expression within an equation environment to avoid hyphenation issues when using the newtx font family. It ensures proper rendering of the expression 'of f'. ```tex \begin{equation} \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} \end{equation} ``` -------------------------------- ### Adding Local Bibliography Resource Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Adds a local 'reference.bib' file to the document's bibliography resources. This is required for biblatex to find and process your bibliography entries. ```LaTeX \addbibresource[location=local]{reference.bib} ``` -------------------------------- ### Including Centered Graphs in Margin Notes Source: https://github.com/elegantlatex/elegantbook/wiki/SideNote To include images in margin notes, use `\marginpar` with either the `\centerline` command or the `center` environment for horizontal centering. The `\captionof` command is used to add a caption to the figure. ```tex % graph with centerline command \marginpar{ \centerline{ \includegraphics[width=0.2\textwidth]{logo.png} } \captionof{figure}{your figure caption} } ``` ```tex % graph with center environment \marginpar{ \begin{center} \includegraphics[width=0.2\textwidth]{logo.png} \captionof{figure}{your figure caption} \end{center} } ``` -------------------------------- ### Set Chapter Title Display Style Source: https://github.com/elegantlatex/elegantbook/wiki/DisplayStyles Use the 'hang' option for single-line chapter headings or 'titlestyle=hang' for the default behavior. To change to a double-line style, use 'display' instead. ```tex \documentclass[hang]{elegantbook} %or \documentclass[titlestyle=hang]{elegantbook} ``` -------------------------------- ### Define Custom Cover Line Color Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Customize the color of the horizontal bar on the cover page by defining a custom RGB color and then using \colorlet to assign it to coverlinecolor. ```latex \definecolor{customcolor}{RGB}{32,178,170} \colorlet{coverlinecolor}{customcolor} ``` -------------------------------- ### Add Figures to Margin Notes with Centerline Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Include figures in margin notes using \marginpar. The \centerline command can be used to center the image within the margin. Ensure \captionof is used for the figure caption. ```latex % graph with centerline command \marginpar{ \centerline{ \includegraphics[width=0.2\textwidth]{logo.png} } \captionof{figure}{your figure caption} } ``` -------------------------------- ### Set Citation Style to Superscript Source: https://github.com/elegantlatex/elegantbook/wiki/Bibliography Configure the ElegantBook document class to use the 'super' citation style for numerical references. This is often preferred in science and technology fields. ```tex \documentclass[cite=super]{elegantbook} \documentclass[super]{elegantbook} ``` -------------------------------- ### Set Document Language to Chinese Source: https://github.com/elegantlatex/elegantbook/wiki/Languages Use the `lang=cn` option to set the document language to Chinese. This affects captions and other localized text. The default is `lang=en`. ```tex \documentclass[lang=cn]{elegantbook} ``` ```tex \documentclass[lang=en]{elegantbook} ``` -------------------------------- ### Resolving Symbol Font Declaration Errors Source: https://github.com/elegantlatex/elegantbook/blob/master/elegantbook-en.tex Provides commented-out code to uncomment if you encounter 'Too many symbol fonts declared' errors when using packages like 'yhmath' or 'esvect'. This involves redefining font handling in the class file. ```LaTeX %%% use yhmath pkg, uncomment following code % \let\oldwidering\widering % \let\widering\undefined % \RequirePackage{yhmath} % \let\widering\oldwidering %%% use esvect pkg, uncomment following code % \RequirePackage{esvect} ``` -------------------------------- ### Set Citation Style to Author-Year Source: https://github.com/elegantlatex/elegantbook/wiki/Bibliography Configure the ElegantBook document class to use the 'authoryear' citation style. This is commonly used in the liberal arts and humanities. ```tex \documentclass[cite=authoryear]{elegantbook} % set cite for author year ref style \documentclass[authoryear]{elegantbook} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.