# LaTeX/Q&A

If you have a question when dealing with LaTeX and are in need of some help, please refer to How to get help.
* LaTeX
* Getting Started
* Introduction
* Installation
* Installing Extra Packages
* Basics
* How to get help
* Common Elements
* Document Structure
* Text Formatting
* Paragraph Formatting
* Colors
* Fonts
* List Structures
* Special Characters
* Internationalization
* Rotations
* Tables
* Title creation
* Page Layout
* Customizing Page Headers and Footers‎
* Importing Graphics
* Floats, Figures and Captions
* Footnotes and Margin Notes
* Hyperlinks
* Labels and Cross-referencing
* Initials
* Mechanics
* Errors and Warnings
* Lengths
* Counters
* Boxes
* Rules and Struts
* Technical Text
* Mathematics
* Advanced Mathematics
* Theorems
* Chemical Graphics
* Algorithms
* Source Code Listings
* Linguistics
* Special Pages
* Indexing
* Glossary
* Bibliography Management
* More Bibliographies
* Special Documents
* Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
* Letters
* Presentations
* Teacher's Corner
* Curriculum Vitae
* Academic Journals (MLA, APA, etc.)
* Creating Graphics
* Introducing Procedural Graphics
* MetaPost
* Picture
* PGF/TikZ
* PSTricks
* Xy-pic
* Creating 3D graphics
* Programming
* Macros
* Plain TeX
* Creating Packages
* Creating Package Documentation
* Themes
* Miscellaneous
* Modular Documents
* Collaborative Writing of LaTeX Documents
* Export To Other Formats
* Help and Recommendations
* FAQ
* Tips and Tricks
* Appendices
* Authors
* Links
* Package Reference
* Sample LaTeX documents
* Index
* Command Glossary

## Who?

Who wrote this? It seems a rather phenomenal piece of work! We'd love to publish an article or a notice about it in one of the TeX journals. I looked at the history of a couple pages, but the answer was not apparent ... anyway, thanks, whoever you are! --karl@tug.org
    well, there is the authors section for this :-) I wrote lots of parts of the book. As you can see, we have the permission to include several existing books on LaTeX here. I have added most of the "not so short introduction...", but I still have to finish. As soon as I have a lot of free time (July I guess), I'll work on introducing all of them and this will be a very good book, (hopefully) having the best of all the others. The main good point is that LaTeX changes quite quickly, while most of the existing guides are really old and mostly outdated. This Wikibook gets updated continuously thanks to lots of contributors. I have seen lots of anonymous users fixing some smaller mistakes. Alessio Damato 08:31, 21 May 2007 (UTC)

## Cyrillic letters

How can I write a text in Cyrillic using "math" command? Is it possible?
>> According to Tobias Oetiker's "The Not So Short Introduction to LaTex2e", you need to add the mathtext package before the fontenc package. Here is what might go at the top of the document:
When you are in math mode, remember that to show regular text you use the {\text} command. I added extra braces because there are certain cases where you need them.
    See also: LaTeX/Internationalization#Cyrillic script

## splitting a project into files (\includeonly)

I've been using \includeonly and \include as described under the advanced topics section of the wikibook, but am not sure the output is what it should be: If I put a \label{marker} command in a file foo.1, and then put a \ref{marker} command in a file foo.2, then even though I use \includeonly{foo.1,foo.2} in the rootfile preamble and \include{foo.2} (and no other \include command) in the rootfile body, I'm told that the reference was undefined. I thought that \includeonly allowed one to preserve cross-references without having to process more than one wants to see. Can anyone tell me what I'm doing wrong? Thanks. -- 132.161.33.86 18:01, 31 January 2007 (UTC)

## Using LaTeX on a website

Is it possible to use LaTeX on a personal website in much the same way it is used in Wikipedia, i. e. when LaTeX commands immediately appear as automatically generated picture files?
    no you can't. Wikipedia stores the sources (containing LaTeX parts as well) and converts them to HTML and images before sending it to user's browser. You should use a software doing the same (or you can use WikiMedia, too), but you need to set up the server properly... Alessio Damato 16:29, 20 August 2007 (UTC)
Thank you. 86.100.3.253 19:44, 22 August 2007 (UTC)
    yes, it do is possible, using the right CGI-scripts
       One easy way to do this is to use MathJax: . You just put
in the document head. Then in the body just use $...$, $$...$$ or \(...\), \[...\] to enclose mathematical formulas. Ashaio (discuss • contribs) 09:19, 8 June 2011 (UTC)

