-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.html
More file actions
935 lines (758 loc) · 22.2 KB
/
notes.html
File metadata and controls
935 lines (758 loc) · 22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>
Notes
</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>
Notes
</h1>
<img src="banners/run.png" alt=run >
<h2>
LaTeX
</h2>
<h3>
How to use cleveref and amsthm in such a way that it works.
</h3>
<p>
It took me a long time to find out how to use cleveref and amsthm together.
If you have <tt>texdoc</tt> installed, you can find pretty much the same info
in the documentation for <tt>cleveref</tt>. First off, you'll need the package
<tt>aliascnt</tt>. Then you use an alias for the <tt>thm</tt> counter (or
whatever you're using). An example follows:
<pre>
\usepackage{amsthm}
\usepackage{aliascnt}
\usepackage{cleveref}
\newtheorem{thm}{Theorem}[section]
\crefname{thm}{theorem}{theorems}
\Crefname{thm}{Theorem}{Theorems}
\newaliascnt{lemma}{thm}
\newtheorem{lemma}[lemma]{Lemma}
\aliascntresetthe{lemma}
\newaliascnt{prop}{thm}
\newtheorem{prop}[prop]{Proposition}
\aliascntresetthe{prop}
\crefname{prop}{proposition}{propositions}
\Crefname{prop}{Proposition}{Propositions}
</pre>
To test the thing out, try it with this.
<pre>
\begin{thm} \label{1}
A very important statement.
\end{thm}
\begin{lemma} \label{2}
A less important statement.
\end{lemma}
\begin{prop} \label{3}
$1=0$.
\end{prop}
\cref{1} \Cref{1}\\
\cref{2} \Cref{2}\\
\cref{3} \Cref{3}
</pre>
</p>
<h3>
How to use xfig in such a way that it works for both dvi and pdf.
</h3>
<p>
Here, I explain how to incorporate pictures created using
<a href="http://xfig.org/"><tt>xfig</tt></a>
into a LaTeX document. More instructions can be found
<a href="http://www.xfig.org/userman/latex_and_xfig.html">here</a>.
</p>
<p>
If you want both pdf and dvi coming from the same document, then the packages
<tt>ifpdf</tt> and <tt>ifthen</tt> are pretty useful:
<pre>
\usepackage{ifpdf}
\usepackage{ifthen}
</pre>
Next you'll need some graphic packages:
<pre>
\ifpdf
\usepackage[pdftex]{graphicx,color}
\else
\usepackage{graphicx}
\fi
</pre>
Now, draw your favorite graph of whatever using xfig and export as
<tt>Combined PS/LaTeX (both parts)</tt> as well as
<tt>Combined PDF/LaTeX (both parts)</tt>. This produces a bunch of files, all
of which are best kept in the folder containing the .tex document (or wherever
else you prefer). Now you can define a handy command
<pre>
\newcommand{\mynd}[4]
{
\begin{figure}[#2]
\begin{center}
\ifpdf
\input{#1.pdf_t}
\else
\input{#1.pstex_t}
\fi
\ifthenelse{\equal{#3}{}}
{
}
{
\caption{#3\label{#4}}
}
\end{center}
\end{figure}
}
</pre>
This way, you can import a picture into a latex document which works for
both latex and pdflatex. It takes four arguments, these are: <tt>#1</tt>
the name
of the xfig file with no extension; <tt>#2</tt> any of the letters
<tt>h</tt>, <tt>t</tt>, <tt>b</tt>, etc
for your preference of setting the picture here, top, bottom, etc;
<tt>#3</tt>
the caption of the figure—if left empty there will be no caption and
no label; <tt>#4</tt> the label identifying the picture.
For correct configuration of <tt>xfig</tt>, see section below.
</p>
<p>
To automate the task of exporting the files as above, make sure that
<a href="http://www.xfig.org/"><tt>transfig</tt></a> is properly installed
(this provides <tt>fig2dev</tt>) and
keep the following script handy.
<pre>
for i in *.fig
do
j=`echo $i | sed s/.fig$//`
if [ -e $j.pstex_t ]
then
echo "Overwriting $j.pstex_t"
else
echo "Creating $j.pstex_t"
fi
echo "\begin{picture}(0,0)%" > $j.pstex_t
echo "\includegraphics{$j.pstex}%" >> $j.pstex_t
echo "\end{picture}%" >> $j.pstex_t
fig2dev -L pstex_t $j.fig >> $j.pstex_t
if [ -e $j.pdf_t ]
then
echo "Overwriting $j.pdf_t"
else
echo "Creating $j.pdf_t"
fi
echo "\begin{picture}(0,0)%" > $j.pdf_t
echo "\includegraphics{$j.pdf}%" >> $j.pdf_t
echo "\end{picture}%" >> $j.pdf_t
fig2dev -L pstex_t $j.fig >> $j.pdf_t
if [ -e $j.pstex ]
then
echo "Overwriting $j.pstex"
else
echo "Creating $j.pstex"
fi
fig2dev -L pstex $j.fig > $j.pstex
if [ -e $j.pdf ]
then
echo "Overwriting $j.pdf"
else
echo "Creating $j.pdf"
fi
fig2dev -L pdftex $j.fig > $j.pdf
done
</pre>
</p>
<p>
It can also happen that this stuff doesn't compile
into <tt>dvi</tt> if some text has some color. Typically, the text
has color 'black', and manually changing everything to
the color 'default' makes it work. However, this is a super boring
way of solving a problem, when the following command will do the job:
<pre>
for i in *.pstex_t; do cat $i | sed s/.color.rgb..0,0,0.// > $i.old; mv $i.old $i; done
</pre>
</p>
<h3>
Lists and indentation
</h3>
<p>
The following defines an environment for lists where the numbers and
the content all line up nicely with the rest of the material. This is
especially convenient to list out examples or remarks, where each element
of the list is typically a full paragraph, rather than just a word or two.
<pre>
\newenvironment{blist}
{
\begin{list}{(\thedummy)}
{
\setlength\labelsep{4pt}
\setlength\itemindent{4pt}
\setlength\leftmargin{0pt}
\setlength\labelwidth{0pt}
\setlength\parsep{0pt}
\usecounter{dummy}
}
}
{
\end{list}
}
</pre>
The number <tt>4</tt> here can be adjusted, but to me it seems to produce
reasonable space.
With the above code in the preamble, you can now create a nice list like
this:
<pre>
\begin{blist}
\item
The first example is about something.
\item
The second remark is quite important.
\end{blist}
</pre>
For further info, see e.g. 3.4.4 of The LaTeX Companion, Second Edition.
</p>
<h3>
Ending a proof in displaymath
</h3>
<p>
If you end a proof with a formula in displaymath, then the qed symbol will
go to the right in a new line after the formula, which creates a big ugly
white empty space in your document. And if you just put a \qedhere inside
displaymath, then the qed symbol will not get pushed to the right. What to
do, right?
Fortunately, some good person at
<a href="https://tex.stackexchange.com/questions/66152/pushing-qed-to-the-right-within-a-displayed-formula">stackexchange</a>
gave a solution to this. I don't know how this works, or what's happening
in this black box (pun intended),
but the outcome is all that matters.
<pre>
\[
\pushQED{\qed}
\fa{\gamma\in\partial\triangle^{(1)}}
{\wt_\gamma g \geq m_\gamma + 1}.
\qedhere
\popQED
\]
</pre>
</p>
<h3>
Change heading of references
</h3>
Add the line
<pre>
\renewcommand*{\refname}{}
</pre>
to the preamble to get rid of the title of the bibliography, which
defaults to <b>References</b>. Alternatively, you can put in whatever
you want there. This is useful, for e.g. a list of publication, where
you just want to print the list of references.
<h2>
Vim
</h2>
<h3>
Some macros
</h3>
<p>
I keep a macro in the <tt>l</tt> register for compiling latex
documents. This requires latexmk. For this, execute
<pre>
let @l=":w\n:!if echo % | grep tex; then latexmk -pdf --synctex=1 %; fi\n"
</pre>
or, if you're using (<tt>t</tt>)<tt>csh</tt>,
<pre>
let @l=":w\n:!if ( % =~ *.tex) latexmk %\n"
</pre>
This one I keep in <tt>@e</tt> to toggle spelling.
<pre>
let @e=":set spell! spelllang=en\n"
</pre>
It is also useful to toggle <tt>autoindent</tt> as follows:
<pre>
let @i=":set invautoindent\n:set autoindent?\n"
</pre>
</p>
<h3>
Colors
</h3>
<p>
So far, I like the color scheme
<a href="https://github.com/tpope/vim-vividchalk">vividchalk</a>.
For this to work, copy the file <tt>vividchalk.vim</tt> to
<tt>~/.vim/colors/</tt> and add the lines
<pre>
syntax enable
colorscheme vividchalk
</pre>
to your <tt>.vimrc</tt>. Don't forget to use a
<a href="http://terminus-font.sourceforge.net/">slick font</a>.
</p>
<h3>
Looking for nonascii characters
</h3>
<p>
To search for any nonascii character, just use
<pre>
/[^\x00-\x7F]
</pre>
as suggested
by
<a href="http://stackoverflow.com/questions/16987362/how-to-get-vim-to-highlight-non-ascii-characters">this</a>
stackowerflow post.
</p>
<h3>
Search and replace with multiples
</h3>
<p>
The following command replaces any integer with its multiple with four.
<pre>
:s/\d\+/\=submatch(0)*4/g
</pre>
The expression <tt>\d\+</tt> matches any string of digits. In the second
part, the
<a href="http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replace-expression"><tt>\=</tt></a>
indicates that the string is an expression which should
be interpreted. The <tt>submatch(0)</tt> gives the matched
pattern, in our case a string of digits. This
is then quadrupled by <tt>*4</tt>. If you need to multiply numbers inside
some pattern, you can flag the number and use <tt>submatch(n)</tt>, where
the number is the nth flagged part. As an example, running
<pre>
:s/\(\d\+\) monkey[s]*/\=submatch(1)*4 . " monkeys "/g
</pre>
will turn the string
<pre>
1 monkey and 4 cats and another 8 monkeys
</pre>
into
<pre>
4 monkeys and 4 cats and another 32 monkeys
</pre>
</p>
<h3>
Autocompletion
</h3>
<p>
I didn't sign up for an account at <tt>superuser.com</tt> just to upvote
the very helpful answer to
<a href="http://superuser.com/questions/40378/how-to-make-vims-auto-complete-behave-like-bashs-default-auto-complete">this</a>
post, but <tt>user138727</tt> sure did. Put
<pre>
set wildmode=list:longest
</pre>
into your <tt>.vimrc</tt>, and vim will from now on do autocompletion
the right way.
</p>
<h3>
Tabs
</h3>
If you don't like tabs, use
<pre>
set expandtab
set tabstop=4
</pre>
<h3>
Merging lines of a paragraph
</h3>
<p>
The command
<pre>
:%g/./.,/^$/-j
</pre>
merges the lines of each paragraph into a single line. This assumes that
paragraphs are separated by empty lines.
</p>
<h3>
Latex-Suite
</h3>
The <a href="http://vim-latex.sourceforge.net">Latex-Suite</a> comes
with some pretty neat tools, in particular, sensible folding rules.
I don't like their macros, though, so keep this line in your
<tt>.vimrc</tt>
<pre>
let g:Imap_FreezeImap=1
</pre>
Also, the following is good
<pre>
let g:Tex_FoldedEnvironments="verbatim,comment,eq,gather,align,figure,table,
\thebibliography,keywords,abstract,titlepage,lemma,definition,def,thm,
\theorem,prop,block,rem,proof"
</pre>
Thanks go to
<a href="http://stackoverflow.com/questions/8006117/wrap-long-lines-in-vimrc">
Stackoverflow</a> for educating the populus on how to continue new lines
in vim scripts.
Apparently, one must also include these
<pre>
filetype plugin on
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
</pre>
<h3>
Automatically set <tt>tw</tt> for composing email in <tt>mutt</tt>.
</h3>
<p>
Add the following line to <tt>.vimrc</tt> to set the text width to 72,
whenever editing an email (change the directory and format according
to your system)
<pre>
au BufRead /tmp/mutt-* set tw=72
</pre>
This gem, like so many others, was found on the
<a href="https://wiki.archlinux.org/index.php/Mutt#vim">
Arch Linux wiki</a>.
</p>
<h2>
.Xdefaults / .Xresources
</h2>
<h3>
XDvi
</h3>
<p>
Some of these parameters should obviously be adjusted to the dimensions
of your screen.
<pre>
XDvi*expertMode: 0
XDvi*noInitFile: 1
XDvi*highlight: black
XDvi*foreground: black
XDvi*geometry: 1023x1080
XDvi*shrinkFactor: 5
XDvi*topMargin: 5cm
XDvi.mainTranslations: #override \
<Key>G: goto-page(1) \n \
<Key>.: forward-page() \n \
",": back-page() \n \
<Key>j: down(0.015) \n \
<Key>k: up(0.015) \n \
<Key>h: left(0.015) \n \
<Key>l: right(0.015) \n \
<Key>i: set-shrink-factor(+) \n \
<Key>u: set-shrink-factor(-) \n \
</pre>
</p>
<h3>
XFig
</h3>
<p>
If you don't put in these options, an error will come your way. The
<tt>special</tt> flag is important if you want text to be interpreted
as LaTeX code. In this case, remember to export everything to
<tt>Combined PS/LaTeX (both parts)</tt> for <tt>dvi</tt> output and
<tt>Combined PDF/LaTeX (both parts)</tt> for <tt>pdf</tt> output.
Better yet, use the script above to automate this.
<pre>
Fig.latexfonts: true
Fig.specialtext: true
Fig.inches: false
Fig.startgridmode: 1
Fig.startposnmode: 1
Fig.zoom: 3.0
</pre>
I always have to say explicitly that the color of text should be
<tt>default</tt> rather than <tt>black</tt>. Otherwise the
LaTeX compiler spits out an error and halts.
If you find a way to do this automatically, please let me know.
</p>
<h3>
XDaliClock
</h3>
<p>
For optimal desktop clock experience, use <tt>xdaliclock</tt>
with the following parameters:
<pre>
XDaliClock.mode: 24
XDaliClock.seconds: false
XDaliClock.cycle: false
XDaliClock.transparent: true
</pre>
If you're using <tt>evilwm</tt>, use the command line parameters
<tt>-app xdaliclock/XDaliClock -g 444x162+a+b</tt>, where
<tt>a,b</tt> is your favorite position on the desktop for a clock.
</p>
<h2>
Miscellaneous
</h2>
<h3>
Fonts
</h3>
<p>
Say you have a directory <tt>/full/path/to/dir/</tt> full of your favorite
fonts. How can you use them in your favorite applications?
Use the program
<a href="http://www.x.org/archive/X11R7.5/doc/man/man1/mkfontdir.1.html">
<tt>mkfontdir</tt></a> to create a file <tt>fonts.dir</tt>. Then use
<a href="http://www.x.org/archive/X11R7.5/doc/man/man1/xset.1.html">
<tt>xset</tt></a> to tell the system to use this directory. In short,
<pre>
cd /full/path/to/dir/
mkfontdir
xset +fp /full/path/to/dir/
</pre>
The last of these commands must be repeated every time you log in using
<tt>xdm</tt>, <tt>startx</tt> or <tt>xinit</tt> or something like that.
Therefore, it is good to add it to <tt>.xsession</tt> if you use
<tt>xdm</tt> or <tt>startx</tt>, or to
or <tt>.xinitrc</tt> if you use <tt>xinit</tt>.
An excellent font for the command line is
<a href="http://terminus-font.sourceforge.net/"><tt>terminus</tt></a>.
</p>
<h3>
Bash
</h3>
<p>
If you don't want bash to spam you with advertisements for packages when
you mistype a command, put this into your <tt>.bashrc</tt>.
<pre>
command_not_found_handle() {
printf "%s: command not found\n" "$1" >&2
return 127
}
</pre>
</p>
<h3>
Mutt
</h3>
<p>
<a href="http://www.mutt.org">Mutt</a> is the best email client in the world.
Its only downside is that its
<a href="http://www.mutt.org/doc/manual/">documentation</a>—excellent
as it may be—is something of a jungle. To make things simpler for
anyone interested in starting using this great program, I have made my
configuration files publicly available
<a href="https://bitbucket.org/baldursigurds/muttrc">here</a>.
To get started, just follow the instructions in the <tt>README</tt>.
</p>
<p>
Don't forget to install
<a href="http://abook.sourceforge.net/">abook</a>. It should be available
in most package systems and works pretty much out of the box.
</p>
<p>
If you're interested in using encryption, have a look at
<a href="http://codesorcery.net/old/mutt/mutt-gnupg-howto">these
instructions</a>. The text may look daunting at first, but it is very much
to the point and gives a practical guide to
<a href="https://gnupg.org/">GnuPG</a>, with emphasis on mutt.
The file <tt>crypto</tt> from the above git repository has pretty much
been copied directly from this manual.
</p>
<p>
To open <tt>html</tt> emails, add the following lines to your
<tt>.mailcap</tt>
<pre>
text/html; firefox %s &; test=test -n "$DISPLAY"; needsterminal;
text/html; w3m -I %{charset} -T text/html; copiousoutput;
</pre>
Also, make sure to have <tt>w3m</tt> installed. This way, the hypertext
will appear formatted in the pager, and you can also view it in firefox
by pressing <tt>v</tt> and selecting the file. I found these lines at
<a href="http://jasonwryan.com/blog/2012/05/12/mutt/">
http://jasonwryan.com/blog/2012/05/12/mutt/</a>
and modified them to use firefox.
</p>
<p>
*Shameless plug*—if a text based interface to email is not your
cup of
tea, then check out <a href="https://www.mailpile.is/">mailpile</a>.
It's an effort to make encrypted email easy and appealing, rather than
having to jump through
<a href="http://www.mutt.org/doc/manual/">hoops</a>
like a dog. Keep in mind, though, that mailpile is still in beta stage.
</p>
<h3>
Synctex with vim and zathura
</h3>
<p>
Synctex is a pretty cool thing. There seem to be a lot of super complicated
explanations online on how to get it to work with <tt>vim</tt> and
<tt>zathura</tt>. The <tt>latex-suite</tt> even gets dragged into the whole
business. Here is a simple setup which allows you to do forward search.
I'll update this once I figure out how to do backwards search in a simple way.
<p>
</p>
Assume that you have a document <tt>proj.tex</tt>. First step is to compile
it, producing a <tt>.pdf</tt> file and a <tt>.synctex.gz</tt> file. This
is achieved by running
<pre>
latexmk -pdf --synctex=1 proj.tex
</pre>
in the directory containing the source file. Above, you can find a macro
which automates this from <tt>vim</tt>.
Open the <tt>.pdf</tt> document by running
<pre>
zathura proj.pdf
</pre>
as usual. To make the viewer go to the place corresponding to line 500
in the source code, all you need to do is run
<pre>
zathura proj.pdf --synctex-forward=500:1:proj.tex
</pre>
To wrap the whole thing up into a neat macro, keep the following
in your <tt>.vimrc</tt>
<pre>
let @f=":exe \"!zathura `echo % | sed s/tex$/pdf/` --synctex-forward=\"
\ . line(\".\") . \":\" . col(\".\") . \":\" . \"%\"\n\n"
</pre>
</p>
<h3>
Printing text
</h3>
<p>
In order to print a unicode text file, it's not good just to feed it to
the printer. Better use <tt>paps</tt>, a small program which outputs a
perfectly usable Postscript document, which then can be sent to the printer.
</p>
<h2>
Dotfiles
</h2>
<h3>
Abook
</h3>
<p>
Here is my <tt>~/.abook/abookrc</tt>
<pre>
set index_format=" {name:39} {email:39} "
set show_all_emails=true
set sort_field=Name
</pre>
</p>
<h3>
Zathura
</h3>
<p>
<a href="https://pwmt.org/projects/zathura/">Zathura</a> is a choice
application for viewing <tt>pdf</tt> and <tt>djvu</tt> documents.
What follows is my configuration file, found in
<tt>~/.config/zathura/zathurarc</tt>
<pre>
set font "Terminus normal 8"
set inputbar-bg black
set inputbar-fg white
set first-page-column 2
set guioptions ""
map . navigate next
map , navigate previous
map C-u navigate half-up
map C-d navigate half-down
map C-e navigate up
map C-y navigate down
map i zoom in
map u zoom out
</pre>
The binding of <tt>.</tt> and <tt>,</tt> is inspired by the default
bindings of the nice pdf viewer
<a href="http://mupdf.com/"><tt>mupdf</tt></a>.
</p>
<h3>
Music On Console
</h3>
<p>
The best music player is
<a href="http://moc.daper.net/">music on cosole</a>.
The configuration file for <tt>mocp</tt> is usually
<tt>~/.moc/config</tt>. For me, this looks like
<pre>
Theme = moca_theme_ed
Keymap = keymap
Layout1 = directory(0,0,100%,100%):playlist(0,0,100%,100%)
Layout2 = directory(0,0,50%,100%):playlist(50%,0,FILL,100%)
</pre>
The first line selects a theme. I made small modifications to the theme
<tt>moca_theme</tt> which I keep in <tt>~/.moc/themes/moca_theme_ed</tt>
and reads
<pre>
background = white black
frame = white black
window_title = yellow black bold
directory = white black
selected_directory = yellow black bold
playlist = white black
selected_playlist = yellow black bold
file = white black
selected_file = yellow black bold
marked_file = green black bold
marked_selected_file = green black bold
info = magenta black bold
selected_info = yellow black bold
marked_info = green black bold
marked_selected_info = yellow black bold
status = red black bold
title = yellow black bold
state = red black bold
current_time = magenta black bold
time_left = green black bold
total_time = magenta black bold
time_total_frames = magenta black bold
sound_parameters = white black bold
legend = white black
disabled = red black bold
enabled = green black bold
empty_mixer_bar = green magenta
filled_mixer_bar = magenta green
empty_time_bar = green magenta
filled_time_bar = magenta green
entry = white black
entry_title = magenta black bold
error = red black bold
message = green black bold
plist_time = red black bold
</pre>
Note the options <tt>selected_info</tt>, <tt>marked_info</tt> and
<tt>marked_selected_info</tt> which seem to be missing from many of the
themes provided with the program.
The second line instructs <tt>mocp</tt> to read the file
<tt>~/.moc/keymap</tt> and use the keybindings there. For me, this reads
simply as as
<pre>
menu_down += j
menu_up += k
</pre>
The last two lines switch the two default layouts, as I prefer to just
use the file browser.
</p>
<h3>
ncmpcpp bindings
</h3>
<a href="http://rybczak.net/ncmpcpp/">ncmpcpp</a> has a nice interface,
but with the default setup, nothing happens if you press the spacebar
or the vi navigation keys. This flaw can be remedied by setting up
a file <tt>.ncmpcpp/bindings</tt> with the following content:
<pre>
def_key "j"
scroll_down
def_key "k"
scroll_up
def_key "h"
volume_down
def_key "l"
volume_up
def_key "space"
pause
</pre>
<h3>
Sagemath
</h3>
<p>
If you're using a dark terminal, then use the following line
<pre>
%colors Linux
</pre>
in the file
<tt>$DOT_SAGE/ipython-X.Y.Z/profile_default/startup/50-color.ipy</tt>.
This tip, and more, can be found
<a href="https://wiki.sagemath.org/Tips">
here</a>.<br />
Or add it to <tt>~/.sage/init.sage</tt>.
</p>
<h3>
GP/PARI
</h3>
<p>
It is convenient to keep the following in <tt>.gprc</tt>, if you use
a dark background for your terminal:
<pre>
colors = "darkbg"
</pre>
</p>
</body>
</html>