{formatting} is for general questions about formatting document elements. Use this tag in addition to other tags specifying what should be formatted. For questions about font attributes (e.g., {bold}, {italic}, {small-caps}, {sans-serif}, {typewriter}), use the appropriate tag instead.

learn more… | top users | synonyms

12
votes
3answers
980 views

Reusing LaTeX code to achieve a consistent layout

What is the best approach to reusing the same layout for numerous tables, paragraphs etc. which share the same structure but different content? Is the best method to use custom commands/macros?
12
votes
5answers
2k views

How to use siunitx with non numerical values?

I understand that something like \SI{5}{\meter\per\second} defines a certain space between the number (5) and units (m/s). What should I use if instead of a numerical quantity I want a variable: R ...
12
votes
3answers
421 views

Formatting numbers while printing

Is there a way to format number strings while printing? Suppose I have the following declaration: \newcommand{\MyNumberA}{40} \newcommand{\MyNumberB}{60} The following in the text: ...
12
votes
2answers
11k views

Code Snippet IN Text

How do I show a code snippet directly in my text? I dont want to have an extra box for it like lstlisting or verbatim provide it. My example may should look like this: The class List.class is... ...
12
votes
3answers
6k views

Two column code listings in appendix in a one column report

How do I place a two column appendix in a single column report? I want it so that at the beginning of the appendix I'm in single column mode, then I want to place some source code listings in 2 column ...
12
votes
4answers
1k views

Replace . (period) by , (comma) in numbers

I pass a bunch of numbers into a custom command defined via \newcommand{\mycmd}[1]{...}: \mycmd{1.12} \mycmd{5.32} \mycmd uses the number to draw a certain figure. On top of that, I would like to ...
12
votes
2answers
2k views

printf-style number formatting in LaTeX

Is there a way to use printf-style number formatting strings in Latex like %.3f, %d, etc? I'm loading some data from csv files using the datatool package and would like to have it displayed exactly to ...
12
votes
5answers
2k views

Change title to small caps but not in ToC

I want the title for the Acknowledgements page in my thesis to be in small caps. However, if I change it, it also changes in the table of contents. How can I avoid this? Especially, the roman page ...
12
votes
2answers
276 views

How to have a number directly under a decimal point?

I am trying to write a number in quaternary form and would ideally like to show this by having a four underneath the decimal point. I've searched around, but can't figure out how to do this so any ...
12
votes
2answers
2k views

How to insert code and graphic in textbox

I want to put a graphic and a little linux bash code in a textbox, like the picture blow... with the follow in problem: all in a textbox with yellow backgroud left part is a graphic (a finger)... ...
12
votes
1answer
444 views

How do I enter ὅπερ ἔδει δεῖξαι in TeX?

How do I typeset this statement if I'm using \usepackage[default]{frcursive} and \usepackage[T1]{fontenc} in my TEX file?
12
votes
1answer
4k views

Caption is bold. Can I have part of it not bold?

What is the simplest way to have part of a bold caption (including some inline math) non-bold?
12
votes
1answer
324 views

How does one implement drop caps in plain TeX?

How might one implement a simple drop cap in plain TeX without additional packages?
12
votes
1answer
668 views

Is there a workaround against loss of precision in pgfplots axis?

I am generating a bunch of plots automatically using pgfplots. For some datasets the span of data in one axis (y) is relatively small (relative to the absolute value) and therefore pgfplots when ...
12
votes
1answer
177 views

First reference to equation underlined

In these days I'm writing at my Bachelor's Thesis and I've got a new problem. I have to underline the first reference to figures, tables and equations. By searching in the Internet I've already found ...
11
votes
4answers
562 views

Is there a ready solution to typeset a diff file?

