
私は Latex も Lyx も初心者です。Lyx でフレームを作成しようとしています。フレームには 2 つの列があり、最初の列は JSON 形式のテキスト、2 番目の列は最初の列の行のコメントです。これまでのところ、JSON テキストに次のようなスタイルを追加するために minted を使用しています。
最初の問題は、一部の行が長すぎることです。実際には必要ないので、ほとんどの内容を手動で切り捨てて行を短くすることができます。結果は次のようになります。
私が本当に作りたいのは、次のようなものですが、これを何度も行う必要があるため、手動では行いません。
私が求めているものが LaTeX または Lyx を使用して可能かどうかはよくわかりませんが、どんなアイデアでもいただければ幸いです。
私は見たこれ投稿したが、その回答を自分の状況に適切に使用する方法がわからない
答え1
どこでも改行を許可するように設定できますminted
。また、両側のテキストを揃えるために空行を手動で追加します。これがご希望どおりかどうか確認しましたか? 質問がある場合はお知らせください:
\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}