Tag Info

Hot answers tagged

74

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


46

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: ...


43

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 ...


39

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.


37

You can use the following tools to do this. All of them are on CTAN but are not part of either TeXLive nor MikTeX, so you 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. latexpand Perl ...


33

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 ...


31

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 ...


29

Please note: the solution below, which was work in progress at the time of writing, is now officially available in PGF/TikZ 2.10. The usage as sampled below is fully included in the official manual starting from v2.10. Thus, you can ignore the part about checking out the development version and apply this solution directly. One answer to this question is ...


28

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 ...


28

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}% ...


27

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 ...


27

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 ...


26

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 ...


26

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 ...


25

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 ...


25

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. ...


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

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 ) { ...


23

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 ...


23

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 ...


22

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 ...


21

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! ...


21

A package? The following simple macro does it: \documentclass{article} \newcount\smcount \def\smart#1{\ifcase\smcount(\or[\or\{\else TOO DEEP!\fi% \advance\smcount by1 #1\ifcase\smcount\or)\or]\or\}\else TOO DEEP!\fi% \advance\smcount by-1 } \begin{document} \smart{Ala \smart{ma \smart {kota}}} \end{document} (Or, if you wish, not \smart but ...


21

See the needspace package. It might do what you need, or at least give inspiration for whatever it is you're trying to do :-) Namely, the \pagegoal and \pagetotal registers should help.


20

I have the following function in my $VIM/ftplugin/context.vim file to format ConTeXt paragraphs (same as LaTeX: the environments are enclosed in \start... and \stop... instead of \begin{...} and \end{...}. It should be easy to adapt this to LaTeX (In fact, I think that I copied it originally from someone who had written it for LaTeX and adapted it to ...


20

\documentclass{article} \usepackage{amsmath} \newcommand\p[2]{\frac{\partial #1}{\partial #2}} \begin{document} $ \p{x}{y} $ \end{document}


19

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 ...


19

Using \refstepcounter instead of \addtocounter{...}{1} will make \ref work: \newcounter{cnstcnt} \newcommand{\newconstant}{% \refstepcounter{cnstcnt}% \ensuremath{c_\thecnstcnt}} \newcommand{\oldconstant}[1]{\ensuremath{c_{\ref{#1}}}} \begin{document} \newconstant\label{first} \oldconstant{first} \end{document}


19

For comparison I am posting a ConTeXt solution. Such a macro already exists, albeit for quotes. One of the good things about ConTeXt is that a feature is never defined in a one-off basis. For example, instead of defining a macro for quotations that changes the quote symbol depending on the level of nesting, ConTeXt defines a generic delimitedtext mechanism ...


19

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 ...



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