Bus errorとSegmentation faultに困ったら見るブログ

物理学者(ポスドク)による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【Gnuplot】pm3dの色合いを変えたい

(2011/05/20 元記事)

 

けっこう前にpm3dの使い方をまとめた

デフォルトだと色合いはこんな感じ

 

これを変えてみたい

まずはgnuplotを起動して

 

help set palette rgbformulae

 

と打ってみる。次のような説明が出てくる。

 

%help set palette rgbformulae
For `rgbformulae` three suitable mapping functions have
to be chosen. This is done via `rgbformulae <r>,<g>,<b>`. The available
mapping functions are listed by `show palette rgbformulae`. Default is
`7,5,15`, some other examples are `3,11,6`, `21,23,3` or `3,23,21`. Negative
numbers, like `3,-11,-6`, mean inverted color (i.e. 1-gray passed into the
formula, see also `positive` and `negative` options below).

Some nice schemes in RGB color space
7,5,15 ... traditional pm3d (black-blue-red-yellow)
3,11,6 ... green-red-violet
23,28,3 ... ocean (green-blue-white); try also all other permutations
21,22,23 ... hot (black-red-yellow-white)
30,31,32 ... color printable on gray (black-blue-violet-yellow-white)
33,13,10 ... rainbow (blue-green-yellow-red)
34,35,36 ... AFM hot (black-red-yellow-white)

A full color palette in HSV color space
3,2,2 ... red-yellow-green-cyan-blue-magenta-red

Please note that even if called `rgbformulae` the formulas might actually
determine the <H>,<S>,<V> or <X>,<Y>,<Z> or ... color components as usual.

Use `positive` and `negative` to invert the figure colors.

Note that it is possible to find a set of the best matching rgbformulae for any
other color scheme by the command
show palette fit2rgbformulae

 


要するに

set palette rgbformulae <r>,<g>,<b>

 

括弧の中には数字を入れて、上のように打ったら色合いが変化する


試しに、helpで出てきた組み合わせについてsplotしてみる

7,5,15 ... traditional pm3d (black-blue-red-yellow)

3,11,6 ... green-red-violet


23,28,3 ... ocean (green-blue-white)


21,22,23 ... hot (black-red-yellow-white)


30,31,32 ... color printable on gray (black-blue-violet-yellow-white)


33,13,10 ... rainbow (blue-green-yellow-red)


34,35,36 ... AFM hot (black-red-yellow-white)


3,2,2 ... red-yellow-green-cyan-blue-magenta-red

 


自分が使うとしたら、AFM hotかなー

もしこの設定を今後のデフォルトにしたいのなら、

set palette rgbformulae 23,24,25

と .gnuplot という設定ファイルに書いておけば大丈夫でしょう

 

 

【TeX】数式番号に章番号を付加・途中の式番号から

(2011/05/13 元記事)

 

TeXで、式番号に章番号を付加する方法は前回書きました。

しかし今回上の方法ではちょっと不足だったため付け加えることに

 

式番号に章番号に付け加えるには、次のようにします

\makeatletter
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}%式に章番号を付加
\@addtoreset{equation}{section}
\renewcommand{\thetable}{%表に章番号を付加
\makeatother


theequationというのはequationのカウンタの値
これをTeXの前の方(プリアンブル)で、上のように宣言し、章番号を付けます

 

真ん中の@から始まる行は、章をまたいだときに式番号をリセットするものです
例えば実際は↓のようになってほしいところが、

 

(2.1) -> (2.2) -> (2.3) -> (3.1) -> (3.2)

 

@から始まる行がないとequation番号はリセットしないので、

 

(2.1) -> (2.2) -> (2.3) -> (3.4) -> (3,5)

 

のようになってしまいます。

 

また、章番号 または 式番号を途中から始めたい場合は、

\setcounter{section}{5}
\setcounter{equation}{2}

 

と、renewcommandの前に書いても残念ながら機能しない・・・

 

おそらく@addtoresetがあるからだと思うが・・・
しょうがないのでsectionまたぎで途中から始めたい場合は最初の部分だけ手動で入れるしかないかもしれない


@addtoresetがなければ、章番号を途中から始めることも可能


\setcounter{section}{5}
\setcounter{equation}{2}


だと次のようになる

 

(6.6) -> (6.7) -> (7.8) -> (7.9)

 

章をまたがなければ、これで大丈夫な気がする

 

-------------

(2011/05/18 追記)

 

なんかすごい回りくどいことをしていたようで、下のように書けば(2.4)みたいな式番号を途中から始めて、sectionごとに式番号をリセットすることができる

求めている状況は

 

(1.1) -> (1.2) -> (1.3) -> section2 -> (2.1) ->(2.2) ->....

 

もしくは途中からはじめて

 

(3.2) -> (3.3) -> section4 -> (4.1) ->(4.2) ->....


\makeatletter
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}%式に章番号を付加
\@addtoreset{equation}{section}
\renewcommand{\thetable}{%表に章番号を付加
\thesection.\arabic{table}}
\@addtoreset{table}{section}
\renewcommand{\thefigure}{%図に章番号を付加
\thesection.\arabic{figure}}
\@addtoreset{figure}{section}
\makeatother


