次のおもちゃのフィードバック フォームを検討してください。
\documentclass{article}
\usepackage{hyperref}
\renewcommand*{\DefaultHeightofTextMultiline}{20\baselineskip}
\begin{document}
\centering
\begin{Form}
\TextField[multiline,width=\textwidth,
value={%
You should write your feedback in a readable way, for example using bullet points:
* Insert at least 1 positive comment (mandatory)
* Insert at least 1 critical comment or question (mandatory)
\newline
Use multiple paragraphs.
\newline
Some examples of concrete, actionable feedback:
* The first figure does not have a caption; please add it.
* The derivation of Equation (7) became unclear around Equation (5). I think this is because you did not make the substitution of x explicit and feel doing so would make the argument clearer.%
},
name=mytextfield]{}%
\end{Form}
\end{document}
これを pdflatex でコンパイルすると、次の警告が表示されます (それぞれ 1 つずつ、計 2 回\newline
)。
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 20.
これは、ハイパーリファレンスで作成され、入力されたほとんどのPDFフィールドでは改行は意味がなく、おそらくサポートされていないという意味で、私にとっては驚きではありません。しかし、フォームを編集して結果のファイルを保存することで(私の場合はOkularを使用)、できる改行を追加します。フォームからデータを取得するときにpyPDF2 ののPdfFileReader.getFields
方法では、次のようになります。
'You should write your feedback in a readable way, for example using bullet points:\n* Insert at least 1 positive comment (mandatory)\n* Insert at least 1 critical comment or question (mandatory)\n\nUse multiple paragraphs.\n\nSome examples of concrete, actionable feedback:\n* The first figure does not have a caption; please add it.\n* The derivation of Equation (7) became unclear around Equation (5). I think this is because you did not make the substitution of x explicit and feel doing so would make the argument clearer.'
改行に注目してください\n
。 どうやら可能のようです。 LaTeX ファイルにこれらの改行を追加したいのですが、 これは可能ですか? どうすればできますか?
私は単純にリテラル\n
を として追加しようとしました\textbackslash{n}
が、失敗しました:
'You should write your feedback in a readable way, for example using bullet points:\\n * Insert at least 1 positive comment (mandatory)\\n * Insert at least 1 critical comment or question (mandatory)\\n \\n Use multiple paragraphs.\\n \\n Some examples of concrete, actionable feedback:\\n * The first figure does not have a caption; please add it.\\n * The derivation of Equation (7) became unclear around Equation (5). I think this is because you did not make the substitution of x explicit and feel doing so would make the argument clearer.'
答え1
アップデート\textCR
: 実際にはまたは を使用する方が適切です\textLF
。これらは、エンコーディングが変更されても機能します。
\string\n
私の場合はうまくいきました:
\documentclass{article}
\usepackage{hyperref}
\renewcommand*{\DefaultHeightofTextMultiline}{20\baselineskip}
\begin{document}
\centering
\begin{Form}
\TextField[multiline,width=\textwidth,
value={%
You should write your feedback in a readable way, for example using bullet points:\string\n
* Insert at least 1 positive comment (mandatory)\string\n
* Insert at least 1 critical comment or question (mandatory)\string\n
Use multiple paragraphs.
\string\n
Some examples of concrete, actionable feedback:\string\n
* The first figure does not have a caption; please add it.\string\n
* The derivation of Equation (7) became unclear around Equation (5). I think this is because you did not make the substitution of x explicit and feel doing so would make the argument clearer.\string\n%
},
name=mytextfield]{}%
\end{Form}
\end{document}