feldroy / two-scoops-of-django-3.x

The issue tracker, changelog, and code repository for Two Scoops of Django 3.x
https://www.feldroy.com/products/two-scoops-of-django-3-x
343 stars 51 forks source link

Make the tables pretty #12

Open pydanny opened 4 years ago

pydanny commented 4 years ago

The tabu LaTeX package we used in the past is no longer working and no longer maintained. We need a new way to present our tables in an attractive fashion.

If you are an expert at LaTeX, we're interested in talking to you. We will pay for expert LaTeX help.

kakulukia commented 4 years ago

Here is an example of a working table: 6.2 When to use null and blank by field Did you check all differences of broken and working tables? There are more, but stripping down this one and filling it with content of a broken table should reveal the issue.

pydanny commented 4 years ago

@kakulukia Are you an expert on LaTeX formatting or providing advice on debugging? Just curious, because we could really use the former.

kakulukia commented 4 years ago

I worked with Latex once or twice, which ain't qualifying. But I saw some working tables and thus the chance of fixing the problem by spotting differences ist pretty high. I consider myself fairly good at that topic no matter the coding language. We could try to fix it together.

pydanny commented 4 years ago

Unfortunately, fixing the tables in Two Scoops of Django is going to require a lot more than the rubber duck debugging you are suggesting. I can't overstate the difficulty of this challenge. While we (me and Audrey) could do it ourselves, then we wouldn't be working on the material on the book for weeks.

So while I appreciate the offer, we're going to hire a LaTeX expert to get us past this hurdle.

pydanny commented 4 years ago

What our current code looks like:

\begin{table}[htp]
  \begin{tabularx}{\textwidth}{ |X|X|X| }    
      \adjust Code & \adjust Import Type & \adjust Usage \\
      % \texttt{\small from core.views import FoodMixin} & absolute import & Use when importing from outside the current app \\
    from core.views import FoodMixin & absolute import & Use when importing from outside the current app \\
      \hline
      % \texttt{\small from .models import WaffleCone} & explicit relative & Use when importing from another module in the current app \\
    from .models import WaffleCone & explicit relative & Use when importing from another module in the current app \\
      \hline
      % \texttt{\small from models import WaffleCone} & implicit relative & Often used when importing from another module in the current app, but not a good idea \\
    from models import WaffleCone & implicit relative & Often used when importing from another module in the current app, but not a good idea \\
    \hline
  \end{tabularx}
    \caption{Imports: Absolute vs. Explicit Relative vs. Implicit Relative}
    \label{tab:importstypes}  
\end{table}
quique commented 4 years ago

Would you be happy with something like this? tabla.pdf

aaronchall commented 4 years ago

Update: Now that I actually look at the content, the "implicit relative" import is disallowed in Python 3 now.

I couldn't get the \adjust or \textwidth to work, so I deleted that part, but I think these kinds of tables look better:

$ cat lat.tex 
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{adjustbox}

\begin{document}

\begin{table}[htp]
  %\begin{tabularx}{\textwidth}{ |X|X|X| }    
  \begin{tabularx}{300pt}{ X X X }    
       Code &  Import Type &  Usage \\
       \hline
      % \texttt{\small from core.views import FoodMixin} & absolute import & Use when importing from outside the current app \\
    from core.views import FoodMixin & absolute import & Use when importing from outside the current app \\
     % \hline
      % \texttt{\small from .models import WaffleCone} & explicit relative & Use when importing from another module in the current app \\
    from .models import WaffleCone & explicit relative & Use when importing from another module in the current app \\
     % \hline
      % \texttt{\small from models import WaffleCone} & implicit relative & Often used when importing from another module in the current app, but not a good idea \\
    from models import WaffleCone & implicit relative & Often used when importing from another module in the current app, but not a good idea \\
    %\hline
  \end{tabularx}
    \caption{Imports: Absolute vs. Explicit Relative vs. Implicit Relative}
    \label{tab:importstypes}  
\end{table}

\end{document}
[lat.pdf](https://github.com/feldroy/two-scoops-of-django-3.x/files/4698728/lat.pdf)

lat.pdf

pydanny commented 4 years ago

Tufte Style?

pydanny commented 4 years ago

Black top style?