0

I'm new to Latex and to Lyx as well. I'm trying to create a frame in Lyx containing 2 columns, the first one being JSON formatted text, and the second one being comments of the lines of the fist column. So far I'm using minted to add some style to the JSON text, like this: What I Have 1 The first problem is that some lines are too large, I can shorten the lines by truncating the most of the content manually, since it's not actually necessary. The result is something like this: What I Have 2 What I really want to create is something like this, but without doing it manually, since I have to do this several times: What I want I don't really know if what I'm asking for is possible in using LaTeX or Lyx, but I really appreciate any ideas.

I've seen this post, but I don't know how to properly use that answers to my context

1 Answer 1

2

You can set minted to allow line breaks at anywhere. And manfully add empty lines to align the both side text. Took a look if this is what you wanted? let me know if you have any questions:

\documentclass{beamer}
\usepackage{xcolor}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile]{Frame Title}
\begin{columns}[t] % align text from top 
\begin{column}{0.5\linewidth}
\begin{scriptsize}
\begin{minted}[
bgcolor=lightgray!20, % add background color
breaklines, % allow line break
breakanywhere, % allow line break at anywhere
]
{c}
{
    "public_properties": {
        "name": "Name",
        "info": "Some Info Here",
        "value": 34.5
    },
    "private properties": {
        "id": "12",
        "authkey": "aVeryLongKeyThatItSProbablyTooLongToccupyOnlyOneLineAndINeedToShowOn"
        "timestamp": "20200101T23:00:00"


        "signedonclient": true
    }
}
\end{minted}
\end{scriptsize}
\end{column}
\begin{column}{0.5\textwidth}
\begin{scriptsize}
\begin{minted}[
bgcolor=lightgray!20, % add background color
breaklines, % allow line break
breakanywhere, % allow line break at anywhere
escapeinside=@@ % add empty lines using @@
]
{c}
@@
//Public properties
//This is the name
//This is a short information
//This is the actual value

//Private properties
//This is the ID
//This is a very long authentication key


//This is only the timestamp but I'm doing it very long on purpose so the line jump is noticed
//Indicates if the client is signed
@@
\end{minted}
\end{scriptsize}
\end{column}
\end{columns}
\end{frame}
\end{document}

enter image description here

1
  • Those "breaklines", "breakanywhere" and "escapeinside" options where exactly what I was looking for
    – Ariel
    May 9 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.