\@addtoreset{equation}{section}

この行でsectionを跨ぐと式番号をリセットする

 

また上のmakeatletterを書いた後で

\setcounter{section}{4}
\setcounter{subsubsection}{5}
\setcounter{subsection}{2}
\setcounter{equation}{2}
%\setcounter{theequation}{}
\setcounter{figure}{1}

 

とすることで、うまーいこと望んでいる状況ができる。

【TeX】参考文献にurlを使いたい

TeXで参考文献にurlをそのまま書きたいときがある。
そういうときはurl packageを用いると楽。

 

\usepackage{url}

 

%参考文献内で
\url{http://www.hogeeeeee}

 

ここまでは順調

 

例えば次のような場合

http://www.hoge/~hoge

url内に~(チルダ)があるときのためにこのパッケージを用いるのだが、自分の環境では表示されたurlをそのままアドレスバーに打っても飛んでほしいリンクに飛べない・・・

おそらくテキストコーディングとか文字の類いの問題だろうが、知識皆無につき体当たりで解決方法を探すしかない・・・orz


TeXチルダを表示する方法は次のものがある(らしい)。
普通に打つと半角スペースとして扱われ、表示されないはず

 

1. \~{}

2. \textasciitilde
3. \verb|~|

 

1と2は上手くいかなかったので(上付きチルダ?が表示された。クリックしてもリンクにも飛べず)
3を用いると、表示されるのは上付きチルダだが、作成したpdf上でリンクをクリックしたらそのままジャンプできた。

 

\url{http://www.hoge/}\verb|~|\url{hoge}

 

うーん、問題は解決したけどもっとスマートな解決方法があるのだろうか・・・

 

-----

 

(2018/11/13 追記)

texでCVを書いていて解決方法を見つけた

 

■ 参考 : Latexで~(チルダ, tilde)の入ったURLをtypesetする時

 

\tildeの代わりに\%7eを用いればいい
表示されるのは%7eだけど、クリックしてみたら~と同じ

 

 

【Mac】Finderで隠しファイルを表示させる

(2011/03/31 元記事)

使ってるMacが新しいのになったため新たに設定しなおす必要がある

 

で、今まで書いてきた記事のようなbashrcとかをコピーしたいのだが、Finderに表示されない・・・

 

あれ?

 

デフォルトでは隠しファイル(.で始まるファイル)はその名の通り隠されている

ターミナルで以下のように打てば表示されるようになる

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

 

と打てば表示されるようになる

2行目はファインダーを再起動するためのコマンド

 

-----------

 

(追記)

これが今のMacでも使えるかは不明・・・

歴史的なこととしてメモしておきます

【TeX】式や図に章節番号を付加したい

(2011/03/31 元記事)

\makeatletter
\renewcommand{\theequation}{%
\thesection.\arabic{equation}}
\@addtoreset{equation}{section}
\makeatother

とプリアンブルに入れると式番号が(1)ではなく(1.1)のように章番号が付く

こんな感じ


赤字で書いた%が実は大事らしい
これがないと( 2.1)のように変なスペースが前に空いてしまうと今わかった


よく論文についてる黄緑の枠や赤の枠(クリックしたらそこまで飛んでいくリンク)も
時間があったら付けたいなぁ〜

 

-----

ついでに表にも章番号を付加したい場合
上の3行の代わりに

\renewcommand{\thetable}{%
\thesection.\arabic{table}}
\@addtoreset{table}{section}

とすればよい。

 

【TeX】目次とかヘッダーとか付けたい

(2011/03/31 元記事)

TeX美文書を目指して日々精進しなければ・・・

 

現在TeXでちょっと長い文章を書いています
そこでいろいろと付けたいおまけが出てきたので調べてまとめておきます


目次の付け方

\documentclass{jarticle}
\begin{document}
\tableofcontents      %目次
\section{hoge}
\subsection{foo}
%略
\end{document}

 

ヘッダーを付ける

\pagestyle というのを使えばいいっぽい

使い方など現在勉強中


箇条書き

\begin{itemize}
\item hoge
\item foo
\end{itemize}


で次のようになる