Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
\documentclass{standalone}
%\usepackage{zxjatype}
%\usepackage[ipa-ex]{zxjafont}
\usepackage{fontspec}
%\setmainfont[Scale=MatchLowercase]{Linux Libertine O} % \rmfamily のフォント
%\setsansfont[Scale=MatchLowercase]{Linux Biolinum O} % \sffamily のフォント
%\setmonofont[Scale=MatchLowercase]{Inconsolata} % \ttfamily のフォント
\usepackage[mongolian]{babel}
\newfontfamily\monbai[Scale=1.4]{Mongolian Baiti}
\newfontfamily\monbais{Mongolian Baiti}
\usepackage{lmodern}
\setmainfont{Times New Roman}
%\setjamainfont[Script=CJK,Scale=0.92]{IPAMincho}
%\usepackage{bxokumacro}
%\usepackage{setspace}
%\setstretch{1.25}
%\setlength{\baselineskip}{10pt} % 行間の直接指定
\newcommand{\mn}[1]{\rotatebox[origin=c]{270}{\mbox{\monbai #1}}\,}
\newcommand{\mnpar}[2][1.75em]{\hspace{0.25em}\rotatebox[origin=c]{270}{\XeTeXupwardsmode1\parbox{#1}{\monbai #2}}\hspace{0.25em}}
%\usepackage{stringstrings}
\usepackage{readarray}
%http://www.lightstone.co.jp/latex/kb0036.htm
%Portland ……ページ自体を回転(pdf環境では微妙)
%Lscape ……内容を回転
\usepackage{calc}
\usepackage{xparse}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,fit}
\tikzstyle{abstract}=[rectangle, draw=black, rounded corners, fill=white,text centered, text=black, text width=8mm]
\tikzstyle{gkey}=[rectangle, draw=black, rounded corners, fill=gray!20,text centered, text=black, text width=8mm]
\newcommand{\mykey}[2]{%
\begin{tikzpicture} \node (Item) [abstract, rectangle split, rectangle split, rectangle split parts=2]%
{#1 \nodepart{second}#2};%
\end{tikzpicture}}
%\scriptsize{
\tikzset{
pics/vhsplit/.style n args = {4}{
code = {
%\node[inner sep=1mm,text width=4mm,text height=4mm,align=center] (A) at (0,0) {#1};
\node[anchor=west] (A) at (-3mm,-0.5mm) {#1};
%\node[inner sep=1mm,anchor=north,text width=4mm,text height=4mm,align=center] (B) at (A.south) {#2};
%\node[inner sep=1mm,anchor=south west,text width=4mm,text height=4mm,align=center] (C) at (A.south east) {#3};
%\node[inner sep=1mm,anchor=north west,text width=4mm,text height=4mm,align=center] (D) at (A.south east) {#4};
\node[anchor=west] (B) at (-3mm,-6.5mm) {#2};
\node[anchor=east] (C) at (9mm,-0.5mm) {#3};
\node[anchor=east] (D) at (9mm,-6.5mm) {#4};
%\node[inner sep=0mm,draw,rounded corners=1mm,fit=(A)(D)] {};
%\draw (A.north east) -- (B.south east)
% (A.south west) -- (C.south east);
\draw[rounded corners=1mm] (-3mm,-9.5mm) rectangle (9mm,2.5mm);
}
}
}
\tikzset{
pics/specialkey/.style n args = {2}{
code = {
\draw[rounded corners=1mm,fill=gray!20] (-3mm,-9.5mm) rectangle (#2-1mm,2.5mm);
\node[inner sep=1mm,anchor=south west,text width=#2,align=center] (A) at (-3mm,-9.5mm) {#1};
}
}
}
\makeatletter
% {north-west}{south-west}{north-east}{south-east}{name}
%\def\my@keypath#1#2#3#4#5{%
% \path pic (#1) {vhsplit={#2}{#3}{#4}{#5}};
% \typeout{#1/}
%}
\newlength{\my@keylength}
\setlength{\my@keylength}{13mm}
% {name}{label}{xpos}{ypos}{width}
\def\my@specialkey#1#2#3#4#5{%
\path pic (#1) at (#3\my@keylength,#4\my@keylength) {specialkey={#2}{#5\my@keylength}};
}
% {name}{index}{north-west}{south-west}{north-east}{south-east}{vertical-index}{left-offset}
\def\my@keypath#1#2#3#4#5#6#7#8{%
\path pic (#1) at ([xshift=#8\my@keylength]#2\my@keylength,#7\my@keylength) {vhsplit={#3}{#4}{#5}{#6}};
\typeout{#1/#2/}
}
% \keyassign{1st}{2nd}{3rd}{4th line}
\def\keyassign#1#2#3#4{%
\begin{tikzpicture}%
\newcount\my@keycount %
% 1st line
\my@keycount=0
\@for\lp@elem:=#1\do{%
\expandafter\def\expandafter\my@cnum\expandafter{\the\my@keycount} %
\expandafter\def\expandafter\my@keyname\expandafter{\expandafter{\expandafter a\my@cnum}} %
\expandafter\def\expandafter\my@keyindex\expandafter{\expandafter{\my@cnum}} %
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\my@keypath\expandafter\expandafter\expandafter\my@keyname\expandafter\my@keyindex\lp@elem{0}{0} %
%\expandafter\def\expandafter\my@lastkeyname\expandafter{\my@keyname}
\advance\my@keycount by 1 %
} %
\my@specialkey{BS}{Back\\Space}{13}{0}{1.27}
% 2nd line
\my@specialkey{Tab}{Tab}{0}{-1}{1.27}
\my@keycount=0
\@for\lp@elem:=#2\do{%
\expandafter\def\expandafter\my@cnum\expandafter{\the\my@keycount} %
\expandafter\def\expandafter\my@keyname\expandafter{\expandafter{\expandafter b\my@cnum}} %
\expandafter\def\expandafter\my@keyindex\expandafter{\expandafter{\my@cnum}} %
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\my@keypath\expandafter\expandafter\expandafter\my@keyname\expandafter\my@keyindex\lp@elem{-1}{1.5} %
%\expandafter\def\expandafter\my@lastkeyname\expandafter{\my@keyname}
\advance\my@keycount by 1 %
} %
% 3rd line
\my@specialkey{CapsLock}{Caps Lock}{0}{-2}{1.57}
\my@keycount=0
\@for\lp@elem:=#3\do{%
\expandafter\def\expandafter\my@cnum\expandafter{\the\my@keycount} %
\expandafter\def\expandafter\my@keyname\expandafter{\expandafter{\expandafter c\my@cnum}} %
\expandafter\def\expandafter\my@keyindex\expandafter{\expandafter{\my@cnum}} %
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\my@keypath\expandafter\expandafter\expandafter\my@keyname\expandafter\my@keyindex\lp@elem{-2}{1.8} %
%\expandafter\def\expandafter\my@lastkeyname\expandafter{\my@keyname}
\advance\my@keycount by 1 %
} %
\my@specialkey{Enter}{Enter}{12.80}{-2}{1.47}
% 4th line
\my@specialkey{Shift}{Shift}{0}{-3}{2.07}
\my@keycount=0
\@for\lp@elem:=#4\do{%
\expandafter\def\expandafter\my@cnum\expandafter{\the\my@keycount} %
\expandafter\def\expandafter\my@keyname\expandafter{\expandafter{\expandafter d\my@cnum}} %
\expandafter\def\expandafter\my@keyindex\expandafter{\expandafter{\my@cnum}} %
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\my@keypath\expandafter\expandafter\expandafter\my@keyname\expandafter\my@keyindex\lp@elem{-3}{2.3} %
%\expandafter\def\expandafter\my@lastkeyname\expandafter{\my@keyname}
\advance\my@keycount by 1 %
} %
\my@specialkey{Shift}{Shift}{12.3}{-3}{1.97}
\end{tikzpicture}%
}
\makeatother
\begin{document}
%\keyassign{{}{}{\char"07E}{\char"060},{}{}!1,{}{}@2,{}{}\#3,{}{}\$4,{}{}\%5,{}{}{\char"05E}6,{}{}\&7,{}{}*8,{}{}(9,{}{})0,{}{}\_-,{}{}+=}%
%{{}{}{}Q,{}{}{}W,{}{}{}E,{}{}{}R,{}{}{}T,{}{}{}Y,{}{}{}U,{}{}{}I,{}{}{}O,{}{}{}P,{}{}\{[,{}{}\}],{}{}|{\char"05C}}%
%{{}{}{}A,{}{}{}S,{}{}{}D,{}{}{}F,{}{}{}G,{}{}{}H,{}{}{}J,{}{}{}K,{}{}{}L,{}{}{:}{;},{}{}{\char"022}{\char"027}}%
%{{}{}{}Z,{}{}{}X,{}{}{}C,{}{}{}V,{}{}{}B,{}{}{}N,{}{}{}M,{}{}{<}{\char"02C},{}{}{>}.,{}{}?/}
\\
%\newcommand{\mnpar}[2][1.75em]{\hspace{0.25em}\rotatebox[origin=c]{270}{\XeTeXupwardsmode1\parbox{#1}{\monbai #2}}\hspace{0.25em}}
\def\mnc#1{\rotatebox[origin=c]{270}{\mbox{\Large\monbai #1}}}
%\def\mnc#1{\rotatebox[origin=c]{270}{\parbox{1.75em}{\Large\monbai #1}}}
%\def\mncl#1{\rotatebox[origin=l]{270}{\mbox{\Large\monbai #1}}}
\def\mns#1{\rotatebox[origin=c]{270}{\mbox{\footnotesize\monbai #1}}}
\def\mnf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{\mn{᠃}}{}{},{\monbais︖}{\mn{·}}{}{}}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment