Spaces:
Paused
Paused
File size: 40,309 Bytes
3e6b063 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}TexLab - Professional LaTeX Converter{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<style>
:root {
--primary: #4361ee;
--primary-dark: #3a56d4;
--secondary: #7209b7;
--accent: #4cc9f0;
--success: #4caf50;
--dark: #212529;
--light: #f8f9fa;
--gray: #6c757d;
--border-radius: 12px;
--box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
--transition: all 0.3s ease;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background-color: #fafbff;
color: #333;
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Header & Navigation */
.navbar {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
padding: 1rem 0;
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
flex-shrink: 0;
}
.navbar-brand {
font-weight: 700;
font-size: 1.8rem;
color: white !important;
display: flex;
align-items: center;
}
.navbar-brand i {
margin-right: 10px;
}
.nav-link {
color: rgba(255, 255, 255, 0.85) !important;
font-weight: 500;
padding: 0.5rem 1rem !important;
border-radius: 50px;
transition: var(--transition);
margin: 0 5px;
}
.nav-link:hover, .nav-link.active {
color: white !important;
background: rgba(255, 255, 255, 0.15) !important;
}
.user-info {
display: flex;
align-items: center;
color: white;
font-weight: 500;
padding: 0.5rem 1rem;
border-radius: 50px;
background: rgba(255, 255, 255, 0.15);
margin-left: 1rem;
}
.user-info i {
margin-right: 0.5rem;
}
/* Main Content */
.main-content {
flex: 1;
padding: 2rem 0;
}
.page-header {
text-align: center;
margin-bottom: 2.5rem;
padding: 0 1rem;
}
.page-title {
font-size: 2.2rem;
font-weight: 800;
margin-bottom: 1rem;
color: var(--dark);
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.page-subtitle {
font-size: 1.1rem;
color: var(--gray);
max-width: 700px;
margin: 0 auto;
}
/* Cards */
.feature-card {
background: white;
border-radius: var(--border-radius);
padding: 2rem;
box-shadow: var(--box-shadow);
transition: var(--transition);
height: 100%;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.feature-icon {
width: 70px;
height: 70px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1.5rem;
font-size: 1.8rem;
}
.feature-title {
font-size: 1.4rem;
font-weight: 700;
margin-bottom: 1rem;
color: var(--dark);
}
.feature-description {
color: var(--gray);
margin-bottom: 1.5rem;
font-size: 0.95rem;
}
/* Buttons */
.btn-primary-gradient {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white;
border: none;
padding: 10px 22px;
border-radius: 50px;
font-weight: 600;
transition: var(--transition);
font-size: 0.95rem;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-primary-gradient:hover {
transform: translateY(-3px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
.btn-secondary-gradient {
background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
color: white;
border: none;
padding: 10px 22px;
border-radius: 50px;
font-weight: 600;
transition: var(--transition);
font-size: 0.95rem;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-secondary-gradient:hover {
transform: translateY(-3px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
.btn-accent-gradient {
background: linear-gradient(135deg, var(--accent) 0%, #4895ef 100%);
color: white;
border: none;
padding: 10px 22px;
border-radius: 50px;
font-weight: 600;
transition: var(--transition);
font-size: 0.95rem;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-accent-gradient:hover {
transform: translateY(-3px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
.btn-dark-gradient {
background: linear-gradient(135deg, #3a0ca3 0%, #250070 100%);
color: white;
border: none;
padding: 10px 22px;
border-radius: 50px;
font-weight: 600;
transition: var(--transition);
font-size: 0.95rem;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-dark-gradient:hover {
transform: translateY(-3px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
/* Notification */
.notification {
position: fixed;
top: 20px;
right: 20px;
padding: 15px 25px;
border-radius: 10px;
background: var(--success);
color: white;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
transform: translateX(200%);
transition: transform 0.3s ease;
z-index: 1000;
display: flex;
align-items: center;
}
.notification.show {
transform: translateX(0);
}
/* Footer */
.footer {
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
color: #cbd5e1;
padding: 3rem 0 2rem;
flex-shrink: 0;
margin-top: auto;
}
.footer-content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.footer-column h4 {
color: white;
font-size: 1.2rem;
margin-bottom: 1.5rem;
position: relative;
padding-bottom: 0.5rem;
}
.footer-column h4::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 50px;
height: 3px;
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
border-radius: 3px;
}
.footer-column p {
margin-bottom: 1rem;
line-height: 1.7;
}
.footer-links {
list-style: none;
padding: 0;
}
.footer-links li {
margin-bottom: 0.8rem;
}
.footer-links a {
color: #94a3b8;
text-decoration: none;
transition: var(--transition);
display: flex;
align-items: center;
}
.footer-links a:hover {
color: white;
transform: translateX(5px);
}
.footer-links a i {
margin-right: 10px;
font-size: 0.8rem;
}
.social-links {
display: flex;
gap: 1rem;
margin-top: 1rem;
}
.social-link {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.05);
color: white;
transition: var(--transition);
}
.social-link:hover {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
transform: translateY(-3px);
}
.copyright {
border-top: 1px solid rgba(255, 255, 255, 0.1);
padding-top: 2rem;
text-align: center;
color: #94a3b8;
font-size: 0.9rem;
}
.copyright a {
color: #94a3b8;
text-decoration: none;
}
.copyright a:hover {
color: white;
}
/* Chat Panel */
.chat-toggle {
position: fixed;
bottom: 30px;
right: 30px;
width: 60px;
height: 60px;
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
z-index: 999;
transition: var(--transition);
}
.chat-toggle:hover {
transform: scale(1.1);
}
/* LaTeX to Text Toggle Button */
#latexToTextToggle {
bottom: 100px;
background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
}
.chat-panel {
position: fixed;
bottom: 100px;
right: 30px;
width: 380px;
height: 500px;
background: white;
border-radius: var(--border-radius);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
display: flex;
flex-direction: column;
z-index: 1000;
overflow: hidden;
transform: translateY(20px);
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.chat-panel.active {
transform: translateY(0);
opacity: 1;
visibility: visible;
}
.chat-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white;
padding: 1rem 1.5rem;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
}
.chat-close {
background: none;
border: none;
color: white;
font-size: 1.2rem;
cursor: pointer;
padding: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: background 0.2s;
}
.chat-close:hover {
background: rgba(255, 255, 255, 0.2);
}
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 12px;
background: #f8f9fa;
}
.message {
max-width: 85%;
padding: 12px 16px;
border-radius: 18px;
position: relative;
font-size: 0.9rem;
line-height: 1.5;
}
.user-message {
align-self: flex-end;
background: var(--primary);
color: white;
border-bottom-right-radius: 5px;
}
.assistant-message {
align-self: flex-start;
background: white;
color: var(--dark);
border: 1px solid #e9ecef;
border-bottom-left-radius: 5px;
}
.message-info {
font-size: 0.7rem;
opacity: 0.7;
margin-top: 5px;
text-align: right;
}
.chat-input {
display: flex;
padding: 1rem;
background: white;
border-top: 1px solid #e9ecef;
gap: 10px;
}
.chat-input textarea {
flex: 1;
padding: 12px 15px;
border: 1px solid #dee2e6;
border-radius: 50px;
resize: none;
font-family: inherit;
height: 44px;
font-size: 0.9rem;
}
.chat-input textarea:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.chat-send {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white;
border: none;
border-radius: 50%;
width: 44px;
height: 44px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s;
}
.chat-send:hover {
transform: scale(1.05);
}
.chat-send:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.loading {
display: none;
align-self: flex-start;
background: white;
color: var(--dark);
padding: 12px 16px;
border-radius: 18px;
border: 1px solid #e9ecef;
border-bottom-left-radius: 5px;
font-size: 0.9rem;
}
.loading-dots {
display: flex;
gap: 4px;
}
.loading-dot {
width: 8px;
height: 8px;
background: var(--primary);
border-radius: 50%;
animation: bounce 1.5s infinite;
}
.loading-dot:nth-child(2) {
animation-delay: 0.2s;
}
.loading-dot:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
.welcome-message {
text-align: center;
padding: 20px;
color: var(--gray);
font-size: 0.9rem;
}
.welcome-message h6 {
color: var(--dark);
margin-bottom: 10px;
font-size: 1.1rem;
}
/* Responsive */
@media (max-width: 992px) {
.page-title {
font-size: 2rem;
}
.page-subtitle {
font-size: 1rem;
}
}
@media (max-width: 768px) {
.main-content {
padding: 1.5rem 0;
}
.page-header {
margin-bottom: 2rem;
}
.page-title {
font-size: 1.8rem;
}
.feature-card {
padding: 1.5rem;
}
.chat-panel {
width: calc(100% - 40px);
height: 70vh;
right: 20px;
bottom: 90px;
}
.navbar-nav {
text-align: center;
margin-top: 1rem;
}
.nav-link {
margin: 5px 0;
}
.footer-content {
grid-template-columns: 1fr;
gap: 1.5rem;
}
}
@media (max-width: 576px) {
.page-title {
font-size: 1.6rem;
}
.feature-icon {
width: 60px;
height: 60px;
font-size: 1.5rem;
}
.feature-title {
font-size: 1.2rem;
}
}
/* Neutral Button */
.btn-neutral {
background: #f8f9fa;
color: #333;
border: 1px solid #ddd;
padding: 12px 25px;
border-radius: 50px;
font-weight: 600;
transition: var(--transition);
font-size: 1rem;
cursor: pointer;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-neutral:hover {
background: #e9ecef;
transform: translateY(-2px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
/* Buttons for LaTeX to Text panel */
#convertLatexBtn, #copyTextBtn {
border: none;
border-radius: 6px;
font-weight: 600;
transition: var(--transition);
cursor: pointer;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
#convertLatexBtn {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: white;
}
#convertLatexBtn:hover {
transform: translateY(-2px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
#copyTextBtn:hover {
background: #e9ecef;
transform: translateY(-2px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
</style>
{% block extra_css %}{% endblock %}
</head>
<body>
{% if request.endpoint != 'auth.login' %}
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="/">
<i class="fas fa-calculator"></i>
<span>TexLab</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="/math">Math</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/scribble">Scribble</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/camera">Camera</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/table">Table</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/pdffly">PDFly</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/graph">Graph</a>
</li>
</ul>
<div class="d-flex align-items-center">
<div id="authContainer">
<!-- Auth content will be loaded here by JavaScript -->
</div>
</div>
</div>
</div>
</nav>
{% endif %}
<div class="container main-content">
{% block content %}{% endblock %}
</div>
{% if request.endpoint != 'auth.login' %}
{% if request.path == '/' %}
<footer class="site-footer">
<!-- Footer -->
<footer class="footer" style="width: 100%; background: #1e293b; color: #fff; padding: 2rem 1rem;">
<div class="container">
<div class="footer-content">
<div class="footer-column">
<h4>About TexLab</h4>
<p>
TexLab is a cutting-edge platform that transforms handwritten mathematical expressions,
scribbles, tables, and camera captures into clean, editable LaTeX code using advanced AI models.
</p>
<div class="social-links">
<a href="#" class="social-link"><i class="fab fa-twitter"></i></a>
<a href="#" class="social-link"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="social-link"><i class="fab fa-linkedin-in"></i></a>
<a href="#" class="social-link"><i class="fab fa-github"></i></a>
</div>
</div>
<div class="footer-column">
<h4>Quick Links</h4>
<ul class="footer-links">
<li><a href="/"><i class="fas fa-chevron-right"></i> Home</a></li>
<li><a href="/math"><i class="fas fa-chevron-right"></i> Math Equations</a></li>
<li><a href="/scribble"><i class="fas fa-chevron-right"></i> Scribble Converter</a></li>
<li><a href="/camera"><i class="fas fa-chevron-right"></i> Camera Capture</a></li>
<li><a href="/table"><i class="fas fa-chevron-right"></i> Table Detection</a></li>
</ul>
</div>
<div class="footer-column">
<h4>Resources</h4>
<ul class="footer-links">
<li><a href="/help"><i class="fas fa-chevron-right"></i> Documentation</a></li>
<li><a href="/tutorials"><i class="fas fa-chevron-right"></i> Tutorials</a></li>
<li><a href="/api"><i class="fas fa-chevron-right"></i> API Reference</a></li>
<li><a href="/blog"><i class="fas fa-chevron-right"></i> Blog</a></li>
<li><a href="/support"><i class="fas fa-chevron-right"></i> Support Center</a></li>
</ul>
</div>
<div class="footer-column">
<h4>Legal</h4>
<ul class="footer-links">
<li><a href="/privacy"><i class="fas fa-chevron-right"></i> Privacy Policy</a></li>
<li><a href="/terms"><i class="fas fa-chevron-right"></i> Terms of Service</a></li>
<li><a href="/cookies"><i class="fas fa-chevron-right"></i> Cookie Policy</a></li>
<li><a href="/gdpr"><i class="fas fa-chevron-right"></i> GDPR Compliance</a></li>
<li><a href="/contact"><i class="fas fa-chevron-right"></i> Contact Us</a></li>
</ul>
</div>
</div>
<div class="copyright">
<p>© 2025 TexLab. All rights reserved. Transforming handwritten content into beautiful LaTeX since 2025.</p>
<p>Designed with <i class="fas fa-heart" style="color: #f72585;"></i> for mathematicians, scientists, and educators worldwide.</p>
</div>
</div>
</footer>
</footer>
{% endif %}
{% endif %}
{% if request.endpoint != 'auth.login' %}
<!-- Chat Toggle Button -->
<button class="chat-toggle" id="chatToggle">
<i class="fas fa-robot"></i>
</button>
<!-- LaTeX to Text Toggle Button -->
<button class="chat-toggle" id="latexToTextToggle" style="bottom: 100px;">
<i class="fas fa-exchange-alt"></i>
</button>
<!-- Chat Panel -->
<div class="chat-panel" id="chatPanel">
<div class="chat-header">
<h5><i class="fas fa-robot me-2"></i>TexLab Assistant</h5>
<button class="chat-close" id="chatClose">
<i class="fas fa-times"></i>
</button>
</div>
<div class="chat-messages" id="chatMessages">
<div class="welcome-message">
<h6>Welcome to TexLab Assistant!</h6>
<p>I can help you with LaTeX, mathematics, and document conversion.</p>
<p>Try asking: "How do I write a fraction in LaTeX?"</p>
</div>
</div>
<div class="chat-input">
<textarea id="messageInput" placeholder="Type your message... (Enter to send)"></textarea>
<button class="chat-send" id="sendButton" disabled>
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
<!-- LaTeX to Text Panel -->
<div class="chat-panel" id="latexToTextPanel" style="bottom: 140px;">
<div class="chat-header">
<h5><i class="fas fa-exchange-alt me-2"></i>LaTeX to Text Converter</h5>
<button class="chat-close" id="latexToTextClose">
<i class="fas fa-times"></i>
</button>
</div>
<div class="chat-messages" id="latexToTextMessages">
<div class="welcome-message">
<h6>Convert LaTeX to Readable Text</h6>
<p>Enter LaTeX code below to convert it to human-readable text.</p>
</div>
</div>
<div style="padding: 1rem; border-top: 1px solid #e9ecef;">
<textarea id="latexInput" placeholder="Enter LaTeX code..." style="width: 100%; height: 80px; padding: 10px; border-radius: 8px; border: 1px solid #ddd; resize: vertical; font-family: 'Consolas', monospace;"></textarea>
<div style="display: flex; gap: 10px; margin-top: 10px;">
<button class="btn btn-primary-gradient" id="convertLatexBtn" style="flex: 1; padding: 8px; font-size: 0.9rem;">
<i class="fas fa-exchange-alt me-1"></i>Convert
</button>
<button class="btn btn-neutral" id="copyTextBtn" style="flex: 1; padding: 8px; font-size: 0.9rem;">
<i class="fas fa-copy me-1"></i>Copy Text
</button>
</div>
<div style="margin-top: 15px;">
<h6 style="margin-bottom: 8px; color: #4361ee;">Converted Text:</h6>
<div id="convertedTextOutput" style="background: white; border: 1px solid #e9ecef; border-radius: 8px; padding: 12px; min-height: 60px; font-size: 0.95rem;">
Your converted text will appear here...
</div>
</div>
</div>
</div>
<div class="notification" id="notification">
<i class="fas fa-check-circle me-2"></i>LaTeX code copied to clipboard!
</div>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
{% block extra_js %}{% endblock %}
<script>
// Check if we're on the login page
const isLoginPage = document.querySelector('.login-container') !== null;
if (!isLoginPage) {
// Load user authentication status
document.addEventListener('DOMContentLoaded', function() {
fetch('/auth/user')
.then(response => response.json())
.then(data => {
const authContainer = document.getElementById('authContainer');
if (data.authenticated) {
// Show user info with appropriate icon
if (data.user.email && data.user.email.includes('@')) {
// Google user
authContainer.innerHTML = `
<div class="user-info">
<i class="fab fa-google"></i>
<span>${data.user.name}</span>
</div>
<a href="/auth/logout" class="btn btn-signin ms-2">
<i class="fas fa-sign-out-alt me-1"></i>Sign Out
</a>
`;
} else {
// Guest user
authContainer.innerHTML = `
<div class="user-info">
<i class="fas fa-user"></i>
<span>Guest: ${data.user.name}</span>
</div>
<a href="/auth/logout" class="btn btn-signin ms-2">
<i class="fas fa-sign-out-alt me-1"></i>Sign Out
</a>
`;
}
} else {
authContainer.innerHTML = `
<a href="/auth/login" class="btn btn-signin">
<i class="fas fa-sign-in-alt me-1"></i>Sign In
</a>
`;
}
})
.catch(error => {
console.error('Error checking auth status:', error);
// Fallback to show sign in button
document.getElementById('authContainer').innerHTML = `
<a href="/auth/login" class="btn btn-signin">
<i class="fas fa-sign-in-alt me-1"></i>Sign In
</a>
`;
});
});
// Chat panel functionality
const chatToggle = document.getElementById('chatToggle');
const chatPanel = document.getElementById('chatPanel');
const chatClose = document.getElementById('chatClose');
const chatMessages = document.getElementById('chatMessages');
const messageInput = document.getElementById('messageInput');
const sendButton = document.getElementById('sendButton');
// Toggle chat panel
chatToggle.addEventListener('click', () => {
chatPanel.classList.toggle('active');
});
// Close chat panel
chatClose.addEventListener('click', () => {
chatPanel.classList.remove('active');
});
// Auto-resize textarea
messageInput.addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = (this.scrollHeight > 120 ? 120 : this.scrollHeight) + 'px';
});
// Enable send button when there's text
messageInput.addEventListener('input', function() {
sendButton.disabled = !this.value.trim();
});
// Send message on Enter key
messageInput.addEventListener('keydown', function(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
if (!sendButton.disabled) {
sendMessage();
}
}
});
// Send button click
sendButton.addEventListener('click', sendMessage);
// Generate a simple session ID
const sessionId = 'session_' + Date.now();
// Send message function
async function sendMessage() {
const message = messageInput.value.trim();
if (!message) return;
// Clear input and disable button
messageInput.value = '';
messageInput.style.height = '44px';
sendButton.disabled = true;
// Add user message to chat
addMessageToChat(message, 'user');
// Show loading indicator
const loadingElement = document.createElement('div');
loadingElement.className = 'loading';
loadingElement.id = 'loadingIndicator';
loadingElement.innerHTML = `
<div class="loading-dots">
<div class="loading-dot"></div>
<div class="loading-dot"></div>
<div class="loading-dot"></div>
</div>
`;
chatMessages.appendChild(loadingElement);
chatMessages.scrollTop = chatMessages.scrollHeight;
try {
// Simulate AI response (in a real implementation, you would call your AI model)
// For now, we'll generate a simple response based on common LaTeX questions
setTimeout(() => {
// Remove loading indicator
document.getElementById('loadingIndicator').remove();
// Generate response based on user input
const response = generateResponse(message);
// Add assistant response to chat
addMessageToChat(response, 'assistant');
}, 1000);
} catch (error) {
// Remove loading indicator
document.getElementById('loadingIndicator').remove();
console.error('Error:', error);
addMessageToChat('Sorry, I encountered an error. Please try again.', 'assistant');
}
}
// Generate a response based on user input
function generateResponse(userMessage) {
const lowerMessage = userMessage.toLowerCase();
if (lowerMessage.includes('fraction') || lowerMessage.includes('frac')) {
return 'To write a fraction in LaTeX, use \\\\frac{numerator}{denominator}. For example: \\\\frac{1}{2} produces ½.';
} else if (lowerMessage.includes('integral') || lowerMessage.includes('int')) {
return 'To write an integral in LaTeX, use \\\\int. For example: \\\\int_0^1 x^2 dx. For definite integrals, specify limits with _ and ^.';
} else if (lowerMessage.includes('sum') || lowerMessage.includes('sigma')) {
return 'To write a summation in LaTeX, use \\\\sum. For example: \\\\sum_{i=1}^{n} i. Use _ for lower limit and ^ for upper limit.';
} else if (lowerMessage.includes('limit') || lowerMessage.includes('lim')) {
return 'To write a limit in LaTeX, use \\\\lim. For example: \\\\lim_{x \\\\to 0} \\\\frac{\\\\sin x}{x} = 1.';
} else if (lowerMessage.includes('matrix') || lowerMessage.includes('array')) {
return 'To create a matrix in LaTeX, use \\\\begin{matrix} ... \\\\end{matrix}. For example:\\n\\\\begin{matrix}\\na & b \\\\\\nc & d\\n\\\\end{matrix}';
} else if (lowerMessage.includes('table') || lowerMessage.includes('tabular')) {
return 'To create a table in LaTeX, use the tabular environment. For example:\\n\\\\begin{tabular}{|c|c|}\\n\\\\hline\\nColumn 1 & Column 2 \\\\\\n\\\\hline\\nItem 1 & Item 2 \\\\\\n\\\\hline\\n\\\\end{tabular}';
} else if (lowerMessage.includes('equation') || lowerMessage.includes('align')) {
return 'To write equations in LaTeX, you can use:\\n- Inline: $E = mc^2$\\n- Display: $$E = mc^2$$\\n- Aligned: \\\\begin{align} x &= y \\\\ y &= z \\\\end{align}';
} else if (lowerMessage.includes('texlab') || lowerMessage.includes('help')) {
return "I'm the TexLab Assistant! I can help you with:\\n- LaTeX syntax and commands\\n- Mathematical notation\\n- Document conversion tips\\n- Using TexLab features\\n\\nJust ask me any LaTeX or math question!";
} else {
// Default response
return "I'm the TexLab Assistant. I can help you with LaTeX syntax, mathematical notation, and document conversion. Try asking me something like 'How do I write a fraction in LaTeX?' or 'How do I create a matrix?'";
}
}
// Add message to chat UI
function addMessageToChat(content, sender) {
// Remove welcome message if it exists
const welcomeMessage = chatMessages.querySelector('.welcome-message');
if (welcomeMessage) {
welcomeMessage.remove();
}
const messageElement = document.createElement('div');
messageElement.className = `message ${sender}-message`;
const time = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
messageElement.innerHTML = `
<div>${content}</div>
<div class="message-info">${sender === 'user' ? 'You' : 'Assistant'} • ${time}</div>
`;
chatMessages.appendChild(messageElement);
chatMessages.scrollTop = chatMessages.scrollHeight;
// Re-enable send button
sendButton.disabled = false;
}
// Global notification function
function showNotification(message) {
const notification = document.getElementById("notification");
if (notification) {
notification.innerHTML = `<i class="fas fa-check-circle me-2"></i>${message}`;
notification.classList.add('show');
setTimeout(() => {
notification.classList.remove('show');
}, 3000);
}
}
// LaTeX to Text functionality
const latexToTextToggle = document.getElementById('latexToTextToggle');
const latexToTextPanel = document.getElementById('latexToTextPanel');
const latexToTextClose = document.getElementById('latexToTextClose');
const latexInput = document.getElementById('latexInput');
const convertLatexBtn = document.getElementById('convertLatexBtn');
const copyTextBtn = document.getElementById('copyTextBtn');
const convertedTextOutput = document.getElementById('convertedTextOutput');
// Toggle LaTeX to Text panel
latexToTextToggle.addEventListener('click', () => {
latexToTextPanel.classList.toggle('active');
// Close chat panel if it's open
chatPanel.classList.remove('active');
});
// Close LaTeX to Text panel
latexToTextClose.addEventListener('click', () => {
latexToTextPanel.classList.remove('active');
});
// Convert LaTeX to text function
function convertLatexToText(latexStr) {
if (!latexStr) return "";
// Make a copy to work with
let text = latexStr;
// Remove common LaTeX commands
text = text.replace(/\\begin\{.*?\}/g, '');
text = text.replace(/\\end\{.*?\}/g, '');
// Replace common math symbols with readable text
const replacements = {
'\\\\alpha': 'alpha',
'\\\\beta': 'beta',
'\\\\gamma': 'gamma',
'\\\\delta': 'delta',
'\\\\epsilon': 'epsilon',
'\\\\theta': 'theta',
'\\\\lambda': 'lambda',
'\\\\mu': 'mu',
'\\\\pi': 'pi',
'\\\\sigma': 'sigma',
'\\\\phi': 'phi',
'\\\\omega': 'omega',
'\\\\infty': 'infinity',
'\\\\int': 'integral',
'\\\\sum': 'sum',
'\\\\prod': 'product',
'\\\\lim': 'limit',
'\\\\sqrt': 'square root',
'\\\\frac': 'fraction',
'\\\\times': 'times',
'\\\\cdot': 'cdot',
'\\\\div': 'divided by',
'\\\\pm': 'plus or minus',
'\\\\mp': 'minus or plus',
'\\\\leq': 'less than or equal to',
'\\\\geq': 'greater than or equal to',
'\\\\neq': 'not equal to',
'\\\\approx': 'approximately',
'\\\\equiv': 'equivalent to',
'\\\\subset': 'subset of',
'\\\\subseteq': 'subset or equal to',
'\\\\cup': 'union',
'\\\\cap': 'intersection',
'\\\\in': 'element of',
'\\\\notin': 'not element of',
'\\\\forall': 'for all',
'\\\\exists': 'there exists',
'\\\\nexists': 'there does not exist',
'\\\\emptyset': 'empty set',
'\\\\varnothing': 'empty set',
'\\\\mathbb{R}': 'real numbers',
'\\\\mathbb{N}': 'natural numbers',
'\\\\mathbb{Z}': 'integers',
'\\\\mathbb{Q}': 'rational numbers',
'\\\\mathbb{C}': 'complex numbers',
'\\\\to': 'to',
'\\\\rightarrow': 'rightarrow',
'\\\\left': '',
'\\\\right': '',
'\\\\big': '',
'\\\\Big': '',
'\\\\bigg': '',
'\\\\Bigg': '',
};
for (const [pattern, replacement] of Object.entries(replacements)) {
const regex = new RegExp(pattern, 'g');
text = text.replace(regex, replacement);
}
// Handle fractions specifically: \frac{a}{b} -> (a over b)
text = text.replace(/\\frac\{([^}]*)\}\{([^}]*)\}/g, '($1 over $2)');
// Handle subscripts: _{text} -> _text or _a -> _a
text = text.replace(/_\{([^}]*)\}/g, '_$1');
// Handle superscripts: ^{text} -> ^text or ^a -> ^a
text = text.replace(/\^\{([^}]*)\}/g, '^$1');
// Handle square roots: \sqrt{text} -> square root of (text)
text = text.replace(/\\sqrt\{([^}]*)\}/g, 'square root of ($1)');
// Remove remaining braces
text = text.replace(/\{/g, '(').replace(/\}/g, ')');
// Clean up extra spaces
text = text.replace(/\s+/g, ' ').trim();
return text;
}
// Convert button click handler
convertLatexBtn.addEventListener('click', () => {
const latexCode = latexInput.value.trim();
if (!latexCode) {
convertedTextOutput.textContent = 'Please enter some LaTeX code to convert.';
return;
}
try {
const convertedText = convertLatexToText(latexCode);
convertedTextOutput.textContent = convertedText;
} catch (error) {
console.error('Conversion error:', error);
convertedTextOutput.textContent = 'An error occurred during conversion. Please try again.';
}
});
// Copy text button click handler
copyTextBtn.addEventListener('click', () => {
const text = convertedTextOutput.textContent;
if (!text || text === 'Your converted text will appear here...') {
showNotification('Nothing to copy!');
return;
}
navigator.clipboard.writeText(text).then(() => {
showNotification('Text copied to clipboard!');
}).catch(err => {
console.error('Failed to copy:', err);
showNotification('Failed to copy text. Please try again.');
});
});
}
</script>
</body>
</html> |