Graphics, Figures & TablesBox and tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sombrancelha
Posts: 22
Joined: Fri May 18, 2007 6:48 pm

Box and tabular

Post by sombrancelha »

Hello,

How can I achieve a result similar to the image below?

Image

I tried a mixture of boxes and tabular, but the box didn't allow the tabular enviroment.

Thank you

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Box and tabular

Post by frabjous »

Is it important that the justification lines be inside the proof boxes? If not, then I would go for the KMcalc package which you can download here (don't ask me why it's not on CTAN; it's a very useful package for those of us who typeset Kalish-Montague style proofs).
sombrancelha
Posts: 22
Joined: Fri May 18, 2007 6:48 pm

Re: Box and tabular

Post by sombrancelha »

I'd prefer if the justification was inside the boxes. But thanks for the tip on KMcalc.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Box and tabular

Post by frabjous »

Maybe someone will have a better idea, but I guess my strategy would be try to use KMcalc in a hacked way, defining some custom commands and redefining others, rather than starting from scratch. E.g., here's my first attempt at something along those lines:

Code: Select all


\documentclass{article}
\usepackage{KMcalc}

\renewcommand{\KMproveword}{}
\renewcommand{\KMProveword}{}

\newlength{\linelength}
\setlength{\linelength}{2cm}
 \newcommand{\myline}[2]{\KMline{\qquad\makebox[\linelength][l]{$#1$}#2}{}}

 \newcommand{\mylineboxunder}[2]{\KMprove{\qquad\makebox[\linelength][l]{$#1$}#2}{}}

\begin{document}

\begin{KMcalc}  
%
\mylineboxunder{\lnot p \lor q}{}
\mylineboxunder{\lnot p}{premise}
\myline{p}{assumption}
\myline{\bot}{$\lnot$e 3,\,2}
\myline{q}{$\bot$e 4}
\KMclose
\myline{p \rightarrow q}{~~$\rightarrow$i 3--5}
\KMclose
\myline{p \rightarrow q}{}
%
\end{KMcalc}

\end{document}
That generates this:
boxproof.png
boxproof.png (4.87 KiB) Viewed 3841 times
That's not quite right, but maybe it would give you enough of an idea to tweak on your own.
sombrancelha
Posts: 22
Joined: Fri May 18, 2007 6:48 pm

Box and tabular

Post by sombrancelha »

Thank you, I tried typesetting my first proof, and it was a bit unaligned, so I changed the \mylineboxunder command. However, the justification still looks weird, it's not aligned nicely (lines 1 and 2) and the spacing isn't good either (line 11)

Code: Select all

\documentclass[]{article}
\usepackage{KMcalc}

\renewcommand{\KMproveword}{}
\renewcommand{\KMProveword}{}
\newlength{\linelength}
\setlength{\linelength}{2cm}
\newcommand{\myline}[2]{\KMline{\qquad\makebox[\linelength][l]{$#1$}#2}{}}
\newcommand{\mylineboxunder}[2]{\KMprove{\qquad\makebox[\linelength][l]{\hspace{-0.27cm}$#1$}#2}{}}

\begin{document}

\begin{KMcalc}
%
\myline{p \rightarrow q}{premissa}
\mylineboxunder{r \rightarrow s}{premissa}
\myline{p}{hipótese}
\myline{q}{$\rightarrow_e 1,3$}
\myline{q \lor s}{$\lor_{i_1} 4$}
\KMclose
\mylineboxunder{p \rightarrow q \lor s}{$\rightarrow_i$ 3--5}
\myline{r}{hipótese}
\myline{s}{$\rightarrow_e$ 2,7}
\myline{q \lor s}{$\lor_{i_2}$ 8}
\KMclose
\myline{r \rightarrow q \lor s}{$\rightarrow_i$ 7--9}
\myline{p \lor r \rightarrow q \lor s}{\hspace{0.5cm}$\lor_e$ 3-5, 7-9}
%
\end{KMcalc}

\end{document}
Image
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Box and tabular

Post by frabjous »

The problem with line 11 can be solved by increasing the length I set for \linelength to whatever it needs to be. I'll need to look into the other problem; Don't have time right now, and probably means looking into the code for KMcalc. Maybe at some point.
Post Reply