Tikz 내부 테이블 셀

Tikz 내부 테이블 셀

LaTeX 지식이 매우 부족하여 기존 매크로를 수정하여 브리지 다이어그램을 생성하려고 합니다. 삽입은 기본 출력입니다. Tikz가 그린 사각형을 다이어그램의 (거의) 중앙에 배치하고 싶습니다. 내가 어떻게 해? 여기에 이미지 설명을 입력하세요

내 MWE:

\documentclass[oneside,english]{book}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[paperwidth=6in,paperheight=9in]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{array}
\usepackage{amsmath}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\@ifundefined{lettrine}{\usepackage{lettrine}}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{enumitem}
\usepackage{needspace}
\usepackage{adjustbox}
{\usepackage{tikz}
%\usepackage{mathpazo}


\newcommand{\seatLabel}[1]{\textsc{#1}}

%%
\newlength{\br}
\setlength{\br}{18em}
%
\renewcommand{\c}{\(\clubsuit\)}
\renewcommand{\d}{\(\diamondsuit\)}
\newcommand{\h}{\(\heartsuit\)}
\newcommand{\s}{\(\spadesuit\)}

%
\newcommand{\hand}[4]{
 \begin{minipage}[t]{\br}%I chose \br=8em
 \begin{tabbing}
 %width of parbox depends on the parameters:
 %min{\br, max{string #1, ..., string #4}}
  \(\spadesuit\)  \= #1 \\
  \(\heartsuit\)  \> #2 \\
  \(\diamondsuit\)\> #3 \\
  \(\clubsuit\)   \> #4
 \end{tabbing}
 \end{minipage}     }%end \hand
%


%
\newcommand{\bd}[6]{%
\begin{tabular}[t]{ p{7em} p{7em} p{7em}}
#1 & #3 & #2\\
#4 & {\begin{tikzpicture}
\draw (0,0) -- (1,0) -- (1,1) -- (0,1) -- (0,0);
\end{tikzpicture}} & #5\\
   & #6 &
\end{tabular}
}%end \crdima
%


\newcommand{\phandcctest}[5]{
\begin{minipage}[t]{1.0cm}%I chose \br=8em
%\begin{minipage}[t]{2.3cm}%I chose \br=8em
%\end{minipage}
\begin{minipage}[t]{2.0cm}%I chose \br=8em
\begin{tabbing}
%width of parbox depends on the parameters:
%min{\br, max{string #1, ..., string #4}}
 #5 \= \\
\(\spadesuit\) \= #1 \\
\(\heartsuit\) \> #2 \\
\(\diamondsuit\)\> #3 \\
\(\clubsuit\) \> #4
\end{tabbing}
\end{minipage}
%\hfill
\end{minipage} }%end \hand

\AtBeginDocument{
  \def\labelitemi{\(\cdot\)}
}

\makeatother

\usepackage{babel}
\begin{document}

\title{A Switch in Time}


\author{Matthew Granovetter}

\maketitle

\chapter*{Introduction}

\thispagestyle{empty}

\noindent \noun{The following deal} was reported by Eric Kokish in
\emph{Bridge Today} magazine, Nov/Dec 1993 issue.

\noindent \begin{quote}
\begin{minipage}{18em}
\begin{small}
Santiago, Chile, Bermuda Bowl 1993, Semifinals\\
{Norway vs. Brazil}\\
\end{small}
\vspace{-1em}
\begin{center}\small{\textbf{VuGraph}}\\ \end{center}
\bd
{\begin{minipage}[t]{\br} \small Dealer: East\\N-S vulnerable   \end{minipage}}%
{\begin{minipage}[t]{\br} \small Lead: spade\\Contract: heart   \end{minipage}}%
{\phandcctest{QJ42}{\underline{7}}{AJ763}{843}{\seatLabel{Aa}}}%
{\phandcctest{K1085}{\underline{A}K543}{Q4}{AJ}{\seatLabel{Barbosa}}}%
{\phandcctest{976}{Q86\underline{2}}{K10952}{K}{\seatLabel {Comacho}}}%
{\phandcctest{A3}{J10\underline{9}}{8}{Q1097652}{\seatLabel{Groetheim}}}%
\\[1em]
\begin{minipage}[t]{\br}
\small{Closed Room Result: Five clubs doubled by the Brazilian South, down 1, +100 for Norway.}
\end{minipage}
\end{minipage}
\end{quote}``Five clubs doubled goes down only one in the closed room. The Brazilian
supporters are screaming with relief and delight. How can they possibly
lose now?''


\end{document}

답변1

\begin{tabular}[t]{ p{7em} p{7em} p{7em}}62행에서 로 바꿀 수 있습니다 \begin{tabular}[t]{ m{7em} m{7em} m{7em}}. 그리고 tikz에서 직사각형을 그리려면 다음과 같이 하면 됩니다 \draw (0,0) rectangle (1,1);. ;)

\documentclass[varwidth,border=50]{standalone}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[paperwidth=6in,paperheight=9in]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{array}
\usepackage{amsmath}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\@ifundefined{lettrine}{\usepackage{lettrine}}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{enumitem}
\usepackage{needspace}
\usepackage{adjustbox}
{\usepackage{tikz}
%\usepackage{mathpazo}


\newcommand{\seatLabel}[1]{\textsc{#1}}

%%
\newlength{\br}
\setlength{\br}{18em}
%
\renewcommand{\c}{\(\clubsuit\)}
\renewcommand{\d}{\(\diamondsuit\)}
\newcommand{\h}{\(\heartsuit\)}
\newcommand{\s}{\(\spadesuit\)}

%
\newcommand{\hand}[4]{
 \begin{minipage}[t]{\br}%I chose \br=8em
 \begin{tabbing}
 %width of parbox depends on the parameters:
 %min{\br, max{string #1, ..., string #4}}
  \(\spadesuit\)  \= #1 \\
  \(\heartsuit\)  \> #2 \\
  \(\diamondsuit\)\> #3 \\
  \(\clubsuit\)   \> #4
 \end{tabbing}
 \end{minipage}     }%end \hand
%


%
\newcommand{\bd}[6]{%
\begin{tabular}[t]{ m{7em} m{7em} m{7em}}
#1 & #3 & #2\\
#4 & {\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\end{tikzpicture}} & #5\\
   & #6 &
\end{tabular}
}%end \crdima
%


\newcommand{\phandcctest}[5]{
\begin{minipage}[t]{1.0cm}%I chose \br=8em
%\begin{minipage}[t]{2.3cm}%I chose \br=8em
%\end{minipage}
\begin{minipage}[t]{2.0cm}%I chose \br=8em
\begin{tabbing}
%width of parbox depends on the parameters:
%min{\br, max{string #1, ..., string #4}}
 #5 \= \\
\(\spadesuit\) \= #1 \\
\(\heartsuit\) \> #2 \\
\(\diamondsuit\)\> #3 \\
\(\clubsuit\) \> #4
\end{tabbing}
\end{minipage}
%\hfill
\end{minipage} }%end \hand

\AtBeginDocument{
  \def\labelitemi{\(\cdot\)}
}

\makeatother

\usepackage[english]{babel}
\begin{document}

\title{A Switch in Time}


\author{Matthew Granovetter}

\maketitle

\chapter*{Introduction}

\thispagestyle{empty}

\noindent \noun{The following deal} was reported by Eric Kokish in
\emph{Bridge Today} magazine, Nov/Dec 1993 issue.

\noindent \begin{quote}
\begin{minipage}{18em}
\begin{small}
Santiago, Chile, Bermuda Bowl 1993, Semifinals\\
{Norway vs. Brazil}\\
\end{small}
\vspace{-1em}
\begin{center}\small{\textbf{VuGraph}}\\ \end{center}
\bd
{\begin{minipage}[t]{\br} \small Dealer: East\\N-S vulnerable   \end{minipage}}%
{\begin{minipage}[t]{\br} \small Lead: spade\\Contract: heart   \end{minipage}}%
{\phandcctest{QJ42}{\underline{7}}{AJ763}{843}{\seatLabel{Aa}}}%
{\phandcctest{K1085}{\underline{A}K543}{Q4}{AJ}{\seatLabel{Barbosa}}}%
{\phandcctest{976}{Q86\underline{2}}{K10952}{K}{\seatLabel {Comacho}}}%
{\phandcctest{A3}{J10\underline{9}}{8}{Q1097652}{\seatLabel{Groetheim}}}%
\\[1em]
\begin{minipage}[t]{\br}
\small{Closed Room Result: Five clubs doubled by the Brazilian South, down 1, +100 for Norway.}
\end{minipage}
\end{minipage}
\end{quote}``Five clubs doubled goes down only one in the closed room. The Brazilian
supporters are screaming with relief and delight. How can they possibly
lose now?''


\end{document}

여기에 이미지 설명을 입력하세요

답변2

CTAN을 보셨나요? 라는 패키지가 있습니다.bridge. 물론!

실제로 이는 .tex여전히 \documentstyle(LaTeX 2.09)를 사용하는 1991년 파일입니다. 내 컴퓨터에 다운로드하고 \documentstyle로 변경하고 \documentclasspdflatex로 컴파일하여 다음을 얻었습니다.

여기에 이미지 설명을 입력하세요

당신이 원하는 것 같습니다. 그림은 명령으로 완료됩니다.

\begin{quote}
\crdima{N/None}{%
  \begin{minipage}[t]{\br}
     Play:\\demo
  \end{minipage}}%
  {\hand{J74}{AJ}{QJT2}{Q874}}%
  {\hand{A3}{K76}{963}{KJ952}}%
  {\hand{K86}{T9542}{874}{T3}}%
  {\hand{QT952}{Q83}{AK5}{A6}}%
\end{quote}

이는 이 문서에 정의되어 있습니다.

관련 정보