## Multi-line title

Hi, I'm quite new to latex and there's something I'd need to do but I'm not able to, nor i could find any hint over the net. What i need is to create a multi-line document main title - it seems easy but i couldn't work it. If someone could help me i would really appreciate it.
[EDIT] OK, I'm ever newer to wikis and i can't create a new topic. Sorry for the mess.
Thank you in advance Antonio
    Use \\ at the end of each line. Ashaio (discuss • contribs) 09:19, 8 June 2011 (UTC)
Can anyone please tell me what does the command ``punt does?

## book-writing

~October 4, 2008 how do i write a book using latex? is there an available template?
    What do you mean by 'book'? A textbook/manual? A novel? Anyway, you should start by specifying document class book and know how to start chapter. There's more about creating table of contents and index. --Derbeth $^{talk}$ 17:06, 8 October 2008 (UTC)
Is there a powerful way for add chemical structures in my papers using Latex? Now i've to add images created with a graphic design software, but it's a really slow way to write them. Nothing like a text definition of chemical structures in Latex with subsequent graphical output? Thank you.
    Ok. Let me google that for you. --24.113.3.173 (discuss) 00:19, 29 March 2012 (UTC)

## address labels

I'm trying to output an address list (home addresses, telephone numbers, email addresses, etc.) in a standard address label-like format. In other words, I'd like, say, 3 labels across, and N labels down (whatever will fit on the page). I've looked at (and used) the labels package, but I don't like one aspect of its formatting. Each of the labels is centered in its "cell". This means that if one label is 3 lines long and another is 6 lines long, the tops of the address labels don't line up horizontally. This is probably considered a "feature", but what I'd like to achieve is that all the "first lines" line up while each address label having possibly different numbers of lines.
Does anyone know how to do this? I'd like output that looks like this:
Clearly, the size of each "box" should be large enough for the label with the greatest number of lines.
If you have any suggestions, please let me know. If possible, I'd like to have each address label be defined in the same way as in the labels package -- blank lines separate addresses, but other representations would be ok too.
Thanks. 12.107.176.254 (talk) 02:35, 4 November 2008 (UTC) Eric

## Section numbering in the PDF version?

Dear Contributors! The LaTeX wikibook is a really impressive and valuable piece of work, thanks a lot! Would it be possible to include [[[sub]sub]sub]section numbering in the PDF version? It would enhance its usability even further!

## \renewcommand for section doesn't work

Hello! I wanted to have every section in a new page. So I thought I could renewcommand section to newpage and then section, like:
However, this freezes my compiler (I am using xelatex). Is it a problem of recursion? Does it not like recursive calls to the same function when renewing it?
Anyway, thinking that could be a problem of recursion, I tried an other way:
This should avoid recursion, but it freezes my compiler anyway. Any idea? Thanks a lot! -- 93.97.73.141 (talk) 23:58, 8 February 2009 (UTC)
    You need to take a snapshot of \section using let:
    --134.169.135.176 (talk) 12:45, 1 April 2009 (UTC)

## Chemistry in LaTeX?

As the question already asked above was ignored, I'll try it again. Is there an acceptable way to write chemical formulas? -84.59.3.240 (talk) 14:46, 19 March 2009 (UTC)
    If you just wish to write formulas, then there is a package mentioned in the formatting section (search for chemical). If you wanted to produce graphical structures, then you could try searching for a package at the CTAN website, see the installing packages section.
If you mean chemical structures, ochem probably is what you are looking for. You can find it here.
chemfig can also be used to draw 2D chemical structures. Unlike ochem, chemfig does not require Perl.
mhchem is fantastic for making entry of formulas and their associated subscripts etc. easier.

### More chemistry

What about drawing larger molecular structures, such as CNTs, fullerenes, micelles and reverse micelles?

## format arguments in newcommand