In a text about Git I want to typeset diffs similar to this visualization: Commit details on GitHub. Is there any ready-made solution to that, especially the coloring of the diff lines? (In other ...
11
votes
2answers
656 views

Package for more creative text formatting in latex

What is a reasonable package to be used for realizing something like the following example (including image altered): The source is ...
11
votes
5answers
10k views

Makeindex - Styling the \printindex?

I have two questions: Is it possible to change the titel of the printindex command? It is "Index" by default. How can I format the index as a multi column, alphabetic sorted list?
11
votes
3answers
2k views

bad formating of ff in math mode

I'm trying to write something like: $affinity(x)$, but in the PDF I see some small spacing between the two f's. I tried $af{}firm(x)$ or $aff{}irm(x)$, but nothing works.
11
votes
3answers
2k views

University's logo

How to put the logo before the date and after my name in the title? I write it as \begin{document} \title{} \author{} \titlepic{ \includegraphics[width=0.5\textwidth]{logo} \date{} but ...
11
votes
5answers
1k views

Formatting Decimals

Suppose I have a long decimal (assume it is ~6 inches long when written out in 12 point font in LaTeX when I center it, so something like ...
11
votes
2answers
408 views

Non-trivial table in LaTeX

I want to convert this OO table into latex: This is what I have so far: \begin{table} \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|} %p{4cm} \hline \multicolumn{7}{|c|}{Czas ...
11
votes
3answers
699 views

How to draw a border around character in a formula?

So far everything I found on the matter of borders only applies to the text mode. I want to be able to do something like $x_i = y$ so the result will be like the ordinary "xi = z" formula with the ...
11
votes
1answer
389 views

Text in an equation

This is best explained by example. Suppose I have the following: \[ \begin{align*} C_3 \rightarrow 6 automorphisms\\ C_4 \rightarrow 8 automorphisms\\ C_5 \rightarrow 10 automorphisms ...
11
votes
2answers
214 views

Is there such thing as “p{height}”

I am making a table right now and it's really annoying that items in my cell are getting crunched \begin{center} \begin{tabular}{|c| c | c|} Critical Points $P_0$ & $f(P_0)$ & Conclusion \\ ...
11
votes
4answers
192 views

Aligning the long equations

I have read all of the different solutions for fitting long formulas in a page, yet I am still not satisfied with the output I get. The formulas are right aligned which does not look good. Would you ...
11
votes
3answers
4k views

How can I create a Chicago Manual of Style formatted document in LaTeX?

I have an assignment which requires me to use CMS formatting, double spaced, in 12pt font. I'd rather avoid using the much inferior "Word" or "Writer" programs -- in particular I like how LaTeX ...
11
votes
1answer
361 views

Is it OK to use \tt etc. in latex2e if you don't want the text to inherit the font of the containing text?

I want some words to always be in upright teletype (they are defined to be something specific). If the sentence is emphasised and this word appears I do not want the text to be italic teletype, but ...
11
votes
1answer
2k views

Format section titles as white text on black background

I would like to redefine the \section and \section* to produce section titles that look roughly like this: that is, text in white over a black bar that extends from left to right margin. I don't ...
11
votes
5answers
219 views

Best way to have two kinds of formattings for my documents?

I would like to produce two kinds of formattings for my documents. The 1st formatting will use colors. This is typically for reading on a screen. The 2nd formatting will use gray colors for ...
11
votes
1answer
816 views

siunitx and engineering 'E' notation

Is it possible to use the siunitx package to typeset numbers with the "E" notation so that the output might look like 1E3 instead of 1 x 10^3
11
votes
2answers
2k views

Options and suggestions for hyperref font?

Background I am interested in finding and implementing a more aesthetically pleasing style for the hyperlinks in my document. I have read through the documentation, but I find both the colored text ...
11
votes
3answers
2k views

How can I make a set of latex flashcards that I can print to write my answers on one side?

I want to adapt the code from the answer to latex flashcard problem so that the right hand side has a question and the left has the answer rather than on the bottom of the page. This is so that I ...
11
votes
1answer
153 views

Defining a particular environment in LaTeX

I need help writing an Example environment. I just want it to look like the figure below which I took from an old book I have in my library. This is what I have done. ...
11
votes
1answer
1k views

Algorithm as figure and without italic and bold formatting?

I want to include an algorithm in my latex document, however without printing most of it in italic and all the keywords in bold font like it's done by default by e.g. the algorithmicx package. I like ...
11
votes
2answers
2k views

Customizing Chapter style in scrbook

I want to obtain styles like those showed in the next two images (I do not need the picture in the background (parabolas)): My original LaTeX code (to be customized but should keep font as they ...
11
votes
3answers
193 views

Not breaking the start of an environment for solution of exercises

Let suppose that I have an environment \begin{sol} ... \end{sol} for writing solutions of exercises in a test. For practical reasons, I would like that two or more solutions can be put in the same ...
11
votes
2answers
482 views

Using prefix notation

I want to show prefix notation in my document, somewhat like this: + (x 5 3) (- 6 4) However, I want to enter it in maths mode, but maths mode removes all the spaces, so I get +(x53)(-64) Which ...
11
votes
1answer
380 views

When should math be upright?

Is there any standards for when math is supposed to be upright? E.g. The f in f(x) is in italics but cos in \cos x is upright. As I see it, both are functions? \int f(x) \, dx OR \int f(x) \, ...
11
votes
1answer
372 views

New list environment: automatic enumeration with “a posteriori” format

This is a follow-up question to Nested enumerate labels with parent label appended plus a single set of enclosing parentheses First and foremost, sorry for my English, I'm learning it currently. ...
10
votes
5answers
3k views

I just want to have the text in my pdf the same way I have it in my editor

I want to paste from the clipboard a plain text copied from a text editor (line wordpad++, vim, notepad etc), and I want TeX to respect the same line break formatting that the editor has. This works ...
10
votes
3answers
342 views

“Escaping” Linux kernel version in latex

I'm trying to include a kernel version info (i.e. \texttt{2.6.40.4-5.fc15.x86_64}) in my LaTeX document. However, LaTeX keeps trying to put it into "math-text" ("Missing $ inserted" and so on). How ...
10
votes
2answers
791 views

Replacing all dots in a document

I want to replace all dots in a LaTeX document with a call to a macro. Just doing a search and replace on '.' won't help as this will not replace the dots generated by LaTeX, e.g. in section numbers, ...
10
votes
3answers
4k views

Mirror effect in documents

The following example (links to pdf) in the TeX Showcase has no provided source. The book Fearless Symmetry by Ash and Gross seems to use a similar style. Where can I find hints for typesetting ...
10
votes
3answers
210 views

How to make or add options for packages or functions

I'm using at this moment the Piano Package. This Package is a little limited so I want to change a few things. The standard color of the dots is orange. I want to change this in different situations. ...
10
votes
3answers
915 views

Writing an equation with the units positioned off right

Okay so I have a have a lot of equations in the document I am writing and I am trying to display the units of an equation off to the right. I was wondering how I can achieve this? Right now, all I ...
10
votes
1answer
239 views

How to create Windows-8-styled menus?

I'm writing a technical documentation and I want to explain step-by-step how to go through various menus. For example I used to write Open with > VLC media player. That's how it looks in Windows ...
10
votes
4answers
420 views

How to write \slashed, \mathcal and \mathring at the same time?

I need to write something like \slashed{\mathcal{\mathring{S}}}. I tried to write it in several orders, but none of them gave me the wanted result. I found out that I have to write ...
10
votes
1answer
473 views

How can I mimic Griffiths' electrodynamics textbook?

This is such a beautiful textbook; very dear to me. I think it has a great font - which I know is Times New Roman. But somehow, I can't even get close to it. One of the main obstacles is making the ...
10
votes
5answers
4k views

Hiding part of text leaving blank space

I am quite new to LaTeX so my question may be trivial, but I haven't found a good solution so far. I am preparing some lecture notes and I would like to have 2 different versions: one for myself, ...