Considere el siguiente formulario de comentarios sobre juguetes:
\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}
Al compilar esto con pdflatex aparece la siguiente advertencia (dos veces, una para cada una \newline
):
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 20.
Esto no me sorprende en el sentido de que para la mayoría de los campos PDF creados y completados mediante Hyperref, no tiene sentido tener saltos de línea y probablemente no sea compatible. Sin embargo, al editar el formulario y guardar el archivo resultante (usando Okular en mi caso), puedopoderagregar saltos de línea. Al sacar los datos del formulario usandoPyPDF2El método de PdfFileReader.getFields
, obtengo:
'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.'
Observe las nuevas líneas \n
. Entonces parece posible. Me gustaría agregar esas nuevas líneas en mi archivo LaTeX. es posible? ¿Cómo puedo hacer esto?
Intenté ingenuamente agregar literal \n
as \textbackslash{n}
, pero falla:
'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.'
Respuesta1
Actualizar: en realidad es mejor usar \textCR
o \textLF
. También funcionarán si cambia la codificación.
\string\n
funciona para mi:
\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}