In the following newcommand, (how) can the argument be centered, *on the same line* as the labelenumi in the marginpar?
(Inserting the centering environment between \hspace{5pt} and the argument #1 creates a line space in the marginpar--at least in pdflatex.)
A modified box may be required, but is there a different solution? Thanks --66.31.140.209 (talk) 14:18, 17 May 2009 (UTC)
How can I write latex online & see my letter? May,30.09
Sir, I want to learn latex and writing a book in latex. I have seen the pdf version of this Latex book which is very beautifull and worth reading. Can i get the latex script of the book i.e. .tex file (Latex.pdf-> Latex.tex )? kindly e-mail me on msohaibayub@yahoo.com. i will be waiting eagerly for your reply. Muhammad Sohaib Ayub Bachelors of Information Technology National University Of Science And Technology Pakistan.

## Citations -- DOI

How does one include the DOI in citations?

## figure and table position within page

I have three questions about how to manage the table and figure within a page: 1)although I have used \newpage in front of every \begin{figure}[H] or \begin{table}[H], sometimes LaTex still put 2 items on one page.
2)For those did appear separately on each page, I can not let the figure located close enough to the caption.
3)Below is the code for two figures I put in. They appear separately on two pages as I wanted. Only that the title of the first one appear in the middle of the page so it is not too far away from the graphic. And for the second one, the title appear at the top of the page, which is what I need, but the graphic stays in the middle of the page. Could anyone tell me how to fix the title at the top of page and let the graphic start right after the caption and any text?
Many thanks!
\newpage \begin{figure}[H]\footnotesize \caption{\textbf{Impulse Response Function}} \label{fig:IRF} This figure presents the IRF (Impulse Response Function) of the three auto process estimations.\\
\leavevmode \includegraphics[width=1\textwidth]{IRF.pdf} \end{figure}
%\newpage \begin{figure}[H]\footnotesize \caption{\textbf{AR(2) Estimation of Yearly Drifts}} \label{fig: AR2Est} This figure presents the fitted yearly drifts of rating transitions and the AR(2) estimation of the drifts from the third year onwards of the entire sample period.\\
\includegraphics[width=1\textwidth]{AR2Estimates.pdf} \end{figure}

## LaTeX PDF Version with external links

I find this book impressive and downloaded the PDF version to be able to use it offline. Unfortunately, all links (e.g. from the glossary) direct me to the web version and not to the local PDF copy. Can this be amended?
Thomas Fischer
This issue seems to be resolved now.--Dirk Hünniger (discuss • contribs) 16:14, 23 June 2013 (UTC)

## Page format

Dear, When i prepare a document, it leaves margins of width more than one inch. But i need only less. How can i reduce the page margins in an article?
    Use the geometry package. This package allows you to specify the 4 margins. The values are relative to the edge of paper (0in) and go inward it. It may be implemented as follows:
    (See more in LaTeX/Page_Layout). Ashaio (discuss • contribs) 09:45, 8 June 2011 (UTC)

## How to format many variables? Can I use a wildcard in a new command?

There are many vectors in my file and I hope to show them in the form of boldsymbol. So I did as follow:
I don't hope to repeat these similar commands, so I hope to edit them in two options as follow:
1. Create group of these variables which can be shown in particular form, as look like
2. Using a wildcard in a new command:
I believe the Latex have this function, but I cannot implement that. Anyone can give me suggestion? Thousands of thanks.
latex code for cauchy's integral formula

## This very book: LaTeX to wiki or wiki to LaTeX?

Was this very book created in LaTeX and then converted to a wiki or visa versa?
    The PDF version was created with MediaWiki to LaTeX, which, as you may guess, converts the whole wikibook source to LaTeX. --Ambrevar (discuss • contribs) 13:31, 23 June 2013 (UTC)
Furthermore the LaTeX source is attached to the PDF version of this book. --Dirk Hünniger (discuss • contribs) 16:04, 23 June 2013 (UTC)

## Sorting a table alphabetically

Hi, Does anybody know how can I sort a table with respect to first column in latex alphabetically? Thanks a lot.

## Developing a book in A5

Hello everyone,
I wrote my dissertation in A4 with LaTex. Now I wonder what changes should be done so that the dissertation fits into a A5 book for publication?
Two options seem to be feasible:
1. to define the document as a5paper in \documentclass. However, the output file in Pdf viewer is displayed in A4, which makes the format checking difficult.
2. An alternative is using landscape to fit 2 pages of the document into 1 A4 paper. Thus, each A4 page forms 2 successive pages of A5.
Does anyone have a better idea of converting A4 to A5, in preparation for book pulication？ Thank you in advance!
Sincerely, Nicole

## As above, A5

I would love to know how to do this as well. To be precise , entering
\documentclass[10pt,a5paper]{article} \special{papersize=148mm,210mm}
\usepackage[a5paper]{geometry}
will produce an A5 'page', but what you type in will appear as A4 still, and will be chopped off if it is not within your A5 'page'
Brian Daugherty