雑感等

音楽,数学,語学,その他に関するメモを記す.

ビジュアル英文解釈で使われる囲み枠をLaTeXで再現

実行結果

f:id:kazmus:20190312234858p:plain

ソース

マクロの引用元
tex.stackexchange.com

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[12pt, a5j, uplatex]{jsarticle}

\usepackage{fancybox} %ovalbox
%以下,片方開いた囲み(one-side-opened fbox)の定義
%https://tex.stackexchange.com/questions/106285/boxed-equation-but-framed-only-some-sides
\makeatletter
\newcommand{\llboxed}[1]{{%
  \let\@frameb@x\l@frameb@x\fbox{#1}%
}}
\newcommand{\rrboxed}[1]{{%
  \let\@frameb@x\r@frameb@x\fbox{#1}%
}}

\def\l@frameb@x#1{%
  \@tempdima\fboxrule
  \advance\@tempdima\fboxsep
  \advance\@tempdima\dp\@tempboxa
  \hbox{%
    \lower\@tempdima\hbox{%
      \vbox{%
        \hrule\@height\fboxrule
        \hbox{%
          \vrule\@width\fboxrule
          #1%
          \vbox{%
            \vskip\fboxsep
            \box\@tempboxa
            \vskip\fboxsep}%
          #1%
          %\vrule\@width\fboxrule% Right \vrule removed
                    }%
        \hrule\@height\fboxrule}%
                          }%
        }%
}
\def\r@frameb@x#1{%
  \@tempdima\fboxrule
  \advance\@tempdima\fboxsep
  \advance\@tempdima\dp\@tempboxa
  \hbox{%
    \lower\@tempdima\hbox{%
      \vbox{%
        \hrule\@height\fboxrule
        \hbox{%
          %\vrule\@width\fboxrule% Left \vrule removed
          #1%
          \vbox{%
            \vskip\fboxsep
            \box\@tempboxa
            \vskip\fboxsep}%
          #1%
          \vrule\@width\fboxrule}%
        \hrule\@height\fboxrule}%
                          }%
        }%
}
\makeatother

\begin{document}
\rrboxed{That the man+V\ldots\ldots}\\
\\
\textbf{S} \ovalbox{\textbf{S}+\textbf{V}(\textbf{S}+\textbf{V})} \textbf{V}\\
\\
with$\rightarrow$\fbox{S'+形容詞}
\end{document}

検索ワード

  • tex frame opened box fbox