# Tag Info

95

Here's a hacky way, probably this is the wrong way :). Instead of passing a filename, you can pass a sequence of commands. So in particular, you could do something like pdflatex "\def\ishandout{1} \input{foo.tex}" which defines the macro \ishandout (to be 1) and then reads foo.tex. And then, inside foo.tex, you can check whether \ishandout is defined: \...

87

Latexmk is one possibility, although I've never used it myself.

57

Try Arara. It also has a great manual. \expandafter\thecomment Arara provides us with ways (rules) to compile the document that are specific to the document. The rules for compilation are put inside the document. Hence, compilation boils down to a simple arara yourtexfile. First, install arara and make sure that the arara executable is included in system ...

57

You can use the following tools to do this. All of them are on CTAN but not all of them are part of either TeXLive or MikTeX, so you may need to manually install them. They need either Perl or a C compiler installed. Both should not be a problem with Linux but might be one under Windows or Mac. However IIRC TeXLive installs its own Perl interpreter. ...

44

Yes, there are packages called svn and svninfo, as well as a few for other version-control systems. See the UK TeX FAQ: you can have something like \SVNdate $Date$ which will use the value of the Date SVN variable in your document, or have footers containing the date and version number in the document. I don't think either of them shows diffs, though.

43

The TikZ 2.10 library, external, addresses this issue. Externalizing all TikZ graphics in a LaTeX document is as easy as: \usetikzlibrary{external} \tikzexternalize If your document is named report.tex, this will dump out a series of images: report-figure0.pdf, report-figure1.pdf, etc, etc. To get a more manageable output, you can specify a directory ...

42

At Hans-Peter E. Kristiansen’s request, I provide another answer, extending the one given by kay102. Add the following lines to some latexmk initialization file (e.g., on Linux systems, ~/.latexmkrc): add_cus_dep('glo', 'gls', 0, 'run_makeglossaries'); add_cus_dep('acn', 'acr', 0, 'run_makeglossaries'); sub run_makeglossaries { if ( $silent ) { ... 42 Advantage If you use biblatex or multiple languages with babel or polyglossia, you can benefit from the integrated commands of csquotes. There are commands to quote in languages other than the main language so that the quoted text is typeset in accordance with the rules of the language. There are also commands to make formal quotes, both in the main ... 41 Here's a TikZ picture producing the USA map. I produced it as follows: I downloaded the svg map from wikipedia I used Inkscape to translate the svg to tikz code (in verbose mode) the verbose mode annotated the paths with the abbreviated names of the states so I just copied the names and put them as the style of each path (you can do it with a regex) I ... 40 Newer versions of Ghostscript (version 9.05 and later) include a "device" called inkcov. It calculates the ink coverage of each page (not for each image) in Cyan (C), Magenta (M), Yellow (Y) and Black (K) values, where 0.00000 means 0%, and 1.00000 means 100%. Example commandline: gs -o - -sDEVICE=inkcov /path/to/your.pdf Example output: Page 1 0.00000 ... 37 For systems like CVS or Subversion, which modify source files, the TeX FAQ's bare-bones answer is my favourite: \def\RCS$#1: #2 ${\expandafter\def\csname RCS#1\endcsname{#2}} \RCS$Revision: 1.13 $% or any RCS keyword \RCS$Date: 2010/04/02 18:20:00 $... \date{Revision \RCSRevision, \RCSDate} It's not very sophisticated, but you're only going to use it ... 35 You need to write a configuration file that tells latexmk which files are interesting for the glossary and how to handle them. Fortunately, the author provides some sample rc files. Putting add_cus_dep('glo', 'gls', 0, 'makeglo2gls'); sub makeglo2gls { system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o '$_[0]'.gls '\$_[0]'.glo"); } in ~/.latexmkrc (...

35

Do I really need to go over everything and add \index{}? Unfortunately yes. At best even if you write a script to automate it you will end up with a concordance, and a concordance is not an index. In my opinion it is actually better to postpone the writing of the index to the time the book is almost ready. Writing an index is an art and most publishers ...

33

Well even if I know which quotes I want to use in a document: I would find it painful to remember which quotes and keyboard keys to use in an English text, and which in the German and whatever a Frenchman must use in a French text. Actually at the time csquotes appeared I was just thinking about a generic system to relieve me from trying to remember which of ...

30

For the last part of your question, I like the Perl script latexdiff. This generates LaTeX documents displaying linebreak-insensitive differences, with changebars and other visual markup. (Alas, the implementation is quite hacky, relying on complex regular expressions for parsing, so it's worth ensuring one has Perl 5.8.10 or later installed for greater ...

30

I did a large amount of research for a very similar StackOverflow question. To summarize the problems of each tool: latexmk will overwrite your document in place, frequently causing your viewer to display an incomplete document (eg when there are errors). Its error support is bad. rubber will overwrite your document in place (see above). It also frequently ...

30

The pgffor package allows for-loop style repetition using the following format: \foreach \<cmd> in {1,...,<total>} {% % stuff } Using this as base, the following is probably what you're after: \documentclass{beamer}% http://ctan.org/pkg/beamer \usepackage{graphicx}% http://ctan.org/pkg/graphicx \usepackage{pgffor}% http://ctan.org/pkg/...

30

You can use a vertical alignment to get the measuring done and then re-flow them in a horizontal layout: \documentclass{article} \usepackage[leqno]{amsmath} \renewcommand\theequation{\alph{equation}} \newenvironment{brqalign}{% % START CODE %%%%%%%%%%%% % Do everything an a box, as you can not remove % things from the main vertical list. \setbox0\vbox\...

29

There is a tool named Rubber. It is for instance used by Gedit LaTeX plugin. It should recognize which tools to run (BibTeX, makeindex...) and run (pdf)latex and them in right order and how many times it is needed to converge to the ready file. It behaves like make, i.e. it does not recreate files that it thinks won't change recompiled (this can be omitted ...

29

Here's an attempt in Metapost. Using the direction x of y macro to find the required angle of reflection. Here's what you get with r=0: And with r=0.33: prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); path base, ray[]; u = 5mm; r=0.33; base = (-6u,0) for x=-5.8u step 0.2u until 5.8u: -- (x,r*normaldeviate) endfor -- (6u,0); draw ...

28

For Git and Mercurial the only packaged option for writing revision information to the output document is the vc-bundle, which works without keyword substitution by writing to an \input’ed file. For rendering a diff document a commit hook could be used that calls latexdiff-vc. Just inspecting diffs word-based instead of line based can be done with wdiff, or ...

28

Not much of an answer, more a couple of loose thoughts ... Off-hand I'm not aware of any such system and also not aware of any research that deals with automatic newspaper layout. As far as I know there has been only very very limited attempts to approach the subject of automatic typesetting with more complex layout rules and dependencies that go beyond ...

26

You can modify the texmf.cnf variables error_line and max_print_line, adding to the "local" texmf.cnf file, whose location depends on the distribution you're using; for TeX Live it is /usr/local/texlive/2011/texmf.cnf and the lines to be added are max_print_line=1000 error_line=254 half_error_line=238 The first number is actually arbitrary, but 1000 ...

25

Have the target in your Makefile clobber a file that is \input by your Latex document, which, say, sets or resets a \newif conditional. For example, let the Makefile run echo "\handouttrue">flags.tex; latex manuscript on the handout goal. Then manuscript.tex might begin: \newif\handout \input{flags} \documentclass...

25

Update After new requirement in comments, now theres just one environment coolbox with a mandatory argument (the file image to be used) and two optional ones: \begin{coolbox}[<options for the box>]{<image-file>}[<options for the image>] (contents) \end{coolbox} The code: \documentclass[12pt]{article} \usepackage[many]{tcolorbox} \...

24

The ability to define complex macros is one of the strengths of LaTeX. The traditional LaTeX way would be to use \p{x}{y} in the text instead of \p(x)(y). If you are happy with \p{x}{y}, then you can just add \newcommand{\p}[2]{\frac{\partial#1}{\partial#2}} to your preamble. Since this new macro is requires mathmode, you may also want to wrap the macro ...

24

It has always been a possibility although obviously the document markup side of latex is mostly aimed at hand authored documents, but even back while 2e was being developed there were wysiwyg systems like sw that are essentially generating latex that isn't touched and latex is often used for typesetting from XML (or previously SGML) using xslt or dsssl or ...

24

\documentclass[border=2pt]{standalone} \usepackage{tikz,xcolor} \usetikzlibrary{calc} \definecolor{skyblue}{HTML}{B9E1FD} \begin{document} \begin{tikzpicture}[line width=.7pt, inner sep=7pt] \node [draw,rounded corners,dashed,fill=skyblue,text width=.6\textwidth] (B){% \bfseries Did you know? \par \bigskip Once upon a time there ...

23

Scons seems to be the ultimate LaTeX building tool. Let me elaborate on Karsten W.'s answer on the configuration file. A typical build script for building LaTeX can be the following. Put this in a file called SConstruct: # make sure scons finds tex executables: import os env = Environment(ENV=os.environ) # target and source: pdf_output = env.PDF(target='...

23

How about using a chunk with <<results=tex, echo=FALSE>>=? It will allow you to: (a) paste together the LaTeX code you'd like to run (i.e. 200 \begin{frame} ... \includegraphics ... \end{frame} constructs); and (b) place that constructed text verbatim in the *.tex file produced by Sweave(). For more details, see here. It's a FAQ! <<...

Only top voted, non community-wiki answers of a minimum length are eligible