Commands tagged latex (9)

  • This is an example of the usage of pdfnup (you can find it in the 'pdfjam' package). With this command you can save ink/toner and paper (and thus trees!) when you print a pdf. This tools are very configurable, and you can make also 2x2, 3x2, 2x3 layouts, and more (the limit is your fantasy and the resolution of the printer :-) You must have installed pdfjam, pdflatex, and the LaTeX pdfpages package in your box. Show Sample Output


    3
    pdfnup --nup 2x1 --frame true --landscape --outfile output.pdf input.pdf
    TetsuyO · 2010-12-21 14:20:06 5
  • If the pdf/dvi/etc documentation for a latex package is already part of your local texmf tree, then texdoc will find and display it for you. If the documentation is not available on your system, it will bring up the package's webpage at CTAN to help you investigate. Show Sample Output


    2
    texdoc packagename
    bwoodacre · 2010-05-23 20:02:32 7

  • 1
    grep -R usepackage * | cut -d']' -f2 | cut -s -d'{' -f 2 | sed s/"}"/.sty"}"/g | cut -d'}' -f1 | sort | uniq | xargs dpkg -S | cut -d':' -f1 | sort | uniq
    prayer · 2010-05-22 19:37:26 4

  • 1
    dwdiff -c a.tex b.tex | less -R
    fubunny · 2011-07-27 15:24:35 4
  • It is often recommended to enclose capital letters in a BibTeX file in braces, so the letters will not be transformed to lower case, when imported from LaTeX. This is an attempt to apply this rule to a BibTeX database file. DO NOT USE sed '...' input.bib > input.bib as it will empty the file! How it works: /^\s*[^@%]/ Apply the search-and-replace rule to lines that start (^) with zero or more white spaces (\s*), followed by any character ([...]) that is *NOT* a "@" or a "%" (^@%). s=<some stuff>=<other stuff>=g Search (s) for some stuff and replace by other stuff. Do that globally (g) for all matches in each processed line. \([A-Z][A-Z]*\)\([^}A-Z]\|},$\) Matches at least one uppercase letter ([A-Z][A-Z]*) followed by a character that is EITHER not "}" and not a capital letter ([^}A-Z]) OR (|) it actually IS a "}", which is followed by "," at the end of the line ($). Putting regular expressions in escaped parentheses (\( and \), respectively) allows to dereference the matched string later. {\1}\2 Replace the matched string by "{", followed by part 1 of the matched string (\1), followed by "}", followed by the second part of the matched string (\2). I tried this with GNU sed, only, version 4.2.1. Show Sample Output


    1
    sed '/^\s*[^@%]/s=\([A-Z][A-Z]*\)\([^}A-Z]\|},$\)={\1}\2=g' literature.bib > output.bib
    michelsberg · 2013-01-15 22:24:17 10
  • LaTeX is not a smart compiler - You need to run it several times to make it back-patch all the missing refs. The message if to do so or not is buried in its endless output and the log file. This grep lines helps to find it.


    0
    egrep "(There were undefined references|Rerun to get (cross-references|the bars) right)" texfile.log
    gwiener · 2009-07-07 06:48:03 6
  • kpsewhich is a tool for path and file lookup. It is a front-end of the kpathsea library. For one or more given package or file names it returns the complete path from within the TeX installation, that one which the compiler would actually use. Via backticks we can use it as argument to less, more, or any editor. For example: gedit `kpsewhich hyperref.sty` Show Sample Output


    0
    less `kpsewhich scrartcl.cls`
    Stefan · 2012-04-15 11:10:41 3
  • Uses zsh globbing syntax to safely remove all the files known to be generated by LaTeX, but only if there is actually a .tex source file with the same basename present. So we don't accidentally delete a .nav .log or .out file that has nothing to do with LaTeX, e/'[[ -f ${REPLY:r}.tex ]]'/ actually checks for the existance of a .tex file of the same name, beforehand. A different way to do this, would be to glob all *.tex files and generate a globbing pattern from them: TEXTEMPFILES=(*.tex(.N:s/%tex/'(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(.N)'/)) ; rm -v ${~TEXTEMPFILES} or, you could use purge() from grml-etc-core ( http://github.com/grml/grml-etc-core/blob/master/usr_share_grml/zsh/functions/purge )


    0
    rm -v *.(log|toc|aux|nav|snm|out|tex.backup|bbl|blg|bib.backup|vrb|lof|lot|hd|idx)(.e/'[[ -f ${REPLY:r}.tex ]]'/)
    xro · 2012-09-18 20:49:28 8
  • List all font names installed in the system. Useful for TeX. Show Sample Output


    0
    fc-list | cut -d':' -f2 | sort -u
    smarx · 2015-12-29 12:23:11 11

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Quickly re-execute a recent command in bash
! will expand to the last time you ran , options and all. It's a nicer alternative to ^R for simple cases, and it's quite helpful for those long commands you run every now and then and haven't made aliases or functions for. It's similar to command 3966, in some sense.

Look for English words in /dev/urandom
* to get the English dictionary: wget http://www.mavi1.org/web_security/wordlists/webster-dictionary.txt

HTTP GET request on wireshark remotly

Find out if a module is installed in perl
Shows the path if the module is installed or exit quietly (to simply avoid the 'No documentation found' msg).

diff the same file in two directories.
This is useful when you're diffing two files of the same name in radically different directory trees. For example: Set $ path1='/some/long/convoluted/path/to/all/of/your/source/from/a/long/dead/machine' then $ path2='/local/version/of/same/file' then run the command. Much easier on the eyes when you're looking back across your command history, especially if you're doing the same diff over and over again.

connects to db2 database instance/alias "stgndv2" user "pmserver" using password "xxxxxxx"
db2 => ? connect CONNECT [USER username [{USING password [NEW new-password CONFIRM confirm-password] | CHANGE PASSWORD}]] CONNECT RESET CONNECT TO database-alias [IN {SHARE MODE | EXCLUSIVE MODE [ON SINGLE DBPARTITIONNUM]}] [USER username [{USING password [NEW new-password CONFIRM confirm-password] | CHANGE PASSWORD}]]

blktrace - generate traces of the i/o traffic on block devices
blktrace is a block layer IO tracing mechanism which provide detailed information about request queue operations up to user space. blkparse will combine streams of events for various devices on various CPUs, and produce a formatted output the the event information. It take the output of above tool blktrace and convert those information into fency readable form.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Multiple variable assignments from command output in BASH
No command substitution but subshell redirection

files and directories in the last 1 hour
added alias in ~/.bashrc alias lf='find ./* -ctime -1 | xargs ls -ltr --color'


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: