1

Is there a way to hide parts of a line from the LaTeX output?

For whole lines, this works:

\begin{code}
foo : Tm Γ t
\end{code}
\begin{code}[hide]
foo = someHiddenDefinitionOfFoo
\end{code}

but what if I want to hide parts of a line, e.g. parts of a type signature? For example, suppose I have this Agda signature:

sub-⊢*⊇ : ∀ {Γ Δ Θ t} (σ : Γ ⊢* Δ) (Δ⊇Θ : Δ ⊇ Θ) (e : Tm Θ t) →
  sub (σ ⊢*⊇ Δ⊇Θ) e ≡ sub σ (ren Δ⊇Θ e)

but I'd like it to look like this in the LaTeX output:

sub-⊢*⊇ : ∀ σ Δ⊇Θ e → sub (σ ⊢*⊇ Δ⊇Θ) e ≡ sub σ (ren Δ⊇Θ e)

Is this possible?

Cactus
  • 27,075
  • 9
  • 69
  • 149
  • in your example, you are not just hiding parts, you are simplifying the signature, which is not valid code, right?. – white_wolf Jan 27 '18 at 16:38
  • @white_wolf: Yes, correct. But , it could be done purely syntactically by just hiding the line fragments `{Γ Δ Θ t} (`, `: Γ ⊢* Δ) (`, `: Δ ⊇ Θ) (` and `: Tm Θ t)`. – Cactus Jan 28 '18 at 04:27

2 Answers2

1

The most robust approach for doing this kind of thing is to use anonymous modules for the arguments you want to hide:

sub-⊢*⊇ : ∀ {Γ Δ Θ t} (σ : Γ ⊢* Δ) (Δ⊇Θ : Δ ⊇ Θ) (e : Tm Θ t) →
  sub (σ ⊢*⊇ Δ⊇Θ) e ≡ sub σ (ren Δ⊇Θ e)

thus becomes

module _ {Γ Δ Θ t} where

 sub-⊢*⊇ : (σ : Γ ⊢* Δ) (Δ⊇Θ : Δ ⊇ Θ) (e : Tm Θ t) →
   sub (σ ⊢*⊇ Δ⊇Θ) e ≡ sub σ (ren Δ⊇Θ e)

If you're willing to use a very basic sed script to postprocess the LaTeX file to erase simple {var} arguments, you should be able to get your intended goal with something like:

module _ {Γ Δ Θ t} where

 sub-⊢*⊇ : ∀ σ Δ⊇Θ e → sub {Γ} (σ ⊢*⊇ Δ⊇Θ) e ≡ sub σ (ren {Δ} {Θ} Δ⊇Θ e)
gallais
  • 11,823
  • 2
  • 30
  • 63
  • I've [filed an issue](https://github.com/agda/agda/issues/2946) asking for this to be automated – gallais Feb 02 '18 at 00:02
-3

The verbatim package provides a comment environment.

\begin{comment}
    Something not taken into account
\end{comment}
Benjamin Barrois
  • 2,566
  • 13
  • 30
  • But how would I add this to the middle of my Agda program, inline, inside a `code` block? – Cactus Jan 26 '18 at 14:20
  • I must say I don't know if this is possible, has to be tested. However, I don't think there is a simple way to do as you want, except using classical comment "%". – Benjamin Barrois Jan 26 '18 at 14:26
  • 2
    How is the verbatim package relevant to generating latex using literate agda and the latex backend? – white_wolf Jan 26 '18 at 21:16