parent_url
stringlengths
41
46
parent_score
stringlengths
1
4
parent_body
stringlengths
25
35.5k
parent_user
stringlengths
37
42
parent_title
stringlengths
12
150
accepted
bool
2 classes
body
stringlengths
4
36.7k
score
stringlengths
1
4
user
stringlengths
37
42
answer_id
stringlengths
1
6
__index_level_0__
int64
0
322k
https://tex.stackexchange.com/questions/2233
74
When studying systems of linear equations, it's nice to remind people that the last column of the coefficient matrix holds the constants. This is often done in books by putting a vertical line between the last column and the next to last column. What is a good way to do this in LaTex?
https://tex.stackexchange.com/users/788
What's the best way make an "augmented" coefficient matrix?
false
If you build your own environment using array, you're on the safe side. I would extend an internal macro of `amsmath` using an optional argument. **Advantages:** * It extends several matrix environments at the same time (`matrix`, `pmatrix`, `bmatrix`, `Bmatrix`, `vmatrix`, `Vmatrix`). * The names and meanings of those environments remain (not `apmatrix` etc.) * Spacing etc. is the same like in `amsmath`. * You could do more than just insert a vertical line (use color and alignment, for instance right aligned columns because of minus signs). * If you omit the optional argument, it acts exactly like the `amsmath` environment. **Caution:** * Since you redefine an internal macro, it might not work if the original package changes its code. But `amsmath.sty` has not been changed for more than 10 years. If there's a change in the matrices later, you could adjust your own macro. **Code:** Here's the redefinition, just put it in your preamble after loading `amsmath`: ``` \makeatletter \renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{% \hskip -\arraycolsep \let\@ifnextchar\new@ifnextchar \array{#1}} \makeatother ``` I had to use `\makeatletter` ... `\makeatother` because of the `@` in macro names. The optional argument is the standard `amsmath` argument to `\array`. The original definition in `amsmath` is: ``` \def\env@matrix{\hskip -\arraycolsep \let\@ifnextchar\new@ifnextchar \array{*\c@MaxMatrixCols c}} ``` So, there's not much that's been changed. **Examples:** Simple augmented matrix: ``` \begin{pmatrix}[cc|c] 1 & 2 & 3\\ 4 & 5 & 9 \end{pmatrix} ``` More complex use, with different alignment, spacing and color: ``` \begin{bmatrix}[*2cr@{\quad}|@{\quad}>{\color{red}}r] a & b & 1 & 4 \\ c & d & -2 & -3 \end{bmatrix} ``` **Output:** Just remove the optional argument in brackets and you will get the standard `pmatrix` or `bmatrix`. I've used this code and examples in a blog post in 2008: [An extension to `amsmath` matrix environments](http://texblog.net/latex-archive/maths/amsmath-matrix/). If you don't wish to redefine that internal macro, you could give it a different name and build your `amatrix` environment on it exactly the same way that `amsmath` does with `pmatrix`.
60
https://tex.stackexchange.com/users/213
2244
1,566
https://tex.stackexchange.com/questions/2241
29
My document uses the `txfonts` package, which provides Times Roman, Helvetica and what appears to be a facsimile of Courier. However, I dislike the monospace font and find it to be particularly ugly. I am therefore interested in alternatives that ship as part of texlive. Bera mono is nice however I am more in the market for a serif monospace font as opposed to sans serif. Any ideas/suggestions?
https://tex.stackexchange.com/users/753
Alternative monospace fonts
false
I personally prefer either Inconsolata or CM typewriter (usually using LM's).
4
https://tex.stackexchange.com/users/729
2246
1,567
https://tex.stackexchange.com/questions/2241
29
My document uses the `txfonts` package, which provides Times Roman, Helvetica and what appears to be a facsimile of Courier. However, I dislike the monospace font and find it to be particularly ugly. I am therefore interested in alternatives that ship as part of texlive. Bera mono is nice however I am more in the market for a serif monospace font as opposed to sans serif. Any ideas/suggestions?
https://tex.stackexchange.com/users/753
Alternative monospace fonts
false
I like [Inconsolata](http://ctan.org/pkg/inconsolata) like Khaled does. It's monospaced and it supports several encodings including T1, OT1 and LY1. Just load inconsolata.sty, you could additionally specify a scaling option `[scaled=factor]`. Here's an example how the font looks like, taken from [my blog](http://texblog.net/latex-archive/fonts/inconsolata/): Links: * [Inconsolata Homepage](http://levien.com/type/myfonts/inconsolata.html) * [Inconsolata on CTAN](http://ctan.org/pkg/inconsolata) * [documentation by Karl Berry](http://tug.ctan.org/tex-archive/fonts/inconsolata/inconsolata.pdf) including font tables * [adding straight single and double quotes to Inconsolata](http://nodnod.net/2009/feb/12/adding-straight-single-and-double-quotes-inconsola/)
29
https://tex.stackexchange.com/users/213
2247
1,568
https://tex.stackexchange.com/questions/2231
10
Is there a way to make text size and alignment automatically "best fit" on a page? So that a large amount of text will be constrained on the page in a small font, but a small amount of text can be of larger font and centered properly? The best way I found to fit lots of text on a page is with: ``` \begin{minipage}{width} ... \end{minipage} \newpage ``` ...but when there is a smaller amount of text, the font remains small and is awkwardly aligned at the top of the page, whereas I'd like it to be centered vertically and horizontally. I tried `\vfill` with `minipage`, but it makes no difference. For smaller amounts of text, I succeeded with: ``` \mbox{} \vfill \begin{center} .... \end{center} \vfill \newpage ``` This centered the text perfectly, but I couldn't constrain a large block to one page with this. I tried combining `minipage` and `\mbox`, but `minipage` overrode the `\vfill` spacing and the alignment was screwed up again for small amounts of text.
https://tex.stackexchange.com/users/953
Fitting and centering text (both!) in a constrained area
false
I'm not quite sure what you are actually trying to do. But "but minipage overrode the vfill spacing" sounds as if you have put the \vfill inside the minipage. This makes only sense if you give the minipage a specific height (which is possible with an optional argument). If you want to move the minipage itself the \vfill must go outside. You can use varwidth to get a minipage which adjust its width to its content. You can use \resizebox to scale a minipage to a given width. Btw: Center things horizontally is in general a well-defined conzept: Chars, boxes and words have only one width and the reference point one wants to use is clear. This is different when you want to center things vertically. Chars and boxes have height and depth. Do you want to center a "A" along the baseline or along a line somewhere in the middle of the char? You can see the problem if you remove the [b] in the last example. ``` \documentclass{article} \usepackage{varwidth,lipsum,graphics} \begin{document} \vspace*{\fill} {\centering \begin{minipage}{0.5\textwidth} \lipsum[1] \end{minipage} \par} \vfill \newpage \vspace*{\fill} {\centering \begin{varwidth}{0.5\textwidth} abc \end{varwidth} \par} \vfill \newpage \vspace*{\fill} {\centering \begin{minipage}{0.5\textwidth} \centering abc\\cdeaddff \end{minipage} \par} \vfill \newpage \vspace*{\fill} {\centering \resizebox{\textwidth}{!}{% .\begin{varwidth}[b]{0.5\textwidth} abc \end{varwidth}} \par} \vfill \end{document} ```
1
https://tex.stackexchange.com/users/2388
2249
1,569
https://tex.stackexchange.com/questions/2245
23
How do I make an item in a description list verbatim? `\verb` in `\item[]` seems to be not allowed: ``` \begin{description} \item[\verb+list comprehension [f a | a <- M a]+] bla bla bla \end{description} ```
https://tex.stackexchange.com/users/956
Verbatim description list item
false
The `\verb` command is not allowed inside arguments of other commands. One workaround is to use `\SaveVerb` from [`fancyvrb`](http://ctan.org/pkg/fancyvrb). The following definition of `\vitem` is taken from the *Companion*. It has an optional argument taking styling parameters from the `fancyvrb` package. ``` \usepackage{fancyvrb} \newcommand\vitem[1][]{\SaveVerb[% aftersave={\item[\textnormal{\UseVerb[#1]{vsave}}]}]{vsave}} \begin{description} \vitem+list comprehension [f a | a <- M a]+ bla bla bla \end{description} ```
8
https://tex.stackexchange.com/users/83
2250
1,570
https://tex.stackexchange.com/questions/2248
71
I know there are a few packages related to typesetting units: * `unitsdef` * `units`, which can be seen as a "base package" used by `unitsdef` * `SIunits` * `siunitx`, which is the successor to `SIunits` * maybe others? like `cjwunits` and `hepunits` **What is the difference between them? Do they also work inside Math mode? And, more importantly, which one should I use?** Suggestion for people trying to answer this question: show some examples of how to typeset both simple and complex units. For instance, try typesetting these items: * 100 Celsius * 3 x 10^5 km/s * gravitational constant is measured in N m^2/kg^2 * 10 kHz = 1 s^{-4} * sin(x) meters I think these examples cover most needs when writing scientific texts: simple measurements (value + simple unit), values written in scientific notation, simple fractional units, complex fractional and squared units, units without any value accompanying them, units with arbitrary exponents, and arbitrary math code instead of a simple value.
https://tex.stackexchange.com/users/375
What package should I use to typeset units?
false
The *siunitx* package discusses each of the others you've listed, noting that it can emulate all of them. I haven't used it extensively, but in the experience I do have, it seems to work very well, and be very comprehensive. A quick scan through that manual should let you find examples matching each of the ones you've listed. Thus I think that the short answer is: use siunitx.
8
https://tex.stackexchange.com/users/96
2251
1,571
https://tex.stackexchange.com/questions/2245
23
How do I make an item in a description list verbatim? `\verb` in `\item[]` seems to be not allowed: ``` \begin{description} \item[\verb+list comprehension [f a | a <- M a]+] bla bla bla \end{description} ```
https://tex.stackexchange.com/users/956
Verbatim description list item
true
The package [`examplep`](http://ctan.org/pkg/examplep) provides several commands and environments for typesetting verbatim text. For instance, the robust commands `\PVerb[options]{text}`and `\Q{text}` can be used in macro arguments and in section titles as well. Code example for your description list: ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage[Q=yes]{examplep} \begin{document} \begin{description} \item[\Q{list comprehension [f a | a <- M a]}] bla bla bla \item[\PVerb{testing: \verb||{} #_$ }] item text \end{description} \end{document} ``` Output: See [Verbatim phrases and listings in LaTeX](http://mirror.ctan.org/macros/latex/contrib/examplep/eurotex_2005_examplep.pdf) by Péter Szabó (or `texdoc examplep`) for further information. Escaping special characters (for instance with `\Q`) may be necessary as described in section 3.1 of the documentation. Note, T1 font encoding has to be use to get a proper < symbol because it's unavailable in standard OT1 encoding.
18
https://tex.stackexchange.com/users/213
2252
1,572
https://tex.stackexchange.com/questions/2228
10
I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color). All custom styling seem to be content-based. I would like to be able to do something like: ``` \lstinputlisting[emphlines={4},emphstyle=\color{red}]{sourcecode.f} ``` If it is not possible with the plain listings package, what do you suggest to get this effect? My goal is to highlight different lines in different slides of a beamer presentation, so if there is a simple way to do this, I will be very thankful. --- **Edit**: I came up with [this solution](http://gist.github.com/548097) after Ulrike's idea. I'm satisfied with the result, and the redundancy is bearable for my taste. It'd be very nice if someone more knowledgeable in TeX scripting suggests some improvements.
https://tex.stackexchange.com/users/341
Apply style to specific lines of a listings environment
true
The only way I know is to reinput the file with different firstline/lastline settings. Not difficult but a bit tedious: ``` \documentclass{article} \usepackage{listings,color} \begin{document} \lstinputlisting[lastline=4,belowskip=0pt]{test-utf8.log} \lstinputlisting[firstline=5,lastline=5, aboveskip=0pt,belowskip=0pt,backgroundcolor=\color{yellow}]{test-utf8.log} \lstinputlisting[firstline=6,aboveskip=0pt]{test-utf8.log} \end{document} ```
7
https://tex.stackexchange.com/users/2388
2253
1,573
https://tex.stackexchange.com/questions/2248
71
I know there are a few packages related to typesetting units: * `unitsdef` * `units`, which can be seen as a "base package" used by `unitsdef` * `SIunits` * `siunitx`, which is the successor to `SIunits` * maybe others? like `cjwunits` and `hepunits` **What is the difference between them? Do they also work inside Math mode? And, more importantly, which one should I use?** Suggestion for people trying to answer this question: show some examples of how to typeset both simple and complex units. For instance, try typesetting these items: * 100 Celsius * 3 x 10^5 km/s * gravitational constant is measured in N m^2/kg^2 * 10 kHz = 1 s^{-4} * sin(x) meters I think these examples cover most needs when writing scientific texts: simple measurements (value + simple unit), values written in scientific notation, simple fractional units, complex fractional and squared units, units without any value accompanying them, units with arbitrary exponents, and arbitrary math code instead of a simple value.
https://tex.stackexchange.com/users/375
What package should I use to typeset units?
true
As the author of [`siunitx`](http://ctan.org/pkg/siunitx) I have some idea about the relative strengths of the various alternatives. There are various things that need to be done for units: * Semantic input of units, so `\kilo\metre` rather than `km`: this allows special effects such as reformatting fractions 'on the go' (some people prefer to use literal input, and this ideally needs to be supported too). * Formatting of numbers, for example dividing up digits into groups. * Correctly presenting awkward symbols such as the micro symbol. * Setting the font: many guidelines call for units to be in upright roman font with no bold or italic variation. * Keeping numbers and units together (no space breaking) Many packages have been written to address one or other aspect of this question. For example, [`SIunits`](http://ctan.org/pkg/SIunits) is good at providing semantic input, whereas [`SIstyle`](http://ctan.org/pkg/SIstyle) focusses on correct typesetting but leaves the input to the user. On the other hand, `unitsdef` sticks to doing only units and does not worry about other aspects. The aim of the `siunitx` package is to cover all of the requirements above, and to provide a way that package behaviour can be altered. Thus it uses a series of key-value options that will change how the output is formatted. The options can be applied to the entire document or to an individual piece of input. It also is designed to work in either math or text mode equally well. I have also been very careful to provide up to date advice about the internationally-agreed units in the documentation of `siunitx`. As a demo, using the latest release of `siunitx` the following all show off the package: ``` \documentclass{article} \usepackage{siunitx} \begin{document} \begin{itemize} \item \qty{100}{\degreeCelsius} \item \qty{3e5}{\km\per\s} or \qty[per-mode = symbol]{3e5}{\km\per\s} \item \unit{\newton\metre\squared\per\kilogram\squared} or \unit[per-mode = symbol]{\newton\metre\squared\per\kilogram\squared} \item \( \qty{10}{\kilo\hertz} = \qty{1}{\per\second\tothe{4}} \) \item \qty[parse-numbers = false]{\sin(x)}{\metre} \end{itemize} \end{document} ``` There are a couple of notes to bear in mind if using `siunitx`. First, it requires e-TeX, which can be an issue with some publishers (even over 10 years after it was finalised!). Secondly, the formatting does take up some time. There are settings to turn things off but it's always the case that working by hand will ultimately be faster. However, the upside of clearer and more flexible input is in my opinion worth it. One other point is that `siunitx` is under development, with bug fixes and new features (there is a list for v3.1). In contrast, both `SIunits` and `SIstyle` are depreciated: bug fixes only. The `units` and `unitsdef` packages have not been updated for many years.
97
https://tex.stackexchange.com/users/73
2254
1,574
https://tex.stackexchange.com/questions/2241
29
My document uses the `txfonts` package, which provides Times Roman, Helvetica and what appears to be a facsimile of Courier. However, I dislike the monospace font and find it to be particularly ugly. I am therefore interested in alternatives that ship as part of texlive. Bera mono is nice however I am more in the market for a serif monospace font as opposed to sans serif. Any ideas/suggestions?
https://tex.stackexchange.com/users/753
Alternative monospace fonts
false
I think most of the easily available monospaced *serif* (as you asked) typefaces have already been mentioned. One worthy typeface that hasn't yet is [Gyre Cursor](http://www.gust.org.pl/projects/e-foundry/tex-gyre/cursor "Gyre Cursor"). Although it doesn't ship with TeX Live, it's very easy to obtain and install. I find lots of use for it in small blocks of running text, especially `\url`'s. It's a nicely reworked `courier` drop-in (however, on that front, I'm guessing you might find it "particularly ugly" :)). I know you asked for typefaces from the TeX Live distro, but as I have a minor love affair going right now with Adobe's `ITC American Typewriter`, I can't resist mentioning this very attractive font set (see sample below), if only to provide a look at a `tt` typeface that is not, to my eyes, "particularly ugly." Only for running text, however; I certainly wouldn't use it for listings.
5
https://tex.stackexchange.com/users/416
2255
1,575
https://tex.stackexchange.com/questions/2228
10
I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color). All custom styling seem to be content-based. I would like to be able to do something like: ``` \lstinputlisting[emphlines={4},emphstyle=\color{red}]{sourcecode.f} ``` If it is not possible with the plain listings package, what do you suggest to get this effect? My goal is to highlight different lines in different slides of a beamer presentation, so if there is a simple way to do this, I will be very thankful. --- **Edit**: I came up with [this solution](http://gist.github.com/548097) after Ulrike's idea. I'm satisfied with the result, and the redundancy is bearable for my taste. It'd be very nice if someone more knowledgeable in TeX scripting suggests some improvements.
https://tex.stackexchange.com/users/341
Apply style to specific lines of a listings environment
false
The simplest way is to use the `semiverbatim` environment from `beamer`, see Section 3.13 (Verbatim Text) of the manual. The disadvantage of this method is that you don’t get highlighting. In order to have all the functionality of the `listings` package, you could use its `fancyvrb` interface with `commandchars`: ``` \documentclass{beamer} \usepackage{fancyvrb,listings} \begin{document} \begin{frame}[fragile] \lstset{language=pascal,fancyvrb=true,basicstyle=\normalfont} \fvset{commandchars=\|[]} \begin{Verbatim} |alert[for i:=maxint to 0 do] begin { do nothing } end; \end{Verbatim} \end{frame} \end{document} ``` The symbols in `commandchars` are replacement characters for `\`, `{` and `}`, properly escaped with backslashes. I don’t know however how to get overlay specifications (like `<1>`) to work.
4
https://tex.stackexchange.com/users/83
2256
1,576
https://tex.stackexchange.com/questions/2258
6
How can I get this to work: ``` \begin{description} \item[\texttt{foo :: a \rightarrow b}] bla \end{description} ``` without having to write: ``` \begin{description} \item\ttfamily[foo~::~a~$\rightarrow$~b]\normalfont~bla \end{description} ``` ? * \ttfamily: for typewriter formating * ~: to get the spacing right(??) * $: to activate math mode * \normalfont: to get back to normal * last ~: insert simple space(??) or how would you list some function definitions and append a description for the functions?
https://tex.stackexchange.com/users/956
item formatting in description list
true
How about ``` \begin{description} \item[\texttt{foo :: a $\rightarrow$ b}] bla \end{description} ``` That is: add a closing brace and `$`s around `\rightarrow`. Or maybe you want ``` \begin{description} \item[\texttt{[foo ::~a $\rightarrow$ b]}] bla \end{description} ```
3
https://tex.stackexchange.com/users/83
2259
1,577
https://tex.stackexchange.com/questions/2258
6
How can I get this to work: ``` \begin{description} \item[\texttt{foo :: a \rightarrow b}] bla \end{description} ``` without having to write: ``` \begin{description} \item\ttfamily[foo~::~a~$\rightarrow$~b]\normalfont~bla \end{description} ``` ? * \ttfamily: for typewriter formating * ~: to get the spacing right(??) * $: to activate math mode * \normalfont: to get back to normal * last ~: insert simple space(??) or how would you list some function definitions and append a description for the functions?
https://tex.stackexchange.com/users/956
item formatting in description list
false
i notice you're missing a closing brace before the closing bracket, other than that the two seem to produce identical output for me, save the enclosing brackets in your second example.
2
https://tex.stackexchange.com/users/960
2260
1,578
https://tex.stackexchange.com/questions/2258
6
How can I get this to work: ``` \begin{description} \item[\texttt{foo :: a \rightarrow b}] bla \end{description} ``` without having to write: ``` \begin{description} \item\ttfamily[foo~::~a~$\rightarrow$~b]\normalfont~bla \end{description} ``` ? * \ttfamily: for typewriter formating * ~: to get the spacing right(??) * $: to activate math mode * \normalfont: to get back to normal * last ~: insert simple space(??) or how would you list some function definitions and append a description for the functions?
https://tex.stackexchange.com/users/956
item formatting in description list
false
In this case I would `\usepackage{enumitem}` And then write: ``` \begin{description}[font=\tt] \item[foo :: a $\rightarrow$ b] bla \end{description} ``` This way you don't need to define the font for each of your items.
12
https://tex.stackexchange.com/users/467
2261
1,579
https://tex.stackexchange.com/questions/2248
71
I know there are a few packages related to typesetting units: * `unitsdef` * `units`, which can be seen as a "base package" used by `unitsdef` * `SIunits` * `siunitx`, which is the successor to `SIunits` * maybe others? like `cjwunits` and `hepunits` **What is the difference between them? Do they also work inside Math mode? And, more importantly, which one should I use?** Suggestion for people trying to answer this question: show some examples of how to typeset both simple and complex units. For instance, try typesetting these items: * 100 Celsius * 3 x 10^5 km/s * gravitational constant is measured in N m^2/kg^2 * 10 kHz = 1 s^{-4} * sin(x) meters I think these examples cover most needs when writing scientific texts: simple measurements (value + simple unit), values written in scientific notation, simple fractional units, complex fractional and squared units, units without any value accompanying them, units with arbitrary exponents, and arbitrary math code instead of a simple value.
https://tex.stackexchange.com/users/375
What package should I use to typeset units?
false
I'd also recommend `siunitx`. As you know its author is very active in the TeX community and provides excellent support.
5
https://tex.stackexchange.com/users/337
2263
1,581
https://tex.stackexchange.com/questions/2264
6
What is the best package/style to build a presentation? I use PDFSLID. Any better?
https://tex.stackexchange.com/users/nan
Presentations best style
false
I use `beamer`. It has a good documentation, which can be found in [the CTAN archive](http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf).
1
https://tex.stackexchange.com/users/401
2265
1,582
https://tex.stackexchange.com/questions/2264
6
What is the best package/style to build a presentation? I use PDFSLID. Any better?
https://tex.stackexchange.com/users/nan
Presentations best style
false
My favorite (so far, I haven't tried them all) is beamer. [Beamer page on CTAN](http://ctan.org/pkg/beamer) [Beamer homepage on github](https://github.com/josephwright/beamer) There are lots of beautiful templates you can choose from and it's very customizable. It also seems to be widely used so you can find help online.
21
https://tex.stackexchange.com/users/411
2266
1,583
https://tex.stackexchange.com/questions/2264
6
What is the best package/style to build a presentation? I use PDFSLID. Any better?
https://tex.stackexchange.com/users/nan
Presentations best style
false
Though [beamer](http://ctan.org/pkg/beamer) is my favorite, I would like to mention the `powerdot` class. * [Package on CTAN](http://ctan.org/pkg/powerdot) * [powerdot manual](http://tug.ctan.org/tex-archive/macros/latex/contrib/powerdot/doc/powerdot.pdf) It is the successor of [`prosper`](http://ctan.org/pkg/prosper) and [`HA-prosper`](http://ctan.org/pkg/ha-prosper) class resp. package. It offers a LyX layout file. powerdot requires PSTricks. As I already mentioned [here](https://tex.stackexchange.com/questions/782/what-are-the-available-documentclass-types-and-their-uses), it offers many styles and allows creating your own style, further it provides automatic overlays and a handout mode. Some demonstration files for a quick impression: * [Compiled examples](http://stuwww.uvt.nl/~hendri/) from the documentation * A [thesis defence](http://www.math.wisc.edu/~ynagel/tex/defense.pdf) ([source](http://www.math.wisc.edu/~ynagel/tex/defense.zip)) * [A research talk](http://www.math.wisc.edu/~ynagel/tex/GPStalk.pdf) * [Presentation](http://www.siart.de/typografie/powerdot_20060207.pdf) and powerdot demo by Uwe Siart * The nice [Jena style](http://www.personal.uni-jena.de/~xcr/v2/Dateien/File/neu-powerdot-jena/demo-powerdotJena.pdf) (btw. I've studied there :-) Finally, here's a very nice overview by Michael Wiedmann: [**Screen Presentation Tools**](http://www.miwie.org/presentations/presentations.html). It compares packages like beamer, prosper, slides, powerdot and many more.
8
https://tex.stackexchange.com/users/213
2268
1,584
https://tex.stackexchange.com/questions/2267
5
Is there some easy trick to make `\node[place,tokens=3]{}` place 3 tokens in a row (and not in a triangle)?
https://tex.stackexchange.com/users/85
Placement of tokens in tikz/petri
true
In the file [tikzlibrarypetri.code.tex](http://mirror.ctan.org/graphics/pgf/base/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypetri.code.tex) you would find the needed macros. There are commands `\tikz@def@grow@tokens{number of tokens}{number of the token}{x shift}{y shift}` as in Grigorys comment) that can be analyzed and modified. Here's the modification for `number of tokens`= 3 and `number of the token`= 1, 2, 3 - just place this code in your preamble: ``` \makeatletter \tikz@def@grow@tokens{3}{1}{-1}{0} \tikz@def@grow@tokens{3}{2}{0}{0} \tikz@def@grow@tokens{3}{3}{1}{0} \makeatother ``` Sample output of the modified manual Petri-net example: Note the three tokens in a row in the middle of the image.
6
https://tex.stackexchange.com/users/213
2269
1,585
https://tex.stackexchange.com/questions/2264
6
What is the best package/style to build a presentation? I use PDFSLID. Any better?
https://tex.stackexchange.com/users/nan
Presentations best style
false
Responding to a request for an answer with ConTeXt links: probably the most useful would be [this page on ConTeXtGarden](http://wiki.contextgarden.net/Presentations). You can also look at some [examples of ConTeXt presentations](http://www.pragma-ade.com/show-exa-1.htm) at the pragma web site.
6
https://tex.stackexchange.com/users/396
2270
1,586
https://tex.stackexchange.com/questions/2271
29
How do I reduce the vertical spacing of `\intertext`?
https://tex.stackexchange.com/users/512
Intertext vertical spacing
false
one option, if you only want to change the spacing between lines in a certain part of your document (like one block of equations) is to use the setspace package, and use the spacing environment like this: ``` \begin{spacing}{.1} \begin{align} a = 4 \intertext{this is a long line of text between your equations} b = 3 \end{align} \end{spacing} ``` the second argument for the spacing environment is the spacing factor. for smaller than normal, use values < 1.
5
https://tex.stackexchange.com/users/960
2273
1,587
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
An easy way to specify for LaTeX to place something is by adding an optional argument for position: ``` \begin{figure}[h] ``` where the `[h]` means *here*, or ``` \begin{figure}[h!] ``` where the `[h!]` is for forced here. Do these work?
7
https://tex.stackexchange.com/users/960
2276
1,588
https://tex.stackexchange.com/questions/2271
29
How do I reduce the vertical spacing of `\intertext`?
https://tex.stackexchange.com/users/512
Intertext vertical spacing
false
Below the upper part of the formula comes a vertical space with the height `\belowdisplayskip`. Afterwards comes the text by `\intertext`. Before the rest of the formula, a vertical space with a height of `\abovedisplayskip` will be inserted. These are usual spaces before and after displayed math environments and surrounding text. So, it's the same for inserted texts. `\abovedisplayshortskip` and `\belowdisplayshortskip` are further such skips; these short skips would be used if the line before the display ends before the formula begins, for the visual appearance. You could change those lengths. If you need it just at a certain place, you could modify the lengths there and limit this effect by grouping with braces or `\begingroup`, `\endgroup`: ``` {% \setlength{\belowdisplayskip}{0pt}% \setlength{\abovedisplayskip}{0pt}% \begin{align} ... \intertext{some text} ... \end{align}% } ``` Instead of 0 pt you could insert any other value. If you need it several times, you could consider to create a macro or to modify the behavior of `\intertext`.
13
https://tex.stackexchange.com/users/213
2277
1,589
https://tex.stackexchange.com/questions/2271
29
How do I reduce the vertical spacing of `\intertext`?
https://tex.stackexchange.com/users/512
Intertext vertical spacing
true
The [mathtools](https://www.ctan.org/pkg/mathtools) package provides the command `\shortintertext`, which has less vertical space than the standard `\intertext`.
31
https://tex.stackexchange.com/users/586
2278
1,590
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
As @asia1281 mentioned, the `[h]` directive helps. I did not know of `[h!]` before (thanks!), but reading around seems to suggest that it isn't quite forced as there may still be circumstances where LaTeX refuses to put the float right there. Another thing that may help is one of `\clearpage` and `\cleardoublepage`. These force all unprocessed floats to be typeset and then a new page or two (with `\cleardoublepage` and some classes). If you wait until your document is written and you are worrying only about apperance, you can put one of these commands at the end of the text on the very bottom of a page to force the outstanding floats to appear right thereafter. This is really best saved for final stages and needs to be redone (or at least checked) whenever the text is edited.
10
https://tex.stackexchange.com/users/93
2279
1,591
https://tex.stackexchange.com/questions/2274
30
In a paper I'm writing, I end a proof with a displayed equation that has some cases in it. The relevant code looks something like the following: ``` \[f(x) = \begin{cases} 2x & \text{if $x<0$}\\ 7 & \text{if $x=0$}\\ 1-x & \text{if $x>0$} \end{cases} \] \end{proof} ``` What I want to happen is for the amsthm "tombstone" to be placed on the right-hand side of the page aligned with the "1-x" line. I think this should be possible by placing a `\qedhere` in an appropriate place, but I can't seem to figure out where (I've tried all the obvious choices, and they all give me incorrect behavior).
https://tex.stackexchange.com/users/17494
Problem with qedhere
true
This can be achieved using the [`ntheorem`](http://ctan.org/pkg/ntheorem) package. This package handles endmarks properly. Note, you should specify the `amsmath` and `amsthm` options if you use amsmath and the `proof`environment, further `thmmarks` to get endmarks. Here's a complete example, placing the qed symbol at the same height like `1-x`, like desired by you: ``` \documentclass{article} \usepackage{amsmath} \usepackage[amsmath,amsthm,thmmarks]{ntheorem} \begin{document} \begin{proof} \[ f(x) = \begin{cases} 2x & \text{if $x<0$}\\ 7 & \text{if $x=0$}\\ 1-x & \text{if $x>0$} \end{cases} \] \end{proof} \end{document} ``` Output: You could use further features of `ntheorem` to customize the proof layout and to choose a qed symbol. The [ntheorem documentation](http://tug.ctan.org/tex-archive/macros/latex/contrib/ntheorem/ntheorem.pdf) may tell you more.
32
https://tex.stackexchange.com/users/213
2280
1,592
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
Check out the [`float`](http://www.ctan.org/tex-archive/help/Catalogue/entries/float.html "float") package. It adds ability to include `[H]` forced here float placement. You can also select this as automatic default with `\floatplacement{figure}{H}`. ``` \documentclass{article} % Example taken from https://tex.stackexchange.com/questions/297564 \usepackage{float} % here for H placement parameter \begin{document} Text before the table. \begin{table}[H] % placement parameter H \centering % if you want to center the table \caption{Table showing \ldots} \label{table:ExampleTable} % Code for table \end{table} Text after the table. \end{document} ```
37
https://tex.stackexchange.com/users/416
2281
1,593
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
**Easing the float placement by options:** You could use more positioning options. Not just `[h]`. If you wish to place the figure near, allow more positioning options, for instance by `[htbp]` (here, top, bottom, page). Use a `!` symbol to remove further restrictions. So, in many cases this is sufficient: ``` \begin{figure}[!htbp] ``` **Useful package regarding float placement:** * [`float`](http://ctan.org/pkg/float) introduces a placement option `H` enforcing the placement exactly at that point. * [`placeins`](http://ctan.org/pkg/placeins) provides the command `\FloatBarrier` to limit the floating of figures or tables. You could place such a barrier before and after a listing. * [`afterpage`](http://ctan.org/pkg/afterpage) allows a more clever `\clearpage`, putting the effect off until the page is full: `\afterpage{\clearpage}` **Completely avoiding a floating environment:** Package [`caption`](http://ctan.org/pkg/caption) allows to add a caption outside a floating environment, meaning at any place you want. Use `\captionof{figure}{the caption}` (for figures) Example: ``` text \begin{minipage}{\linewidth} \begin{center} \includegraphics[width=.6\linewidth]{example-image} \captionof{figure}{An example image not including a Wombat} \end{center} \end{minipage} even more text ``` The `minipage` keeps graphic and caption together, the `center` environment add a bit of white space around the figure. **Further reading:** Because it's an important and not easy subject, there's a lot of material to be found, for instance in FAQ collections. There's an extensive document dealing with graphics inclusion, manipulation and placement: * [Using Imported Graphics in LaTeX and pdfLaTeX](http://tug.ctan.org/tex-archive/info/epslatex/english/epslatex.pdf) by Keith Reckdahl. The interesting part for your question may be *Part IV: The Figure Environment* beginning on page 55. There is also Frank Mittelbach's excellent answer describing the floating mechanism and related options in great detail: * [How to influence the position of float environments like figure and table in LaTeX?](https://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat/39020#39020)
388
https://tex.stackexchange.com/users/213
2282
1,594
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
Controlling floats isn't difficult once you understand what LaTeX is trying to do with them. Requisite FAQ link: <https://texfaq.org/FAQ-floats> Three things, broadly speaking, will prevent floats from staying close to their definition: * underspecified position parameters. I recommend always using [htbp] until the document is complete. * graphics too large. Do you really need a graph 2/3 the page size? * too many graphics near each other. Once graphics start building up, it just isn't possible to keep the last one near its source location. Above all, forget about formatting your floats until the document is absolutely finished. You'll produce better results and write the document faster that way.
112
https://tex.stackexchange.com/users/179
2283
1,595
https://tex.stackexchange.com/questions/2272
48
I found this code somewhere on the TeX archives and have been puzzling over it for some time. Can anyone describe how it works? ``` % Date: Thu, 7 Feb 91 12:20:50 -0500 %From: [email protected] %Subject: A response to perl hackers \let~\catcode~`?`\ \let?\the~`#?~`~~`]?~`~\let]\let~`\.?~`~~`,?~`~~`\%?~`~~`=?~`~]=\def ],\expandafter~`[?~`~][{=%{\message[}~`\$?~`~=${\uccode`'.\uppercase {,=,%,{%'}}}~`*?~`~=*{\advance.by}]#\number~`/?~`~=/{*-1}\newcount. =\-{*-}~`-?~`~]-\-~`^?~`~=^{*1}~`\ ?~`~= {.`\ $}~`@?~`~=@{,.,"#`@^$} .`#*`'$.?~`~0-?~`~$//$^$ .``^$*?~`~$^$.?~`~0-?~`~/$-?~`~^$@*?~`~$ * ?~`~*?~`~*?~`~*?~`~$@-?~`~$ .?~`~0-?~`~-?~`~$.``^$^^$.`<-?~`~*`<$@* ?~`~$*?~`~-`(-`+$%}\batchmode ``` It lists all your input files!
https://tex.stackexchange.com/users/963
Can you explain how this code works?
false
Maybe this is cheating, but try running the code with `\tracingall` before the first line. You can watch TeX work.
13
https://tex.stackexchange.com/users/647
2284
1,596
https://tex.stackexchange.com/questions/2275
387
Is there any package or a method to force LaTeX to keep floating environments like `table` and `figure` closer to where they are declared?
https://tex.stackexchange.com/users/833
Keeping tables/figures close to where they are mentioned
false
Fairly often all that you need is to declare tables and figures earlier, *before* the first point of reference (for example, one or two paragraphs before the point of reference, or before the previous subsection heading). Unfortunately, it tends to be a little bit of trial and error. Some kinds of floats need to be declared earlier than others; for example, floats with placement `[b]` are sometimes trickier than floats with `[t]`.
16
https://tex.stackexchange.com/users/100
2285
1,597
https://tex.stackexchange.com/questions/2286
6
I'm using the following settings for fancyhdr in a two-page book-derived documentclass: ``` \pagestyle{fancy} \fancyhf{} \fancyhead[LO]{\sffamily \footnotesize \rightmark} \fancyhead[RE]{\sffamily \footnotesize \leftmark} \fancyfoot[LO]{\footnotesize \thepage~{\color{red}\vline}} \fancyfoot[RE]{\footnotesize {\color{red}\vline}~\thepage} \fancyfootoffset{0.5cm} \fancypagestyle{plain} { \fancyhf{} % get rid of headers on plain pages \renewcommand{\headrulewidth}{0pt} % and the line \renewcommand{\footrulewidth}{0pt} % and the line } \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} ``` But, somehow, the page number on even pages gets slightly below those on odd.
https://tex.stackexchange.com/users/877
FancyHeader (Mis-)placement
true
I'm not quite sure the reason for your problem, but it goes away if I change to `\textcolor{red}{\vline}` instead of `{\color{red}\vline}`.
3
https://tex.stackexchange.com/users/627
2289
1,598
https://tex.stackexchange.com/questions/2287
4
I am attempting to place the document's title on the left side of a header and the chapter's name on the right side of the header. However, I am unable to find how to use the title variable specified in by `\title{my title}` in the header. Additionally, whenever I use `\chaptermark` the right section of the header appears blank on all pages. How do I insert a document's title and the chapter's name into a header? My tex file contents are pasted below: ``` \documentclass{report} \usepackage{lastpage} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \begin{document} \rhead{\bfseries \chaptermark} \lfoot{\thepage\ of \pageref{LastPage}} \rfoot{My Company} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} % redefine headers and footers for chapters \fancypagestyle{plain}{% \fancyhf{} \rhead{\bfseries \chaptermark} \lfoot{\thepage\ of \pageref{LastPage}} \rfoot{My Company} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt} } \title{My Document Title} \author{Ryan Taylor} \date{\today} \maketitle \tableofcontents \chapter{Version Control} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sapien metus, tempus sit amet feugiat id, feugiat in diam. Integer ut nunc eget orci hendrerit ullamcorper nec at enim. \chapter{Introduction} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sapien metus, tempus sit amet feugiat id, feugiat in diam. Integer ut nunc eget orci hendrerit ullamcorper nec at enim. ```
https://tex.stackexchange.com/users/952
How do I insert a document's title and the chapter's name into a header?
true
For the title: ``` \let\oldtitle\title \renewcommand{\title}[1]{\oldtitle{#1}\def\titletext{#1}} \lhead{\titletext} ``` For the chapter name, use `\leftmark` not `\chaptermark` (which is the command which is used by `\chapter` in order to set up the marks).
4
https://tex.stackexchange.com/users/627
2290
1,599
https://tex.stackexchange.com/questions/2291
414
I've seen documentation whereby an `\alph` command is put around the `\begin{enumerate}` somewhere, but I'm not entirely sure how that operates...
https://tex.stackexchange.com/users/192
How do I change the `enumerate` list format to use letters instead of the default Arabic numerals?
true
Without any package you could do it by redefining the command `\theenumi` for formatting the `enumi` counter. (Also `enumii`, etc., for nested lists.) ``` \renewcommand{\theenumi}{\Alph{enumi}} ``` inside the environment.... Or better, you could use a package like [`enumitem`](http://ctan.org/pkg/enumitem) which allows, e.g., ``` \usepackage{enumitem} ... \begin{enumerate}[label=\Alph*] \item this is item a \item another item \end{enumerate} ``` Use `\alph` for lowercase letters, `\Alph` for uppercase, etc. See the package documentation for more info.
368
https://tex.stackexchange.com/users/411
2292
1,600
https://tex.stackexchange.com/questions/2288
4
Does anybody know how to align an header/footer on the outside of the text margins? For example: ``` \fancyfoot[LO]{\footnotesize \thepage~{\color{red}\vline}} \fancyfoot[RE]{\footnotesize {\color{red}\vline}~\thepage} ``` What I want is to fix the position of `\vline` on the text-width, and make `\thepage` left (or right) align on the outside.
https://tex.stackexchange.com/users/877
Aligning a footer on the outside text margins
true
``` \fancyfoot[LO]{\footnotesize\leavevmode\llap{\thepage~}\textcolor{red}{\vline}} \fancyfoot[RE]{\footnotesize\textcolor{red}{\vline}\rlap{~\thepage}} ```
5
https://tex.stackexchange.com/users/627
2293
1,601
https://tex.stackexchange.com/questions/2291
414
I've seen documentation whereby an `\alph` command is put around the `\begin{enumerate}` somewhere, but I'm not entirely sure how that operates...
https://tex.stackexchange.com/users/192
How do I change the `enumerate` list format to use letters instead of the default Arabic numerals?
false
Use the package [`enumitem`](http://ctan.org/pkg/enumitem). ``` \usepackage[shortlabels]{enumitem} . . . \begin{enumerate}[(a)] % (a), (b), (c), ... \item \end{enumerate} . . . \begin{enumerate}[a)] % a), b), c), ... \item \end{enumerate} ```
319
https://tex.stackexchange.com/users/nan
2294
1,602
https://tex.stackexchange.com/questions/2272
48
I found this code somewhere on the TeX archives and have been puzzling over it for some time. Can anyone describe how it works? ``` % Date: Thu, 7 Feb 91 12:20:50 -0500 %From: [email protected] %Subject: A response to perl hackers \let~\catcode~`?`\ \let?\the~`#?~`~~`]?~`~\let]\let~`\.?~`~~`,?~`~~`\%?~`~~`=?~`~]=\def ],\expandafter~`[?~`~][{=%{\message[}~`\$?~`~=${\uccode`'.\uppercase {,=,%,{%'}}}~`*?~`~=*{\advance.by}]#\number~`/?~`~=/{*-1}\newcount. =\-{*-}~`-?~`~]-\-~`^?~`~=^{*1}~`\ ?~`~= {.`\ $}~`@?~`~=@{,.,"#`@^$} .`#*`'$.?~`~0-?~`~$//$^$ .``^$*?~`~$^$.?~`~0-?~`~/$-?~`~^$@*?~`~$ * ?~`~*?~`~*?~`~*?~`~$@-?~`~$ .?~`~0-?~`~-?~`~$.``^$^^$.`<-?~`~*`<$@* ?~`~$*?~`~-`(-`+$%}\batchmode ``` It lists all your input files!
https://tex.stackexchange.com/users/963
Can you explain how this code works?
true
Most of the code here is set up, with very little actual 'payload'. Splitting things into one line per instruction is useful, with the proviso that this will cause issues with the real thing due to the spaces that get introduced as a result. `\tracingall` will help also, as already pointed out. Taking the first line of the posted code we have ``` \let~\catcode ~`?`\ ``` This starts with the assumption that `~` is active, and so can be `\let` to `\catcode`. Next, this new way of setting a catcode is used to make `?` active, as the end-of-line character has character code 13, which is the category code for an active character. (To see this, notice that there is no space after the `\` at the end of the line). The next line in the original contains: ``` ~`#?~`~ ~`]?~`~ \let]\let ~`\.?~`~ ~`,?~`~ ~`\%?~`~ ~`=?~`~ ]=\def ``` So this is mainly catcode assignments (remembering that `~` is `\catcode`). The characters `#` and `]` are both made active, and the `]` is `\let` to `\let`. Next, `.`, `,`, `%` and `=` are all made active. These line would normally be written ``` \catcode`\.\the\catcode`~ ``` or more usually ``` \catcode`\.\active ``` The final instruction on the second line is to `\let` the `=` token to `\def`. The third line of the original actually goes over slightly onto the forth one: ``` ],\expandafter ~`[?~`~ ][{ =%{\message[} ~`\$?~`~ =${\uccode`'.\uppercase{,=,%,{%'}}} ``` So we have another `\let`, a category code change and then yet another `\let`. There is then a `\def` (using the `=` version), which results in the active `%` having the definition `\message[`. That macro is going to be used later to build up the message that the code prints. Yet another category code change follows, to make `$` active, and then this is defined in the last part of the line. The idea of that definition is to make `'` active and to redefine `%` within a case-changing block. The remainder of the fourth line contains ``` ~`*?~`~ =*{\advance.by} ]#\number ~`/?~`~ =/{*-1} \newcount. ``` So yet again we have a token made active, this time `*`, which is then defined to `\advance.by`. We then have `#` begin `\let` to `\number`, and then `/` is made active and defined as expanding to `*-1`. The last instruction on this line creates a new `\count`, which will be referred to as `.` (which was made active a while ago). The next line can be broken up to read ``` =\-{*-} ~`-?~`~ ]-\- ~`^?~`~ =^{*1} ~`\ ?~`~ = {.`\ $} ~`@?~`~ =@{,.,"#`@^$} ``` So there is a definition of `\-`, then `-` is made active and `\let` to the definition of `\-`. The `^` token is made active and defined as `*1`, then the space token is made active and given a definition. Finally, `@` is made active and given a definition. That completes the bulk of the set up: most of the rest of the code is the message that gets printed! The rest of the code consists of altering the value of `.` (a count) and then redefining `%`. The idea (in general) is that `'` is given the upper-case code of the value of `.`, and this value is the character code of the letter required for the message. To keep the code complex, the numbers are done as far as possible using character codes rather than actual numbers. This is rather tedious to go through, so I'd recommend reading the `\tracingall` output for full details. One more point to note is that the code finishes ``` %}\batchmode ``` As this stage, `%` is defined as `\message[Just another TeX hacker`, where `[` will act as an opening brace but there is no closing brace. That is supplied by the literal `}`, which comes after `%` is finally used.
49
https://tex.stackexchange.com/users/73
2295
1,603
https://tex.stackexchange.com/questions/2110
77
**Looking back, what really convinced you to begin writing with TeX or LaTeX?** This question is "community wiki", so there's no reputation to lose or to gain. Please don't write advantages of TeX and LaTeX or any pros and cons. I hope to read about something like * a drastic experience that led you to TeX, * a beautiful book, paper or poster that changed your view dramatically, * a first big success with a (La)TeX creation, * a person who inspired you. Anything in this spirit would be great. Please post just a single reason or event in each answer. If you further shared a similar experience that you read here, voting that up would be fine.
https://tex.stackexchange.com/users/213
Most significant reasons that led us to (La)TeX
false
I played about with Latex as an undergraduate at the end of the '80s, but didn't "commit" to Tex until I started postgraduate work in 1994 and needed to typeset logic, and found that the advantage in this domain that Latex had, and still has, over any non-Tex-based document preparation system is huge: the support for laying out proof trees alone would have been decisive (I know of four implementations, and I wrote one myself), but additionally the specialist typesetting needs of logicians have received attention in the Tex community and not outside of it.
5
https://tex.stackexchange.com/users/175
2296
1,604
https://tex.stackexchange.com/questions/2228
10
I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color). All custom styling seem to be content-based. I would like to be able to do something like: ``` \lstinputlisting[emphlines={4},emphstyle=\color{red}]{sourcecode.f} ``` If it is not possible with the plain listings package, what do you suggest to get this effect? My goal is to highlight different lines in different slides of a beamer presentation, so if there is a simple way to do this, I will be very thankful. --- **Edit**: I came up with [this solution](http://gist.github.com/548097) after Ulrike's idea. I'm satisfied with the result, and the redundancy is bearable for my taste. It'd be very nice if someone more knowledgeable in TeX scripting suggests some improvements.
https://tex.stackexchange.com/users/341
Apply style to specific lines of a listings environment
false
You could save some arguments in your \emphline-command if you let LaTeX do some of calculations. linerange doesn't seem to like numexpr, but lastline and firstline works fine. E.g in your example you could use ``` \newcommand{\emphline}[2]{% \lstinputlisting[lastline=\the\numexpr#1-1\relax]{#2} \lstinputlisting[linerange={#1}-{#1},style=h]{#2} \lstinputlisting[firstline=\the\numexpr#1+1\relax]{#2} } ``` and then ``` \only<1> {\emphline{6} {potencia.f95}} ```
1
https://tex.stackexchange.com/users/2388
2298
1,605
https://tex.stackexchange.com/questions/1072
105
There exist several types of graphics files, such as jpeg eps pdf png tif jif. Some work with LaTeX + Dvips and some work with PDFLaTeX. How to know which type is for which processor? Just to confuse matters, metapost produces .eps files, but I can use these with PDFLaTeX as long as I put in a four line incantation. Can anyone explain this?
https://tex.stackexchange.com/users/511
Which graphics formats can be included in documents processed by LaTeX or PDFLaTeX?
false
This question has received excellent answers to the general question relating to what graphics formats the two Tex engines, but the Metapost part has been neglected (*Just to confuse matters, metapost produces `.eps` but I can use these with pdflatex as long as I put in a four line incantation*), so I shall document what you can get from Metapost. Hobby's original implementation, `mpost`, only supported Postscript as its scaleable graphics format Metapost, and came with some other utilities to allow typesetting of labels (`makempx`, `mpto`). there are several other options. 1. Most usefully for the original problem, there is `mptopdf`, which is a modification of Hobby's `mpost` to create PDFs natively that was implemented, I think, by Hans Hagen together with the Metafun extensions, and is the parent of the `mplib` codebase used to set Metapost in Luatex. See Pragma's [Metapost and Metafun](http://context.aanhet.net/metapost.htm) pages. 2. John Hobby extended the Metapost programs to support their use with the Troff typesetting system in a manner very similar to its use with Tex. This opens up possibilities for setting Metapost, but ones that are inconvenient to use with Tex and which I think are not actively maintained. 3. Taco Hoekwater has extended `mplib`/`mptopdf` to natively support SVG, which is an image format that can be embedded in PDFs and is a more convenient graphical representation than either PS or PDF in some circumstances.
9
https://tex.stackexchange.com/users/175
2301
1,606
https://tex.stackexchange.com/questions/1931
29
I am in the process of writing a large document containing some theorems, lemma, and propositions. Currently, I am using packages `amsmath` and `amsthm`. I defined my own environment for theorems by adding ``` \theoremstyle{plain} \newtheorem{thm} {Theorem}[chapter] ``` to the preamble. However, I am not quite satisfied with the looks. So is there a possibility to change the way this would be displayed? I would like to have the word "Theorem" appear in *small caps*. Furthermore, I would like a line break after the theorem's title. What is the best way to do this? Are there nice packages for this purpose (prefereably without too much fiddling)?
https://tex.stackexchange.com/users/870
How to change the way theorems are displayed?
false
You may also use the [`thmtools`](http://ctan.org/pkg/thmtools) package which offers a key-value-interface to define new theorem styles and theorems. (The package acts as a frontend to the `amsthm` and `ntheorem` packages, and one of these should be loaded before `thmtools`.) ``` \documentclass{article} \usepackage{amsthm} \usepackage{thmtools} \declaretheoremstyle[headfont=\scshape,postheadspace=\newline]{mystyle} \declaretheorem[style=mystyle]{theorem} \begin{document} \begin{theorem} Some text. \end{theorem} \end{document} ```
18
https://tex.stackexchange.com/users/510
2302
1,607
https://tex.stackexchange.com/questions/2300
21
Using `\colon` gives correct spacing for a map `$F\colon C\to D$` in one direction. But writing `$L\colon C\rightleftarrows D\colon R$` for a couple of maps in both directions (e.g. for an adjunction) gives disturbingly asymmetric spaces near first and second colons (like if D were a map from R, not the other way round). Probably, it should be fixed (e.g. some other command should be used) — but how?
https://tex.stackexchange.com/users/85
\colon for maps in opposite direction
true
`amsmath` defines `\colon` as `\nobreak \muskip 2mu\mathpunct{}\nonscript\mkern-\thinmuskip{:}\mskip 6mu plus1mu\relax`. So how about the following? ``` \newcommand*\cocolon{% \nobreak \mskip6mu plus1mu \mathpunct{}% \nonscript \mkern-\thinmuskip {:}% \mskip2mu \relax } ```
14
https://tex.stackexchange.com/users/647
2303
1,608
https://tex.stackexchange.com/questions/2286
6
I'm using the following settings for fancyhdr in a two-page book-derived documentclass: ``` \pagestyle{fancy} \fancyhf{} \fancyhead[LO]{\sffamily \footnotesize \rightmark} \fancyhead[RE]{\sffamily \footnotesize \leftmark} \fancyfoot[LO]{\footnotesize \thepage~{\color{red}\vline}} \fancyfoot[RE]{\footnotesize {\color{red}\vline}~\thepage} \fancyfootoffset{0.5cm} \fancypagestyle{plain} { \fancyhf{} % get rid of headers on plain pages \renewcommand{\headrulewidth}{0pt} % and the line \renewcommand{\footrulewidth}{0pt} % and the line } \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} ``` But, somehow, the page number on even pages gets slightly below those on odd.
https://tex.stackexchange.com/users/877
FancyHeader (Mis-)placement
false
This is a known problem: \color doesn't switch to horizontal mode (it doesn't "start a line"). So if you are in vertical mode (as you are e.g. at the start of a \parbox) the following text which starts horizontal mode is forced on a new line. You get this effect e.g. in \parbox or in p-cells of a tabular. The solution is either to use \textcolor as already suggested or to quite vmode before the color command. ``` \documentclass{article} \usepackage{xcolor} \begin{document} xxx \parbox[t]{1cm}{abc} \parbox[t]{1cm}{\color{red}abc} \parbox[t]{1cm}{\leavevmode\color{blue}abc} \end{document} ```
7
https://tex.stackexchange.com/users/2388
2304
1,609
https://tex.stackexchange.com/questions/2110
77
**Looking back, what really convinced you to begin writing with TeX or LaTeX?** This question is "community wiki", so there's no reputation to lose or to gain. Please don't write advantages of TeX and LaTeX or any pros and cons. I hope to read about something like * a drastic experience that led you to TeX, * a beautiful book, paper or poster that changed your view dramatically, * a first big success with a (La)TeX creation, * a person who inspired you. Anything in this spirit would be great. Please post just a single reason or event in each answer. If you further shared a similar experience that you read here, voting that up would be fine.
https://tex.stackexchange.com/users/213
Most significant reasons that led us to (La)TeX
false
Througout high school, I did all my math, physics and chemistry hand-ins in MS Word using Equation Editor, teaching myself the various short cuts, and patiently moving the equations back where they belonged when they for no apparent reason jumped. It was natural to continue this when I started at the university (and I had never heard of TeX/LaTeX). A few weeks later, my TA in linear algebra wrote "Come to the dark side. Learn LaTeX!" on one of my hand-ins. A week later, I was addicted :-)
14
https://tex.stackexchange.com/users/275
2306
1,610
https://tex.stackexchange.com/questions/2305
47
How can I find out which fonts are currently available in my TeX installation? (I'm using a Mac, OS 10.6.x, if that matters, although I'd prefer a machine-independent TeX-based answer). Thanks. As a followup, I tried googling for an answer to this question, without much success. Is there somewhere I could have looked for myself?
https://tex.stackexchange.com/users/76
What fonts are installed on my box?
true
There isn't a definitive "these are the fonts installed" reference, but you can usually discover them by poking around in your TeX distribution. For example, look in /usr/local/texlive/2009/texmf-dist/fonts/ ; you'll find a bunch of subdirectories with type1 fonts, tfm files, and so on. To load a font in LaTeX, however, you need .fd files, and these are found alongside any .sty files for the fonts. For example, t1lmr.fd is the font definition for loading the Latin modern roman fonts with \fontfamily{lmr} (assuming the T1 encoding). Anyway, the directory names for the fonts themselves will give you clues about packages to load if you're using LaTeX; otherwise, any font with a tfm file (such as ec-lmr10.tfm for Latin modern roman at 10pt) can be loaded in plain TeX with ``` \font\tenrm=ec-lmr10 at 10pt ``` You might font individual font packages easier to locate by browsing through CTAN, since the support files will be located alongside the fonts themselves. **Update** You could grep through the LaTeX support files to find a comprehensive listing of available font families, if you liked; not sure how useful this is, but try: ``` find /usr/local/texlive/2010/texmf-dist/tex/latex/ -name '*.fd' | xargs grep '\\DeclareFontFamily' | sed 's#.*\\DeclareFontFamily{\([a-zA-Z0-9]*\)}{\([a-zA-Z0-9]*\)}.*# \1 \2#' ``` (My shell scripting skills are a little rusty, but you get the idea.) Change the first `[a-zA-Z0-9]*` into, say, `T1` if you want only fonts with that encoding.
19
https://tex.stackexchange.com/users/179
2307
1,611
https://tex.stackexchange.com/questions/2305
47
How can I find out which fonts are currently available in my TeX installation? (I'm using a Mac, OS 10.6.x, if that matters, although I'd prefer a machine-independent TeX-based answer). Thanks. As a followup, I tried googling for an answer to this question, without much success. Is there somewhere I could have looked for myself?
https://tex.stackexchange.com/users/76
What fonts are installed on my box?
false
Besides searching for font files with the appropriate extension or looking below the texmf-dist/fonts/ directory, I would check the font map files. This command gives an system wide overview of the active and inactive font map files: ``` updmap-sys --listmaps ``` Use it at the command prompt. The output looks like: ``` Map euler.map MixedMap cm.map MixedMap cmextra.map MixedMap cyrillic.map MixedMap symbols.map Map bera.map MixedMap cm-super-t1.map MixedMap cm-super-t2a.map MixedMap cm-super-t2b.map MixedMap cm-super-t2c.map MixedMap cm-super-ts1.map MixedMap cm-super-x2.map Map cmcyr.map Map dstroke.map Map fourier-utopia-expert.map Map fourier.map Map kpfonts.map Map libertine.map Map lm.map MixedMap lxfonts.map Map marvosym.map Map MnSymbol.map Map charter.map ... ``` So I know among others there are installed: euler, cm-super, dstroke, fourier, kpfonts, libertine, marvosym, MnSymbol, charter, etc. For a reference of `updmap-sys` or `updmap` go to the command prompt (terminal) and type ``` man updmap-sys ``` or for a brief overview ``` updmap-sys --help ``` or have a look at [this web manpage](http://gd.tuwien.ac.at/linuxcommand.org/man_pages/updmap1.html).
25
https://tex.stackexchange.com/users/213
2308
1,612
https://tex.stackexchange.com/questions/2305
47
How can I find out which fonts are currently available in my TeX installation? (I'm using a Mac, OS 10.6.x, if that matters, although I'd prefer a machine-independent TeX-based answer). Thanks. As a followup, I tried googling for an answer to this question, without much success. Is there somewhere I could have looked for myself?
https://tex.stackexchange.com/users/76
What fonts are installed on my box?
false
The above solutions make more sense depending on what you want to do, but the output can be confusing, since it includes things like symbol-only fonts, and doesn't actually show you what the fonts look like or even what their full names are. I find that if I have a complete, up-to-date installation of TeXlive, however, that the fonts I can choose from (unless I've installed my own custom package) are usually pretty much exactly the ones listed in the [LaTeX font catalogue](http://www.tug.dk/FontCatalogue/) online, and that's usually my go-to source if I'm trying to decide between fonts on aesthetic grounds alone. Of course, there are other reasons I might want a font list where Stefan's or Will's methods would be more appropriate.
16
https://tex.stackexchange.com/users/411
2312
1,614
https://tex.stackexchange.com/questions/2315
10
I'm writing my masters thesis and my supervisor has picked up my sentence structure, in that they are too long. She commented that Microsoft Word has a feature to investigate 'large' sentences. How can I do this with TeX? I'm using a mac and TexShop.
https://tex.stackexchange.com/users/883
Resources For Calculating Average Sentence Length
false
I think this is the easiest way. First, make sure you have [pdftotext](http://en.wikipedia.org/wiki/Pdftotext) and [diction](http://www.gnu.org/software/diction/diction.html) installed. These should be available via [MacPorts](http://www.macports.org/). 1. Render your document to a PDF. Let's assume it's called `paper.pdf`. 2. Grab the plain text from the PDF using `pdftotext`. At the terminal, run this: `pdftotext paper.pdf paper.txt` 3. Now run `style -l N paper.txt`, where you should replace `N` with a number. This will print out all lines of your document that are longer than `N` words. Alternatively, you can do it all as a one-liner: ``` $ pdflatex paper.tex && pdftotext paper.pdf - | style -l 20 ``` `style` is extremely powerful and has many other features. For a good overview, see [here](http://www.linux.com/archive/articles/56833).
9
https://tex.stackexchange.com/users/737
2318
1,616
https://tex.stackexchange.com/questions/2319
5
I have the following flow chart but it appears uncentered. How can I center it? ``` \documentclass{article} \usepackage{pstricks} \usepackage{pst-node} \usepackage{pst-blur} \pagestyle{empty} \begin{document} \begin{center} \psframebox[linearc=5mm,cornersize=absolute]{% \begin{psmatrix}[rowsep=0.6,colsep=0.5] \psovalbox[fillstyle=solid]{Begin} & \psframebox[]{ChIP-seq} & \psframebox[]{align to genome} & \psdblframebox[framearc=.4,fillstyle=solid]{Find peaks} & \psdblframebox[framearc=.4,fillstyle=solid]{Thresholding} & \psdblframebox[framearc=.4,fillstyle=solid]{Analysis} & \psframebox[]{stop} \ncline{->}{1,1}{1,2} \ncline{->}{1,2}{1,3} \ncline{->}{1,3}{1,4} \ncline{->}{1,4}{1,5} \ncline{->}{1,5}{1,6} \ncline{->}{1,6}{1,7} \end{psmatrix}} \end{center} \end{document} ```
https://tex.stackexchange.com/users/978
Center flow chart horizontally
false
As near as I can tell the only reason it isn't centered as it is that it is too large to fit within the margins. You have several options: * Scale the image down (sent the fonts smaller and the dimensions as well) * Change the paper size or margins with something like the geometry package * Put the page or the document as a whole in landscape mode It is difficult to tell which of these options is the best without knowing more about the context.
6
https://tex.stackexchange.com/users/411
2321
1,617
https://tex.stackexchange.com/questions/2110
77
**Looking back, what really convinced you to begin writing with TeX or LaTeX?** This question is "community wiki", so there's no reputation to lose or to gain. Please don't write advantages of TeX and LaTeX or any pros and cons. I hope to read about something like * a drastic experience that led you to TeX, * a beautiful book, paper or poster that changed your view dramatically, * a first big success with a (La)TeX creation, * a person who inspired you. Anything in this spirit would be great. Please post just a single reason or event in each answer. If you further shared a similar experience that you read here, voting that up would be fine.
https://tex.stackexchange.com/users/213
Most significant reasons that led us to (La)TeX
false
It was a bottle of sherry for me! I don't know quite how I first became aware of the existence of TeX - I installed Linux on my first PC (my first *computer* was a BBC Micro which didn't, back then, support Linux) because the people with whom I was friends at the time wouldn't have stayed my friends if I hadn't! So TeX came along with it, and I suppose that many of my lecturers used TeX (of some flavour) for typesetting notes and the like so it was "in the air" as it were. So by the middle of the fourth year of my degree I was sufficiently aware of TeX, and it's importance in mathematics, that when a lecturer set a challenge problem (I think it was that A\_5 is simple), I decided to write my solution in LaTeX in order to learn it (I guess I'd already absorbed the lesson that the best way to learn LaTeX is simply to Do It^{TM}). So I wrote up my solution and duly handed it in! (I got the sherry)
10
https://tex.stackexchange.com/users/86
2322
1,618
https://tex.stackexchange.com/questions/2320
43
I want to use scientific notation with the `siunitx` package. However, when I try to do it I am getting an error: ``` The width of a human hair is \SI{1 \times 10^{-4}}{m}. ``` This has always given me a LaTeX Error" `invalid character '10^{-4}' in numerical input` Is there a better way to do this while continuing to use `siunitx`? Thanks!
https://tex.stackexchange.com/users/984
siunitx: scientific notation
true
Sure: `\SI{1e-4}{\metre}`.
58
https://tex.stackexchange.com/users/586
2323
1,619
https://tex.stackexchange.com/questions/2319
5
I have the following flow chart but it appears uncentered. How can I center it? ``` \documentclass{article} \usepackage{pstricks} \usepackage{pst-node} \usepackage{pst-blur} \pagestyle{empty} \begin{document} \begin{center} \psframebox[linearc=5mm,cornersize=absolute]{% \begin{psmatrix}[rowsep=0.6,colsep=0.5] \psovalbox[fillstyle=solid]{Begin} & \psframebox[]{ChIP-seq} & \psframebox[]{align to genome} & \psdblframebox[framearc=.4,fillstyle=solid]{Find peaks} & \psdblframebox[framearc=.4,fillstyle=solid]{Thresholding} & \psdblframebox[framearc=.4,fillstyle=solid]{Analysis} & \psframebox[]{stop} \ncline{->}{1,1}{1,2} \ncline{->}{1,2}{1,3} \ncline{->}{1,3}{1,4} \ncline{->}{1,4}{1,5} \ncline{->}{1,5}{1,6} \ncline{->}{1,6}{1,7} \end{psmatrix}} \end{center} \end{document} ```
https://tex.stackexchange.com/users/978
Center flow chart horizontally
true
As frabjous already mentioned, the image is just too big and either image or margins require adjustment. But there's trick how you can center oversized images: use `\makebox`. This way even your wide image gets properly centered: ``` \noindent\makebox[\textwidth]{% \psframebox[linearc=5mm,cornersize=absolute]{% \begin{psmatrix} ... \end{psmatrix} }} ```
7
https://tex.stackexchange.com/users/213
2324
1,620
https://tex.stackexchange.com/questions/1914
46
I often see people creating new macros where the macro token is surrounded by braces. For example, ``` \newcommand{\foo}{foo} ``` This is unnecessary and I find the extra braces make it harder to read. Why do people do this? (As an aside, I've even seen people try to use `\let{\foo}{\bar}` which, of course, doesn't work.)
https://tex.stackexchange.com/users/647
Why do people use unnecessary braces?
false
I use braces for all arguments to all macros in LaTeX because *not* to do this seems to me to be the situation requiring justification. LaTeX is designed such that its macros behave as functions, and so my mental model of something like `\newcommand{\foo}{\bar}` is "feed `\newcommand` the intended command `\foo` and its behavior `\bar`"; when I see `\newcommand\foo{\bar}` (or, worse, `\newcommand\foo\bar`, which works since `\bar` is a single token) I see the much less obvious "expand `\newcommand`; also, here is `\foo`, which happens to be eaten by this expansion before it is, itself, expanded; also, here is `\bar`, which is likewise serendipitously absorbed". If I did not know (or, in a moment of premature senility, I didn't recall) how `\newcommand` worked, the latter formation would not tell me. The former would. Even when reading my own document, this allows me to visually group the tokens into "part of a function" and "part of the text". I am a little surprised that there is any support at all (much less extremely eloquent support) for `\newcommand\foo{\bar}`, and the nod to `\frac23` baffles me (what is the twenty-third fraction command?). It seems to indicate that the respondents regularly engage in a low-level analysis of the TeX parser far beyond what is necessary to compose a structured document. I wouldn't go so far as to write directly in XML myself, but the structure imposed by the LaTeX brace style is clarifying and error-reducing (especially since LaTeX allows it to be applied consistently, unlike the poisonous behavior of TeX's `\let`, a command which fortunately need never be used in normal circumstances). Basically, as I see it, `\newcommand\foo{\bar}` is born of vestigial habits learned from TeX and which support and require a programming mindset that is neither necessary nor desirable in everyday LaTeX. Indeed, it is never taught in references that concern only LaTeX, and I suspect the people here who use it learned to do so in earlier times or from people who themselves learned in those times (specifically in response to Geoffrey Jones: TeX's idioms are familiar to some, but hopefully becoming less so). If a newcomer should read this response, my personal opinion is that they should be aware of this phenomenon and triple-check everything they read about LaTeX on the Internet before learning it.
10
https://tex.stackexchange.com/users/575
2325
1,621
https://tex.stackexchange.com/questions/2326
204
How do I vertically center the text on a page?
https://tex.stackexchange.com/users/512
Vertically center text on a page
false
This is what I found: ``` \begin{document} \topskip0pt \vspace*{\fill} text \vspace*{\fill} % \end{document} ```
270
https://tex.stackexchange.com/users/512
2327
1,622
https://tex.stackexchange.com/questions/2329
17
In LaTeX, `\tilde{x}` puts a ~ on top of the x. How can I put a ~ below the x?
https://tex.stackexchange.com/users/986
Sub tilde in LaTeX
true
Use the command `\utilde` from the [`undertilde`](http://ctan.org/pkg/undertilde) package. *Added by the crowd:* This package is not part of TeX Live, so you may have to [install it manually](http://en.wikibooks.org/wiki/LaTeX/Packages/Installing_Extra_Packages). This having been done, using the package is simple: ``` \documentclass{article} \usepackage{undertilde} \begin{document} $\utilde{x}$ \end{document} ``` This produces the following output.
17
https://tex.stackexchange.com/users/575
2330
1,624
https://tex.stackexchange.com/questions/2311
38
I am using [the awesome `pgfplots` package](http://pgfplots.sourceforge.net/) to draw some plots. I usually use `\addlegendentry` and get a nice default legend box. There are some options for legend box placement and layout (e.g. number of columns). For some plots I would like to add a title inside the legend box. Could not find the something about this in [the manual](http://pgfplots.sourceforge.net/pgfplots.pdf). Does anyone know what is the way to customize the legend box?
https://tex.stackexchange.com/users/929
Add a legend title to the legend box with pgfplots?
true
You could perhaps use the `\addlegendimage` command, as in [this discussion from the pgfplots-features mailing list](http://comments.gmane.org/gmane.comp.tex.pgfplots/152). An example, with a small `\hspace` hack to place the title more centered in the legend box: ``` \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[legend pos=south east] \addlegendimage{empty legend} \addplot {sqrt(x)}; \addplot {ln(x)}; \addlegendentry{\hspace{-.6cm}\textbf{A title}} \addlegendentry{$\sqrt{x}$} \addlegendentry{$\ln{x}$} \end{axis} \end{tikzpicture} \end{document} ``` For variety, here's a couple of more manual approaches. In each case the legend and title are separate entities, and the frame drawn afterwards. ``` \documentclass[border=5mm,tikz]{standalone} \usepackage{pgfplots} \usetikzlibrary{fit} \begin{document} \begin{tikzpicture} \begin{axis}[legend style={at={(rel axis cs:0.9,0.1)},above left,name=legend,draw=none}] \addplot {sqrt(x)}; \addplot {ln(x)}; \addlegendentry{$\sqrt{x}$} \addlegendentry{$\ln{x}$} \end{axis} \node [above,font=\bfseries] (legendtitle) at (legend.north) {Legend title}; \node [fit=(legendtitle)(legend),draw,inner sep=0pt] {}; \end{tikzpicture} \begin{tikzpicture} \begin{axis}[legend style={draw=none,legend to name=leg}] \addplot {sqrt(x)}; \addplot {ln(x)}; \addlegendentry{$\sqrt{x}$} \addlegendentry{$\ln{x}$} % place legend \node [above left] (L) at (rel axis cs:0.9,0.1) {\ref{leg}}; % Add title \node [above,font=\bfseries] (LT) at (L.north) {Legend title}; % if needed, add frame \node [fit=(L)(LT),draw,inner sep=0pt] {}; \end{axis} \end{tikzpicture} \end{document} ```
33
https://tex.stackexchange.com/users/586
2332
1,625
https://tex.stackexchange.com/questions/2331
13
I am getting the following annoying warning from `hyperref`: ``` hyperref.sty: [hyperref] Height of page (\paperheight) is invalid (0.0pt), usi ng 11in. (page 1) ``` I am using a thesis class (`thesis.cls`) and some packages like `fancyhdr` etc. I compile using `pdflatex`. I tried to fix the warning with this: ``` \special{papersize=11in,8.5in} ``` but it didn't help. Any suggestions? Thanks!
https://tex.stackexchange.com/users/3860
hyperref: Height of page (\paperheight) is invalid (0.0pt)
false
Okay, I found the solution. It it is broken in the `thesis.cls` that I'm using. But just setting it manually fixed it: ``` \setlength{\paperheight}{11in} ```
21
https://tex.stackexchange.com/users/3860
2335
1,626
https://tex.stackexchange.com/questions/2334
24
I really like the `\input` command, but what I really like more is the `\includeonly` command. Is there a way to have the best of these worlds? (i.e. an `\inputonly` or an `\include` without page-breaks?)
https://tex.stackexchange.com/users/704
Include without pagebreak
false
You won't get the behaviour that `\include` gives, where it saves the missing page numbers, chapter/footnote/equation/theorem/etc counters, bibliographic citations, etc, but if all you want is the ability to conditionally select which pieces of the document you want to compile, then there are several options, as [discussed in the FAQ](https://texfaq.org/FAQ-conditional). The `comment`, `version`, `optional`, `versions` packages allow this.
15
https://tex.stackexchange.com/users/627
2336
1,627
https://tex.stackexchange.com/questions/2340
24
I am busy making a full binary tree of three levels deep. The code I am having now is (using the trees library): ``` \begin{tikzpicture} \node {root} child {node {left} child {node {lleft}} child {node {rleft}} } child {node {right} child {node {lright}} child {node {rright}} }; \end{tikzpicture} ``` The problem is that rleft and rright are printed over each other. Preferably I would like tikz to figure this out by itself, for example if I give a minimum distance between nodes on the same level. Is this possible? (My final nodes will not have text but will be fixed size shapes) Off course it can be that the solution is: "Don't use 'trees'". In that case, what is the best way to do this?
https://tex.stackexchange.com/users/459
How to make a 3 level deep tree with tikz
true
[`tikz-qtree`](http://ctan.org/pkg/tikz-qtree) is an awesome package for more convenient tree drawing in `tikz`.
21
https://tex.stackexchange.com/users/929
2341
1,628
https://tex.stackexchange.com/questions/2339
21
I am writing a manual/guide for our intranet using LaTeX. I am wondering if there are classes developed for this purpose? A search returns results that are manuals about using LaTeX. Spefically I want to make use of "hint" boxes and the like (Floating boxes in a guide that have a short hint or some such thing). I find the way these stand out from the rest of the text really draws in the readers attention. Perhaps there is a better -- read less complex -- way of going about this using the standard book or article class?
https://tex.stackexchange.com/users/990
What is a good Manual/Guide class in LaTeX?
false
Do consider [Texinfo](http://www.gnu.org/software/texinfo/), as endorsed by Karl Berry for this task. The Latex-based compilation route is pretty bare bones, but it allows you to produce custom html, and supporting hint boxes in the html is not too difficult. [`pandoc`](http://johnmacfarlane.net/pandoc/) is a serviceable Latex to Texinfo converter. A Latex example, the source of Oetiker's *[Not so short introduction to LaTeX2e](http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf)* is available: he uses the normal book class, together with a custom style, and supports some graphically offset hints, although I think not really what you are after. See [lshort.tex](http://web.mit.edu/texsrc/source/latex/lshort/src/lshort.tex) and [lshort.sty](http://web.mit.edu/texsrc/source/latex/lshort/src/lshort.sty). Context was designed with producing educational books in mind, and is good for putting together documents with boxed content for emphasis, and allows some use of interactive PDFs and XML-based publishing. The introductory text, [*Context: An Excursion*](http://www.pragma-ade.com/general/manuals/ms-cb-en.pdf), showcases this.
13
https://tex.stackexchange.com/users/175
2342
1,629
https://tex.stackexchange.com/questions/2331
13
I am getting the following annoying warning from `hyperref`: ``` hyperref.sty: [hyperref] Height of page (\paperheight) is invalid (0.0pt), usi ng 11in. (page 1) ``` I am using a thesis class (`thesis.cls`) and some packages like `fancyhdr` etc. I compile using `pdflatex`. I tried to fix the warning with this: ``` \special{papersize=11in,8.5in} ``` but it didn't help. Any suggestions? Thanks!
https://tex.stackexchange.com/users/3860
hyperref: Height of page (\paperheight) is invalid (0.0pt)
true
With this minimal example, containing all information of your post, the error cannot be produced: ``` \documentclass{thesis} \usepackage{fancyhdr} \usepackage{hyperref} \begin{document} text \end{document} ``` So, there may be information missing. I also assume you mean the [`thesis` class](http://ctan.org/pkg/thesis) that we can find on CTAN. Instead of manually adjusting lengths, I strongly recommand to use the [`geometry`](http://ctan.org/pkg/geometry) package for that purpose: ``` \usepackage[papersize={8.5in,11in}]{geometry} ``` You may also specify margins and various other page dimensions using the `key=value` option interface. geometry calculates missing dimensions. Otherwise the user has to ensure that text width, left margin, right margin, binding offset and perhaps margin note width all sum up to the correct page width. geometry autodetects the driver like pdftex or dvips.
8
https://tex.stackexchange.com/users/213
2343
1,630
https://tex.stackexchange.com/questions/73
94
Is there a way to programmatically determine which document class is in effect? I'd like to be able to write conditional macros that behave differently depending on which document class is currently being used.
https://tex.stackexchange.com/users/77
Which document class is being used?
false
If you want to differentiate between [KOMA-Script](http://www.ctan.org/tex-archive/help/Catalogue/entries/koma-script.html)-classes (`scrartcl`, `scrbook`, `scrreprt`, `scrlttr2`) and other classes, you may also test for `\KOMAClassName` (which is defined by the former classes): ``` \@ifundefined{KOMAClassName} {<code for other classes>} {<code for KOMA-Script-classes>} ```
16
https://tex.stackexchange.com/users/510
2344
1,631
https://tex.stackexchange.com/questions/2340
24
I am busy making a full binary tree of three levels deep. The code I am having now is (using the trees library): ``` \begin{tikzpicture} \node {root} child {node {left} child {node {lleft}} child {node {rleft}} } child {node {right} child {node {lright}} child {node {rright}} }; \end{tikzpicture} ``` The problem is that rleft and rright are printed over each other. Preferably I would like tikz to figure this out by itself, for example if I give a minimum distance between nodes on the same level. Is this possible? (My final nodes will not have text but will be fixed size shapes) Off course it can be that the solution is: "Don't use 'trees'". In that case, what is the best way to do this?
https://tex.stackexchange.com/users/459
How to make a 3 level deep tree with tikz
false
You could specify options for each level, for instance silbling distance but also level distance. **Example:** ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=3cm}, level 2/.style={sibling distance=1.5cm}] \node {root} child {node {left} child {node {lleft}} child {node {rleft}} } child {node {right} child {node {lright}} child {node {rright}} }; \end{tikzpicture} \end{document} ``` **Output:**
28
https://tex.stackexchange.com/users/213
2345
1,632
https://tex.stackexchange.com/questions/2305
47
How can I find out which fonts are currently available in my TeX installation? (I'm using a Mac, OS 10.6.x, if that matters, although I'd prefer a machine-independent TeX-based answer). Thanks. As a followup, I tried googling for an answer to this question, without much success. Is there somewhere I could have looked for myself?
https://tex.stackexchange.com/users/76
What fonts are installed on my box?
false
I can't offer a TeX distribution independent answer as requested but, as some great but nevertheless distribution specific answers have already been provided, I won't feel too out of place about filling in the gaps for MikTeX distro users. It's as easy-as in MikTeX -- load up Package Manager (Admin), click the Category column header to sort on that field, check out the "Installed On" date in the `\Fonts\METAFONT` and `\Fonts\Outline fonts` categories. Repeat the process with Package Manager (User) for local configs. Unfortunately, despite its simplicity, this approach is not a perfect bet; there are still some big 'ifs' involved: * it doesn't tell you anything about "non-packaged" fonts (for that, you'll need to run solutions closer to the metal, as already mentioned, e.g., by Will) * it doesn't tell you anything about "hand installed" fonts (ditto above) * it doesn't say anything PSNFSS standard fonts (however, let's assume you at least have these) Nevertheless, for those with MikTeX, it'll take less than a minute to complete, and it can take them quite a long way to their goal. Besides being super quick and simple, you can right-click on any entry in Package Manager, click on Properties, to see the detailed description bundled with the package, whether installed on the box or not.
6
https://tex.stackexchange.com/users/416
2346
1,633
https://tex.stackexchange.com/questions/2340
24
I am busy making a full binary tree of three levels deep. The code I am having now is (using the trees library): ``` \begin{tikzpicture} \node {root} child {node {left} child {node {lleft}} child {node {rleft}} } child {node {right} child {node {lright}} child {node {rright}} }; \end{tikzpicture} ``` The problem is that rleft and rright are printed over each other. Preferably I would like tikz to figure this out by itself, for example if I give a minimum distance between nodes on the same level. Is this possible? (My final nodes will not have text but will be fixed size shapes) Off course it can be that the solution is: "Don't use 'trees'". In that case, what is the best way to do this?
https://tex.stackexchange.com/users/459
How to make a 3 level deep tree with tikz
false
I suspect that, for this case, the qtree package mentioned by maxschlepzig is the right choice. However, for more complicated structures you might find it worthwhile to compute the tree using [graphviz](http://www.graphviz.org) and then using [dot2tex](http://www.fauskes.net/code/dot2tex/) to convert it to TikZ for the actual rendering.
3
https://tex.stackexchange.com/users/86
2348
1,634
https://tex.stackexchange.com/questions/2334
24
I really like the `\input` command, but what I really like more is the `\includeonly` command. Is there a way to have the best of these worlds? (i.e. an `\inputonly` or an `\include` without page-breaks?)
https://tex.stackexchange.com/users/704
Include without pagebreak
false
I think I have understand what you need. If you don't like the bothersome pagebreaks at the end of your chapters, you should use "openany" like following: ``` ‎\documentclass[openany]{book}‎ ```
1
https://tex.stackexchange.com/users/885
2349
1,635
https://tex.stackexchange.com/questions/2347
46
By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of `\textheight`?
https://tex.stackexchange.com/users/510
Avoiding page breaks shortly after section/subsection headings
false
There isn't a generalisable mechanism. Single last lines or single first lines of a paragraph, appearing at the beginning or the end of a page, are known as 'widows' and 'orphans/clubs' (I think they're that way round). TeX has a mechanism for avoiding, or at least penalising, widows and orphans, but it's specialised for this case of keeping the first or last two lines together, and it can't be extended to three lines or more. There may be a way of addressing this by doing scary output routine gymnastics, but that would be a *very* exotic thing to do.
0
https://tex.stackexchange.com/users/96
2352
1,636
https://tex.stackexchange.com/questions/2347
46
By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of `\textheight`?
https://tex.stackexchange.com/users/510
Avoiding page breaks shortly after section/subsection headings
false
You could use needspace. With a bit calculations and tests it shouldn't be too difficult to find sensible values: ``` \documentclass{article} \usepackage{lipsum,needspace} \begin{document} \lipsum[1] \vspace{27\baselineskip} \Needspace{7\baselineskip} \section{Blubb} \lipsum[1] \newpage \lipsum[1] \vspace{28\baselineskip} \Needspace{7\baselineskip} \section{Blabb} \lipsum[1] \end{document} ```
13
https://tex.stackexchange.com/users/2388
2353
1,637
https://tex.stackexchange.com/questions/2347
46
By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of `\textheight`?
https://tex.stackexchange.com/users/510
Avoiding page breaks shortly after section/subsection headings
false
I haven't tried it myself, but perhaps you can use the [needspace](http://www.ctan.org/pkg/needspace) package for this. Be sure to heed [the FAQ warning](https://texfaq.org/FAQ-nopagebrk) about how this may confuse tex, even if you do succeed in preventing page breaks between the lines (eg, ending up with an overfull page leaving those lines jutting out of the bottom of the page).
3
https://tex.stackexchange.com/users/627
2354
1,638
https://tex.stackexchange.com/questions/2356
5
Is there a way to have subsection titles show in the margin of the page? I'm never happy with subsections, I usually tend to avoid them. What I do like, is letting the readers know what's going on by using \marginpar. It would sometimes be useful if some of these (more important) margin notes were actual subsections of the document.
https://tex.stackexchange.com/users/704
Margins as Subsections
true
Take a look at the [titlesec](http://www.ctan.org/tex-archive/help/Catalogue/entries/titlesec.html) package. The manual (page 24-25) shows an example of a heading in the margin.
6
https://tex.stackexchange.com/users/586
2357
1,639
https://tex.stackexchange.com/questions/2347
46
By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of `\textheight`?
https://tex.stackexchange.com/users/510
Avoiding page breaks shortly after section/subsection headings
true
There may be a generalisable mechanism: Using e-TeX and its `\clubpenalties` command. In the following example, patching `\@afterheading` seems to do the trick. ``` \documentclass{article} \usepackage{etex} \usepackage{etoolbox} \makeatletter \patchcmd{\@afterheading}% {\clubpenalty \@M}{\clubpenalties 3 \@M \@M 0}{}{} \patchcmd{\@afterheading}% {\clubpenalty \@clubpenalty}{\clubpenalties 2 \@clubpenalty 0}{}{} \makeatother \usepackage{blindtext} \textheight 480pt \begin{document} \section{bla} \blindtext[3] \section{blubb} \blindtext \clearpage \section{foo} \blindtext[3] An extra line. \section{bar} \blindtext \end{document} ``` UPDATE: egreg has written a [detailed explanation](https://tex.stackexchange.com/questions/21983/how-to-avoid-page-breaks-inside-paragraphs/21985#21985) of `\widowpenalties` and `\clubpenalties`.
26
https://tex.stackexchange.com/users/510
2358
1,640
https://tex.stackexchange.com/questions/2347
46
By default, LaTeX allows a page break after the first two lines of paragraphs following section/subsection headings. How can I enlarge this minimum to, say, three lines or 10 percent of the value of `\textheight`?
https://tex.stackexchange.com/users/510
Avoiding page breaks shortly after section/subsection headings
false
``` \patchcmd{\@afterheading}% {\clubpenalty \@M}{\clubpenalties 3 \@M \@M 0}{}{} ``` `\patchcmd` works for all cleanable parameterless macros, but it is meant for cleanable parameterized macros. For parameterless macros, LaTeX `\g@addto@macro` does the job without the need for the `<success>` and `<failure>` parts and, of course, without the need for `etoolbox`.
4
https://tex.stackexchange.com/users/994
2361
1,641
https://tex.stackexchange.com/questions/1282
14
I usually create figures for my articles in Matlab: various plots of numerical and analytical solutions. One thing that I don't like about it is that the font is different in the figure and in the resulting paper. Another thing is that it is a pain to put nicely typeset math into the figure directly. My solution: [psfrag](http://www.ctan.org/tex-archive/help/Catalogue/entries/psfrag.html). `psfrag` allows text in a postscript file to be replaced by LaTeX so I would put a label `AA` (for example) where I want it in the figure, and then in LaTeX write `\psfrag{AA}{$my formula$}`. This isn't such a great solution because it depends on `psfrag` (and journals do not like that), so I use [fragmaster.pl](http://www.ctan.org/tex-archive/support/fragmaster/) which creates the modified pdf and eps files locally from the master file and an auxiliary file with the `\psfrag` commands...I then `\includegraphics` these generated files in my article. This solution is a *little* roundabout, and so I'll repeat my question from the title: > > What is your complete solution for generating nice figures using an external program (for example Matlab)? > > > --- **Added Later:** After several answers were posted I noticed that none specifically addressed the issue of journals. Several times I've had editors come back to me saying something to the effect of "we'd like to publish your paper, please make sure that the figures you give us are in final form and no changes happen to them during typesetting"... If would be so kind (and if you know the answer) please modify your answer to include information relating to how journals like your solution.
https://tex.stackexchange.com/users/117
What do people use for modifying figures?
false
I use Laprint with Matlab. It is a very robust combination. An eps file is generated together with a tex file in which there are psfrag commands. So in your main LaTeX document, you end up with an eps figure with LaTeX fonts. Nothing works more perfect! For other types of drawings, I use Adobe Illustrator and in LaTeX I can use psfrag labels on the Adobe Illustrator figure very easily. Maybe Inkscape can be an alternative for those who don't have AI. The good thing is that you can choose whatever size (and name) of font you want for your labels/tickmarks and this independently of the scale of your diagrams in your LaTeX document.
1
https://tex.stackexchange.com/users/993
2362
1,642
https://tex.stackexchange.com/questions/2363
27
I'd like to set the indention of an itemize-list. How can this be done?
https://tex.stackexchange.com/users/97
Setting the indention of unordered lists
false
Define a new environment. Say you wanted a 0.25 inch indentation, something like this could do the trick. ``` \newenvironment{itemize1}{ \begin{itemize}{$\bullet$}{ \setlength{\leftmargin}{0.25in}}}{\end{itemize}} ``` then use the newly defined environment. ``` \begin{itemize1} \item First item! \item Second! \end{itemize1} ```
9
https://tex.stackexchange.com/users/10
2364
1,643
https://tex.stackexchange.com/questions/1282
14
I usually create figures for my articles in Matlab: various plots of numerical and analytical solutions. One thing that I don't like about it is that the font is different in the figure and in the resulting paper. Another thing is that it is a pain to put nicely typeset math into the figure directly. My solution: [psfrag](http://www.ctan.org/tex-archive/help/Catalogue/entries/psfrag.html). `psfrag` allows text in a postscript file to be replaced by LaTeX so I would put a label `AA` (for example) where I want it in the figure, and then in LaTeX write `\psfrag{AA}{$my formula$}`. This isn't such a great solution because it depends on `psfrag` (and journals do not like that), so I use [fragmaster.pl](http://www.ctan.org/tex-archive/support/fragmaster/) which creates the modified pdf and eps files locally from the master file and an auxiliary file with the `\psfrag` commands...I then `\includegraphics` these generated files in my article. This solution is a *little* roundabout, and so I'll repeat my question from the title: > > What is your complete solution for generating nice figures using an external program (for example Matlab)? > > > --- **Added Later:** After several answers were posted I noticed that none specifically addressed the issue of journals. Several times I've had editors come back to me saying something to the effect of "we'd like to publish your paper, please make sure that the figures you give us are in final form and no changes happen to them during typesetting"... If would be so kind (and if you know the answer) please modify your answer to include information relating to how journals like your solution.
https://tex.stackexchange.com/users/117
What do people use for modifying figures?
false
`gnuplot` has the `epslatex` terminal. This allows you to add normal LaTeX commands in labels, titles, and the key. Plus, the output will be a nice `.eps` file along with a `.tex` file containing the text. Via `epstopdf` you can easily compile this for PDFs, too. No journal could possible object to that because no external software is required for them to process your figures.
0
https://tex.stackexchange.com/users/870
2365
1,644
https://tex.stackexchange.com/questions/2369
319
When typing `<` or `>` in LaTeX and compiling with `pdflatex`, the less than and greater than symbols appear at upside down exclamation points. I'm not in math mode.
https://tex.stackexchange.com/users/996
Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation (¡) or question mark (¿)?
false
Use `\textless` and `\textgreater`.
141
https://tex.stackexchange.com/users/467
2370
1,647
https://tex.stackexchange.com/questions/2363
27
I'd like to set the indention of an itemize-list. How can this be done?
https://tex.stackexchange.com/users/97
Setting the indention of unordered lists
true
To customize itemize lists and other lists, I recommend to use the [`enumitem`](http://ctan.org/pkg/enumitem) package. It provides commands to customize the different dimension of lists as well as their labels, using `key=value` options. First, load the package: ``` \usepackage{enumitem} ``` Then, for instance, if you like to set both left margin and item indentation to 10pt, for the first level (0): ``` \setitemize[0]{leftmargin=10pt,itemindent=10pt} ``` For example, if the bulletpoints shall align with the left margin of the text, use ``` \setitemize[0]{leftmargin=*} ``` The lengths you may specify: * horizontal: `leftmargin`, `rightmargin`, `itemindent`, `listparindent`, `labelwidth`, `labelsep` * vertical: `topsep`, `partopsep`, `parsep`, `itemsep` You could choose various symbols for the bullets, further you might benefit even more if you also use enumerated lists and wish to modify their appearance. For complete information, type `texdoc enumitem` at the command prompt or open the [documentation on CTAN](http://tug.ctan.org/tex-archive/macros/latex/contrib/enumitem/enumitem.pdf).
30
https://tex.stackexchange.com/users/213
2372
1,649
https://tex.stackexchange.com/questions/2369
319
When typing `<` or `>` in LaTeX and compiling with `pdflatex`, the less than and greater than symbols appear at upside down exclamation points. I'm not in math mode.
https://tex.stackexchange.com/users/996
Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation (¡) or question mark (¿)?
true
Geoffs tip with `\textless` and `\textgreater` will work well for you. However, you could type these symbols < and > directly in your editor and they would be correctly printed if you use the recommended font encoding, Cork resp. T1: ``` \usepackage[T1]{fontenc} ``` Have a look at the [T1 encoding table](https://web.archive.org/web/20211201101310/http://www.micropress-inc.com/fonts/encoding/t1.htm), search for the symbols < and >. Afterwards, open the [OT1 encoding table](https://web.archive.org/web/20211025142237/http://www.micropress-inc.com/fonts/encoding/ot1.htm), which is the default. At the two corresponding places you will find the upside down exclamation resp. quotation mark. That should explain it. For further reasons, why you should use T1 encoding, have a look at this question: [Why should I use \usepackage[T1]{fontenc}?](https://tex.stackexchange.com/questions/664/why-should-i-use-usepackaget1fontenc) You should use a font supporting T1. For instance use the very good Latin Modern font, derived from the standard fonts: ``` \usepackage{lmodern} ``` Or install the [`cm-super`](http://ctan.org/pkg/cm-super) package which provides the standard Computer Modern fonts with T1 support.
285
https://tex.stackexchange.com/users/213
2376
1,650
https://tex.stackexchange.com/questions/2375
23
Are there any LaTeX packages that can assist with reading and writing to files? I am trying to develop a solution to the following problem: 1) I am producing a long report regularly. Part of the report include items like ``` Key date: 12 Sep 2010 Complete Floor 1 Key date: 18 Sep 2010 Other activity ``` 2) It will be nice to have all these dates saved into a sort of an aux file and then import later as a section of its own. It will also need to be sorted. I have so far looked at the answers package for inspiration and also thought of hacking the index mechanism. Any ideas and pointers would be greatly appreciated.
https://tex.stackexchange.com/users/963
File input and output
false
You can easily write to a file using ``` \newwrite\file \immediate\openout\file=myfilename.txt \immediate\write\file{A line of text to write to the file} \immediate\write\file{Another line of text to write to the file} \closeout\file ``` You can read from a file a line at a time in a similar way. ``` \newread\file \openin\file=myfilename.txt \loop\unless\ifeof\file \read\file to\fileline % Reads a line of the file into \fileline % Do something with \fileline \repeat \closein\file ``` Edit: Note that `\unless` is an e-TeX extension. `\readline` is another useful extension. It reads the line and assigns each character a category code of other (12) or space (10). This is true even of the end of line character.
18
https://tex.stackexchange.com/users/647
2377
1,651
https://tex.stackexchange.com/questions/698
50
I have been trying to encourage my students to use TeX in writing up homework, especially in early math major courses, like intro to proofs, where the typesetting is not too arduous. I have had very limited success with students taking it up. Does anyone else encourage/require assignments to be typeset? What strategies have worked best for you?
https://tex.stackexchange.com/users/200
How to encourage TeX as a homework medium
false
Introduce [LyX](http://www.lyx.org/) to your students. First impression of LaTeX is scary after years with word processors. But both GUI approach and good tutorial of LyX may attract your students. It has almost all the benefits of LaTeX, for starters, and easier to learn compared to LaTeX.
4
https://tex.stackexchange.com/users/998
2378
1,652
https://tex.stackexchange.com/questions/2375
23
Are there any LaTeX packages that can assist with reading and writing to files? I am trying to develop a solution to the following problem: 1) I am producing a long report regularly. Part of the report include items like ``` Key date: 12 Sep 2010 Complete Floor 1 Key date: 18 Sep 2010 Other activity ``` 2) It will be nice to have all these dates saved into a sort of an aux file and then import later as a section of its own. It will also need to be sorted. I have so far looked at the answers package for inspiration and also thought of hacking the index mechanism. Any ideas and pointers would be greatly appreciated.
https://tex.stackexchange.com/users/963
File input and output
false
If some of your report data is table like, perhaps [the pgfplotstable package](http://www.tug.org/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf) is an option. It makes it really easy to read in (parts) of delimited text files and typeset the data as nice tables.
6
https://tex.stackexchange.com/users/929
2379
1,653
https://tex.stackexchange.com/questions/2326
204
How do I vertically center the text on a page?
https://tex.stackexchange.com/users/512
Vertically center text on a page
true
The [memoir](http://www.ctan.org/tex-archive/macros/latex/contrib/memoir/) document class provides, among a lot of other excellent things, the `vplace` environment. Try: ``` \documentclass{memoir} \begin{document} \begin{vplace}[0.7] This is some text to be centered vertically. \end{vplace} \end{document} ``` `[0.7]` is an optional parameter specifying the ratio of space above to space below. The default value is `[1]`.
65
https://tex.stackexchange.com/users/344
2380
1,654
https://tex.stackexchange.com/questions/2381
9
I know that I can change the font for the equation numbers by redefining the `\theequation` command by, say, ``` \renewcommand{\theequation}{{\sffamily\arabic{equation}}} ``` I am wondering if there's a better way of doing this. The reason I ask is because if I include the section number to the equation numbers using the following amsmath command ``` \numberwithin{equation}{section} ``` then this will nullify the previous redefinition. Of course an obvious solution for this is to just use ``` \renewcommand{\theequation}{{\sffamily\thesection.\arabic{equation}}} ``` but I am curious if there's another way.
https://tex.stackexchange.com/users/1000
Changing the font for equation numbering
true
I think your obvious solution is the right way to go. There's certainly no harm in it.
5
https://tex.stackexchange.com/users/647
2383
1,655
https://tex.stackexchange.com/questions/2317
48
Is there a suitable macro (or even style) for responses to referees and editor? These often entails several points to that need to be addressed. It would be nice to, say, quote the original text (possibly numbered) and the show the response slightly indented, as in > > a) Spell foo as bar > > > > > > > We opted to follow the ABC style of ... > > > > > b) Include reference to Really, Important and Stuff (2010) > > > > > > > Section 2 has been updated and the discussion ... > > > > >
https://tex.stackexchange.com/users/980
LaTeX style or macro for detailed response to referee report
false
Just use itemize or enumerate. Put the suggestion (or, better, a one-line summary of it) in bold or italic at the start of each item. Although it is useful to use latex or tex (in case there is mathematics involved), the formatting should not matter much to the editor or the reviewers, so long as things are clear. Don't waste time worrying about formatting. Instead, spend your time documenting the changes to your document (or reasons for not changing). I normally quote line numbers in the revised version, so that reviewers can check quickly the changes that have been made, to see if they judge them sufficient. Few reviewers are going to read the whole text again, with the original one at its side, to see the changes. The reviewers have done a lot of work for you, and few systems credit that work. (Deans and bosses of all kinds want to count beans, and providing careful reviews counts as, well, as a first approximation, *zero* beans.) You should give your reviewers a break, in the second round. Tell them what you've changed (and *where* in the text), and why you refuse to change other things. If you have some minimal formatting (even a blank line between items), that's sufficient.
5
https://tex.stackexchange.com/users/922
2384
1,656
https://tex.stackexchange.com/questions/2382
14
One thing annoying in `sparklines` is its verbosity and dependence on external arithmetics. For example, to depict a three bar graph of 16%, 53%, 31%, one has to write: ``` \begin{sparkline}{4} \sparkspike .166 .302 \sparkspike .500 1 \sparkspike .834 .585 \end{sparkline} ``` I would prefer: ``` \threesparkline{0.16}{0.53}{0.31} ``` So my main question is *can I do basic arithmetic in LaTeX, like dividing and multiplying numbers, finding the max among three parameters, etc?* Alternatively, *is there a better way of using sparklines that I've missed?* **UPDATE:** After the sugestion of using the `calc` package, I'm stuck with the following attempt which yields an error in `\real` and `\ratio`: ``` \newcommand{\threespike}[3]{ \newcounter{max}\setcounter{max}{\maxof{\maxof{\real{#1}}{\real{#2}}}{\real{#3}}} \newcounter{a}\setcounter{a}{\ratio{\real{#1}}{max}} \newcounter{b}\setcounter{b}{\ratio{\real{#2}}{max}} \newcounter{c}\setcounter{c}{\ratio{\real{#3}}{max}} \begin{sparkline}{4} \sparkspike .166 a \sparkspike .500 b \sparkspike .834 c \end{sparkline} } ``` **UPDATE2:** I eventually got to make `\ratio` work directly like this: ``` \newcommand{\ratiofivespark}[7]{ \begin{sparkline}{6} \sparkspike .1 \ratio{#2}{#1} \sparkspike .3 \ratio{#3}{#1} \sparkspike .5 \ratio{#4}{#1} \sparkspike .7 \ratio{#5}{#1} \sparkspike .9 \ratio{#6}{#1} \end{sparkline} } ``` Where the first parameter passed establishes the full height of a bar. See the accepted answer for more powerful LaTeX-Fu!
https://tex.stackexchange.com/users/877
Performing basic arithmetic in custom commands
true
You can certainly do basic arithmetic in LaTeX. You have several options. You can use the standard TeX `\advance`, `\multiply`, and `\divide`. You can use the `calc` package for a more natural way of doing arithmetic (although, I find I don't use it). You can also use the e-TeX extension `\numexpr ... \relax`. Edit: Okay. I think I've got a solution for you. ``` \documentclass{article} \usepackage{sparklines} \usepackage{fp} \newcount\slnum \makeatletter \newcommand\dosparkline[2][4]{% \FPset\slmax{0}% \FPset\slpos{0}% \slnum0 \slparse#2,\relax \FPadd\sladvance{1}{\the\slnum}% \FPdiv\sladvance{1}\sladvance \count@\slnum \loop\ifnum\count@>0 \advance\count@-1 \FPdiv\sltemp{\csname sl@\the\count@\endcsname}\slmax \expandafter\let\csname sl@\the\count@\endcsname\sltemp \repeat \begin{sparkline}{#1} \count@0 \loop\ifnum\count@<\slnum \FPadd\slpos\slpos\sladvance % The {} are necessary \sparkspike \slpos{} \csname sl@\the\count@\endcsname{} \advance\count@1 \repeat \end{sparkline} } \def\slparse#1,#2\relax{% \FPset\sltemp{#1}% \FPmax\slmax\slmax\sltemp \expandafter\let\csname sl@\the\slnum\endcsname\sltemp \advance\slnum1 \ifx\relax#2\relax\else \slparse#2\relax \fi } \makeatother \begin{document} \dosparkline[10]{16,53,31,25,10,45} \dosparkline{.16,.53,.31} \begin{sparkline}{4} \sparkspike .166 .302 \sparkspike .500 1 \sparkspike .834 .585 \end{sparkline} \end{document} ``` The first `\dosparkline` shows the optional argument which is the width (in ex of all things!). The second one shows what you asked for which you can compare without the output of yours. You'll note I didn't match your spacing. You can play around with that by changing how `\sladvance` is computed.
5
https://tex.stackexchange.com/users/647
2385
1,657
https://tex.stackexchange.com/questions/2381
9
I know that I can change the font for the equation numbers by redefining the `\theequation` command by, say, ``` \renewcommand{\theequation}{{\sffamily\arabic{equation}}} ``` I am wondering if there's a better way of doing this. The reason I ask is because if I include the section number to the equation numbers using the following amsmath command ``` \numberwithin{equation}{section} ``` then this will nullify the previous redefinition. Of course an obvious solution for this is to just use ``` \renewcommand{\theequation}{{\sffamily\thesection.\arabic{equation}}} ``` but I am curious if there's another way.
https://tex.stackexchange.com/users/1000
Changing the font for equation numbering
false
You could use the `\pretocmd` command of the [`etoolbox`](http://www.ctan.org/tex-archive/help/Catalogue/entries/etoolbox.html) package to insert code at the beginning of `\theequation` (and leave the rest of its definition unchanged). ``` \usepackage{etoolbox} \pretocmd{\theequation}{\sffamily}{}{} ``` (The code snipped must be placed after using `\numberwithin` and the like.)
7
https://tex.stackexchange.com/users/510
2386
1,658
https://tex.stackexchange.com/questions/2373
12
I've been using LaTeX and R for a few years now, but am only now bringing them together via Sweave. As I put the document together, I run my R code in its own session to verify that it works properly, then add it to the Sweave file. Then, I Sweave the file in R. This goes fine, since all the R code has checked out. When I compile the TeX file, though, there are almost invariably errors that I have made. Finding an error in the TeX file, tracing it to the Sweave file, and re-Sweaving and TeXing isn't that difficult. It does become a pain when there are multiple errors, meaning multiple reruns of Sweave and pdftex. It would be simpler if I could fix all the errors in the TeX file, which can be rerun alone simply, and have them transfer into the Sweave file, rendering it ready for a final Sweave and TeX compile. Any tips on how you handle this workflow? One tip is to not make any errors, but, as an economist, I believe that the optimal number of errors is probably greater than 0. Thanks! Charlie
https://tex.stackexchange.com/users/758
Workflow in Sweave: Handling TeX errors
true
I also use sweave (a few months) and latex (20 years). With a reasonably fast machine, the optimal scheme is simply to rebuild *often*. I use "make" (on a unix-like machine) so that only the chapters whose Rnw file has changed get rebuilt into tex files. That saves a lot of sweave time. Alternatively, you can edit the .tex file and work away at errors, and put your results back into the .Rnw file when you're ready. But that's error-prone. If you run sweave-latex often, and fix errors as soon as you see them, then you won't make so many errors. The other advice is to use a decent editor (e.g. emacs) that does a lot of the work for you, e.g. finishing off parenthetic blocks, begin/end environments and so forth. That prevents 2/3 of the errors you're likely to make.
6
https://tex.stackexchange.com/users/922
2387
1,659
https://tex.stackexchange.com/questions/698
50
I have been trying to encourage my students to use TeX in writing up homework, especially in early math major courses, like intro to proofs, where the typesetting is not too arduous. I have had very limited success with students taking it up. Does anyone else encourage/require assignments to be typeset? What strategies have worked best for you?
https://tex.stackexchange.com/users/200
How to encourage TeX as a homework medium
false
Put the source code for a sample answer on your course website. Better yet, don't worry about it. It's really not fun grading assignments that have errors that, if written by hand would imply complete lack of understanding, but if typeset imply only a trivial typo. (For example, it is easy to forget a `partial` in a tex expression, which is something that only weak students would do with pen on paper.) Do you *really* want to write "C" (or worse) on such a paper? I bet that most people reading this site love tex and latex. But if students are not using these things of their own free will, then that indicates that these things are not useful to them (yet). I use latex for all my course materials, which are quite mathematical. The results are manifestly more beautiful than they would have been, had I used word or openoffice. Guess what? A lot of students notice this, and start using latex, without my asking. Tex and Latex can argue for themselves.
4
https://tex.stackexchange.com/users/922
2390
1,660
https://tex.stackexchange.com/questions/2391
2
Currently, the space between the bottom of my header and the top of the chapter number is quite large and I would like to be able to reduce the space between the header and the chapter number. How would I go about doing this? I am using the report documentclass.
https://tex.stackexchange.com/users/952
How do I modify the amount of space between the heading and the chapter's number and/or name?
true
I found the answer over at [stackoverflow.com](https://stackoverflow.com/questions/2801107/latex-positions-of-page-numbers-position-of-chapter-headings-chapters-and-tab/2803289#2803289). To recap, I had to use: ``` \usepackage{titlesec} \titleformat{ command }[ shape ]{ format }{ label }{ sep }{ before }[ after ] \titlespacing{ command }{ left }{ beforesep }{ aftersep }[ right ] ``` `\titleformat` must be specified in order for the spacing to take effect.
3
https://tex.stackexchange.com/users/952
2392
1,661
https://tex.stackexchange.com/questions/2360
1
I use LaPrint in Matlab to generate my EPS figures. In the TeX file that accompanies the EPS file with the LaPrint output, I have some PSfrag commands. If we consider, say, the y-axis, I find in some cases that the y-axis label is very close to the tick marks labels. And in some cases, they overlap. Here is PSfrag code for a y-axis label: ``` \psfrag{s04}[b][b]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}% ``` where label `s04` is to be replaced by "Force F, kN". I find that I can get further separation between the y-axis label and the tick marks label by using ``` \psfrag{s04}[bc][bl]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}% ``` where the only change was from `[b]` to `[bc]` and `[b]` to `[bl]`. However at times this is insufficient. I have been looking at the PSfrag manual but couldn't find any good solutions. Any suggestions? So I'm basically looking to increase the separation between the y-label and the tick marks on the graph axis. This amounts to moving the y-label more to the left.
https://tex.stackexchange.com/users/993
correcting label placement with psfrag
false
I use [struts](http://en.wikipedia.org/wiki/Strut_%28typesetting%29), or phantom objects, which is ugly but which does the trick. Thus, you might include `\phantom{a}` or something before the text in order to force the text to the right.
1
https://tex.stackexchange.com/users/480
2395
1,662
https://tex.stackexchange.com/questions/2397
6
So I'm writing up a CV and I would like to use the nifty `itemize` environment to list some things within a `tabular` environment. Unfortunately, things end up looking a bit [this](https://i.stack.imgur.com/TqN2h.jpg), which isn't at all what I want. Specifically, I want to the itemize environment to hug closely to "BIG COMPANY NAME" so that it appears as "Software Development Intern" does, and likewise at the bottom. My current code looks a bit like so: ``` \textsc{May 2010 to Aug 2010} & Software Development Intern \\ & \textsc{BIG COMPANY NAME} \\ & \begin{itemize} \setlength{\itemsep}{0pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} \setlength{\partopsep}{0pt} \setlength{\topsep}{0pt} \item item1 \item item2 \end{itemize} \\ & \small{Cool Details}\\ ``` Buuut it's not doing the job at all. Any suggestions, LaTeX gurus?
https://tex.stackexchange.com/users/1003
Lists in Tabular Environment
false
I have several suggestions. I would suggest using one of the numerous cv/resumé packages. My own cv uses `currvita`. The next suggestion would be to use the `enumitem` package for changing the spacing of your lists. Finally, you don't have a table of data so `tabular` is probably the wrong thing to use.
2
https://tex.stackexchange.com/users/647
2398
1,663
https://tex.stackexchange.com/questions/2382
14
One thing annoying in `sparklines` is its verbosity and dependence on external arithmetics. For example, to depict a three bar graph of 16%, 53%, 31%, one has to write: ``` \begin{sparkline}{4} \sparkspike .166 .302 \sparkspike .500 1 \sparkspike .834 .585 \end{sparkline} ``` I would prefer: ``` \threesparkline{0.16}{0.53}{0.31} ``` So my main question is *can I do basic arithmetic in LaTeX, like dividing and multiplying numbers, finding the max among three parameters, etc?* Alternatively, *is there a better way of using sparklines that I've missed?* **UPDATE:** After the sugestion of using the `calc` package, I'm stuck with the following attempt which yields an error in `\real` and `\ratio`: ``` \newcommand{\threespike}[3]{ \newcounter{max}\setcounter{max}{\maxof{\maxof{\real{#1}}{\real{#2}}}{\real{#3}}} \newcounter{a}\setcounter{a}{\ratio{\real{#1}}{max}} \newcounter{b}\setcounter{b}{\ratio{\real{#2}}{max}} \newcounter{c}\setcounter{c}{\ratio{\real{#3}}{max}} \begin{sparkline}{4} \sparkspike .166 a \sparkspike .500 b \sparkspike .834 c \end{sparkline} } ``` **UPDATE2:** I eventually got to make `\ratio` work directly like this: ``` \newcommand{\ratiofivespark}[7]{ \begin{sparkline}{6} \sparkspike .1 \ratio{#2}{#1} \sparkspike .3 \ratio{#3}{#1} \sparkspike .5 \ratio{#4}{#1} \sparkspike .7 \ratio{#5}{#1} \sparkspike .9 \ratio{#6}{#1} \end{sparkline} } ``` Where the first parameter passed establishes the full height of a bar. See the accepted answer for more powerful LaTeX-Fu!
https://tex.stackexchange.com/users/877
Performing basic arithmetic in custom commands
false
For calculations using real numbers, take a look at the [`fp`](http://ctan.org/pkg/fp) package. If you are using LuaTeX then escaping to Lua is going to be the best approach.
5
https://tex.stackexchange.com/users/73
2399
1,664
https://tex.stackexchange.com/questions/2396
54
I need to change the indentation that the `quote` and `quotation` environments and commands employ. I assume that there is some length I need to set, but I've googled around, and cannot find what I am after. So, how to alter the indentation?
https://tex.stackexchange.com/users/93
How can I change the indentation in quote and quotation environments and commands?
false
`\advance\leftmargini 2em` before `\begin{quote}` or `\begin{quotation}`.
1
https://tex.stackexchange.com/users/647
2400
1,665
https://tex.stackexchange.com/questions/2397
6
So I'm writing up a CV and I would like to use the nifty `itemize` environment to list some things within a `tabular` environment. Unfortunately, things end up looking a bit [this](https://i.stack.imgur.com/TqN2h.jpg), which isn't at all what I want. Specifically, I want to the itemize environment to hug closely to "BIG COMPANY NAME" so that it appears as "Software Development Intern" does, and likewise at the bottom. My current code looks a bit like so: ``` \textsc{May 2010 to Aug 2010} & Software Development Intern \\ & \textsc{BIG COMPANY NAME} \\ & \begin{itemize} \setlength{\itemsep}{0pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} \setlength{\partopsep}{0pt} \setlength{\topsep}{0pt} \item item1 \item item2 \end{itemize} \\ & \small{Cool Details}\\ ``` Buuut it's not doing the job at all. Any suggestions, LaTeX gurus?
https://tex.stackexchange.com/users/1003
Lists in Tabular Environment
false
You can use \novspace to get rid of the space at the top, nolistsep from enumitem for the spaces in the list, the internal \parbox for the space at the bottom and the \strut to give the \parbox the correct depth. ``` \documentclass[]{book} \usepackage{enumitem} \makeatletter \newcommand\novspace{\@minipagetrue} \makeatother \begin{document} \begin{tabular}{lp{5cm}} \textsc{May 2010 to Aug 2010} & Software Development Intern \\ & \textsc{BIG COMPANY NAME} \\ &\parbox[t]{5cm}{\novspace \begin{itemize}[nolistsep] \item item1 \item item2\strut \end{itemize}}\\ & \small Cool Details \end{tabular} \end{document} ```
8
https://tex.stackexchange.com/users/2388
2404
1,667
https://tex.stackexchange.com/questions/2393
18
Is there a way of testing if a `\pageref` is the current page? For example, in the next code: ``` \newcommand\figureref[1]{% Figure~\ref{#1} (p.~\pageref{#1}) } ``` I would like to eliminate the `(p.~\pageref{#1})` if the referenced figure is on the same page as the reference. I tried using the `varioref` package and but couldn't tweak it to the desired behavior. **UPDATE:** Going back to the original question of *testing for current page*, this almost worked: ``` \newcounter{cPage} \newcommand\figureref[1]{% Figure~\ref{#1}% \setcounter{cPage}{\value{page}}\addtocounter{cPage}{1}% \ifthenelse{\value{cPage}=\pageref{#1}}{}{(p.~\pageref{#1})}% } ``` But, the page value is not very consistent. Sometimes it changes in the middle of a page. The offset varies, between -1/1 and +1/2, and I can't seem to find any logic behind it.
https://tex.stackexchange.com/users/877
Testing for current page
false
Looks like you want something like ``` \newcommand*\figureref[1]{Figure~\vref{#1}} \renewcommand*\reftextbefore{(p.~\thevpagerefnum)} \let\reftextfacebefore\reftextbefore \let\reftextafter\reftextbefore \let\reftextfaceafter\reftextbefore \renewcommand*\reftextfaraway[1]{(p.~\pageref{#1})} ``` Edit: After reading `varioref` more closely, I see my redefinition of \vref was unnecessary. Edit 2: You didn't mention anything about `hyperref` before. I'm not sure what the best way to go about this is, but the following sort of works. ``` \newcommand*\figureref[1]{Figure~\ref{#1}\vpageref[]{#1}} \makeatletter \let\old@vpageref\@vpageref \def\@vpageref[#1]{\@ifnextchar[%] {\vpageref@interpose{#1}}% {\vpageref@interpose{#1}[\unskip\vref@space]}% } \def\vpageref@interpose#1[#2]#3{% \def\thereflabel{#3}% \@@vpageref{#1}[#2]{#3}% } \makeatother \renewcommand*\reftextbefore{\reftextfaraway{\thereflabel}} \let\reftextfacebefore\reftextbefore \let\reftextafter\reftextbefore \let\reftextfaceafter\reftextbefore \renewcommand*\reftextfaraway[1]{(p.~\pageref{#1})} ``` I think `hyperref` changes `\@@vpageref` which is why I didn't just modify that directly. Update: ======= Okay, going back to your original question. This is essentially what `varioref` does to solve this problem. ``` \documentclass{article} \newcount\testpagecount \testpagecount0 \DeclareRobustCommand\ifrefthispage[3]{% \global\advance\testpagecount1 \getpagenum\refstartnum{tpcstart\the\testpagecount}% \getpagenum\refendnum{tpcend\the\testpagecount}% \getpagenum\labelnum{#1}% \ifx\refstartnum\refendnum\else \GenericWarning{}{Reference to #1 fell on page boundary \refstartnum-\refendnum}% \fi \testpagelabel{tpcstart\the\testpagecount}% \ifx\labelnum\refendnum #2% \else #3% \fi \testpagelabel{tpcend\the\testpagecount}% } \makeatletter \def\getpagenum#1#2{% \@ifundefined{r@#2}{\@namedef{r@#2}{{??}{??}}}{}% \protected@edef#1{\expandafter\expandafter\expandafter \@cdr\csname r@#2\endcsname\@nil}% } \def\testpagelabel#1{% \protected@write\@auxout{}{\string\newlabel{#1}{{}{\thepage}}}% } \makeatother \begin{document} \section{Foo}\label{sec:foo} \ifrefthispage{sec:foo}{Ref is on this page}{Ref is not on this page} \newpage \ifrefthispage{sec:foo}{Ref is on this page}{Ref is not on this page} \end{document} ``` Basically, it generates two new labels, one on either side of the two replacement texts using `\testpagelabel` which is nearly identical to the standard `\label`, just without the actual label. On subsequent runs, it checks if the two labels straddle a page boundary. If they do, a warning is issued. (Admittedly, I didn't check that code path.) Then, if the second label is on the same page as the label you want to test, it uses the tokens in the second argument, otherwise it use the tokens in the third argument. Note that on page boundaries, it could change every time you compile. I don't really know of a way to handle that .
6
https://tex.stackexchange.com/users/647
2405
1,668
https://tex.stackexchange.com/questions/2403
4
minimal example: ``` \documentclass[oneside]{memoir} \setstocksize{8.5in}{3.6666in} \settrimmedsize{8.5in}{3.6666in}{*} \settrims{0in}{0in} \settypeblocksize{9.0in}{32pc}{*} \setlrmarginsandblock{0.37in}{*}{1} \setulmarginsandblock{0.1in}{*}{1} \setheadfoot{0pt}{0pt} \setheaderspaces{*}{0pt}{*} \checkandfixthelayout \clearpage\thispagestyle{empty} \begin{document} \begin{vplace}[1] test \end{vplace} \end{document} ```
https://tex.stackexchange.com/users/512
Vertically centering text on a page doesn't work?
true
The environment, as you've discovered, is clearly broken. For now, you can work around it with ``` \documentclass{memoir} \begin{document} \null \begin{vplace}[1] test \end{vplace} \end{document} ``` I'll contact Lars about the problem.
4
https://tex.stackexchange.com/users/179
2406
1,669
https://tex.stackexchange.com/questions/2403
4
minimal example: ``` \documentclass[oneside]{memoir} \setstocksize{8.5in}{3.6666in} \settrimmedsize{8.5in}{3.6666in}{*} \settrims{0in}{0in} \settypeblocksize{9.0in}{32pc}{*} \setlrmarginsandblock{0.37in}{*}{1} \setulmarginsandblock{0.1in}{*}{1} \setheadfoot{0pt}{0pt} \setheaderspaces{*}{0pt}{*} \checkandfixthelayout \clearpage\thispagestyle{empty} \begin{document} \begin{vplace}[1] test \end{vplace} \end{document} ```
https://tex.stackexchange.com/users/512
Vertically centering text on a page doesn't work?
false
You can add `\hrule height0pt` before the `\begin{vplace}`. From reading the documentation, it seems like it should work, but it doesn't. It looks like a bug in `memoir` to me. ``` \newenvironment{vplace}[1][1]{% \par\vspace{\stretch{#1}}% }{% \vspace*{\stretch{1}}% \par} ``` I think that should be ``` \newenvironment{vplace}[1][1]{% \par \vspace*{\stretch{#1}} }{% \par \vspace{\stretch{1}}% } ```
4
https://tex.stackexchange.com/users/647
2407
1,670
https://tex.stackexchange.com/questions/2375
23
Are there any LaTeX packages that can assist with reading and writing to files? I am trying to develop a solution to the following problem: 1) I am producing a long report regularly. Part of the report include items like ``` Key date: 12 Sep 2010 Complete Floor 1 Key date: 18 Sep 2010 Other activity ``` 2) It will be nice to have all these dates saved into a sort of an aux file and then import later as a section of its own. It will also need to be sorted. I have so far looked at the answers package for inspiration and also thought of hacking the index mechanism. Any ideas and pointers would be greatly appreciated.
https://tex.stackexchange.com/users/963
File input and output
true
Sounds like the perfect task for the `datatool` package. It is design to create "databases" in TeX, which can then be saved to an external file and then read in later. Lots of useful data manipulation commands, as well.
15
https://tex.stackexchange.com/users/179
2408
1,671
https://tex.stackexchange.com/questions/2403
4
minimal example: ``` \documentclass[oneside]{memoir} \setstocksize{8.5in}{3.6666in} \settrimmedsize{8.5in}{3.6666in}{*} \settrims{0in}{0in} \settypeblocksize{9.0in}{32pc}{*} \setlrmarginsandblock{0.37in}{*}{1} \setulmarginsandblock{0.1in}{*}{1} \setheadfoot{0pt}{0pt} \setheaderspaces{*}{0pt}{*} \checkandfixthelayout \clearpage\thispagestyle{empty} \begin{document} \begin{vplace}[1] test \end{vplace} \end{document} ```
https://tex.stackexchange.com/users/512
Vertically centering text on a page doesn't work?
false
Fixed in the next memoir release /daleif
4
https://tex.stackexchange.com/users/nan
2409
1,672
https://tex.stackexchange.com/questions/2360
1
I use LaPrint in Matlab to generate my EPS figures. In the TeX file that accompanies the EPS file with the LaPrint output, I have some PSfrag commands. If we consider, say, the y-axis, I find in some cases that the y-axis label is very close to the tick marks labels. And in some cases, they overlap. Here is PSfrag code for a y-axis label: ``` \psfrag{s04}[b][b]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}% ``` where label `s04` is to be replaced by "Force F, kN". I find that I can get further separation between the y-axis label and the tick marks label by using ``` \psfrag{s04}[bc][bl]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}% ``` where the only change was from `[b]` to `[bc]` and `[b]` to `[bl]`. However at times this is insufficient. I have been looking at the PSfrag manual but couldn't find any good solutions. Any suggestions? So I'm basically looking to increase the separation between the y-label and the tick marks on the graph axis. This amounts to moving the y-label more to the left.
https://tex.stackexchange.com/users/993
correcting label placement with psfrag
true
I have found a solution by modifying the `\arraystretch` parameter. It works fine. e.g. ``` \psfrag{s04}[bc][bl]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\renewcommand{\arraystretch}{1.8}\begin{tabular}{c}Write here\end{tabular}}% ```
1
https://tex.stackexchange.com/users/993
2410
1,673