在TeX中,左双引号是“``”,右双引号是“''”。输入一篇包含双引号的文章,你的任务是
把它转换成TeX的格式。
样例输入:
"To be or not to be," quoth the Bard, "that
is the question".
样例输出:
``To be or not to be,'' quoth the Bard, ``that
把它转换成TeX的格式。
样例输入:
"To be or not to be," quoth the Bard, "that
is the question".
样例输出:
``To be or not to be,'' quoth the Bard, ``that
is the question''.
#include<stdio.h>
int main()
{
char c;
int flag = 1;
while((c = getchar()) != EOF)
{
if(c == '"')
{
printf("%s", flag ? "``" : "''");
flag = !flag;
}
else
printf("%c", c);
}
return 0;
}
本文介绍了一种将普通双引号转换为TeX格式双引号的方法,并提供了一个C语言程序示例。该程序能够正确地将文章中的双引号转换为TeX所需的左双引号“``”和右双引号“''”,适用于需要使用TeX排版的文章预处理。
1004

被折叠的 条评论
为什么被折叠?



